From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6995249996219023360 X-Received: by 2002:a5d:49c1:: with SMTP id t1mr38576571wrs.141.1628708560067; Wed, 11 Aug 2021 12:02:40 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:e5c5:: with SMTP id a5ls1973243wrn.0.gmail; Wed, 11 Aug 2021 12:02:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrgmiCp4DxMj0USozi7vfLLcWsU9ogvjPvcoxC/+K2P3ys52iq9G0ME9uTbSy/5z0Znc5A X-Received: by 2002:a5d:42c2:: with SMTP id t2mr21538285wrr.49.1628708559012; Wed, 11 Aug 2021 12:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628708559; cv=none; d=google.com; s=arc-20160816; b=sB3q5eSB2CbuRue013ra4KeXXflsCyBPkrw7tZ90d/283j9s1ZuHnUoAUmf7Q89ey0 DHEfVBnxuNRKKuMv+kYNGDQ+LJZs7ub7Ho539QGBLPierAHsQxhbvPx097YRiIvlH+hT OerXm5uG8Ok3iphN4RE5xErjryucom7BTWb5rwzt6UDeVTFfEFZfHz+/Hma3tlYsIuDP ZyYjIQVgkpiSBYqOXOFt4XUHpcV7AGhk/D9FIP14fVFEn9TKxgYZVyZYDkXLuBdw/Q6C NgL92zPl7jGrxX+XhgwdzZ1q4DKWuZ2yqdRtsjgyKnPmaTAtHAneK5kmjmYSKeG1ZRYJ HVBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from; bh=ZhWeyyXD5urpelB0BRwrSNZV+xAn6svEuIFIzWK2EAg=; b=xp3XqEHbZ6aPc8bAuUfIVxj+5vP5jF+an03jnkNm1oNhGhNQ//ha6OjnWFIOozQynB tlxiztpt3q73aTmi6xZrFt4NgHjAX4Q2rNIzyYUWJEoDDo7kw1DWA6M+8WWxEUTEVSt9 NvAcPpd/IWNNtrpG/cLgVikeFmS9EKm2jVuKDHBQRmtKcUAphKR64qsXqYdmCWioB/2o 9OiA2kiEikhuZEUietBJAhbLGwjOclPYZcRGDEfBM0FW77fvYno6ARApE2DBXjOD9YNh t2qwgFYy/Y+5Xz2kb+5r4lw8cbpO/OieU//ra4YlAVaDs6RKONolCLa2Ocm+B8RkeBuG sOog== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id z70si559916wmc.0.2021.08.11.12.02.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Aug 2021 12:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id 17BJ2cJS011481 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 11 Aug 2021 21:02:38 +0200 Received: from md1f2u6c.ad001.siemens.net ([167.87.241.87]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 17BJ2bHD028609 for ; Wed, 11 Aug 2021 21:02:38 +0200 From: Jan Kiszka To: isar-users Subject: [PATCH v2 2/4] isar-bootstrap: Consolidate common host and target bits Date: Wed, 11 Aug 2021 21:02:35 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: ri+YmixxCW/g From: Jan Kiszka Avoids duplicating too much identical logic. The key element is introducing DISTRO_VARS_PREFIX that adds "HOST_" for the buildchroot-host case. Signed-off-by: Jan Kiszka --- .../isar-bootstrap/isar-bootstrap-host.bb | 31 +--------------- .../isar-bootstrap/isar-bootstrap-target.bb | 27 -------------- .../isar-bootstrap/isar-bootstrap.inc | 37 ++++++++++++++++++- 3 files changed, 38 insertions(+), 57 deletions(-) diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb index c985383..8f1fced 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-host.bb @@ -9,42 +9,15 @@ Description = "Minimal host Debian root file system" DEPLOY_ISAR_BOOTSTRAP = "${DEPLOY_DIR_BOOTSTRAP}/${HOST_DISTRO}-host_${DISTRO}-${DISTRO_ARCH}" +DISTRO_VARS_PREFIX = "HOST_" + require isar-bootstrap.inc HOST_DISTRO_BOOTSTRAP_KEYS ?= "" DISTRO_BOOTSTRAP_KEYS = "${HOST_DISTRO_BOOTSTRAP_KEYS}" -do_apt_config_prepare[dirs] = "${WORKDIR}" -do_apt_config_prepare[vardeps] += "\ - APTPREFS \ - HOST_DISTRO_APT_PREFERENCES \ - DEBDISTRONAME \ - APTSRCS \ - HOST_DISTRO_APT_SOURCES \ - DEPLOY_ISAR_BOOTSTRAP \ - " -python do_apt_config_prepare() { - apt_preferences_out = d.getVar("APTPREFS", True) - apt_preferences_list = ( - d.getVar("HOST_DISTRO_APT_PREFERENCES", True) or "" - ).split() - aggregate_files(d, apt_preferences_list, apt_preferences_out) - - apt_sources_out = d.getVar("APTSRCS", True) - apt_sources_init_out = d.getVar("APTSRCS_INIT", True) - apt_sources_list = ( - d.getVar("HOST_DISTRO_APT_SOURCES", True) or "" - ).split() - - aggregate_files(d, apt_sources_list, apt_sources_init_out) - aggregate_aptsources_list(d, apt_sources_list, apt_sources_out) -} -addtask apt_config_prepare before do_bootstrap after do_unpack - OVERRIDES_append = ":${@get_distro_needs_https_support(d, True)}" -do_bootstrap[vardeps] += "HOST_DISTRO_APT_SOURCES" do_bootstrap() { isar_bootstrap --host } -addtask bootstrap before do_build after do_generate_keyrings diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb index 80e7f40..7158a86 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap-target.bb @@ -11,35 +11,8 @@ DEPLOY_ISAR_BOOTSTRAP = "${DEPLOY_DIR_BOOTSTRAP}/${DISTRO}-${DISTRO_ARCH}" require isar-bootstrap.inc -do_apt_config_prepare[dirs] = "${WORKDIR}" -do_apt_config_prepare[vardeps] += "\ - APTPREFS \ - DISTRO_APT_PREFERENCES \ - DEBDISTRONAME \ - APTSRCS \ - DISTRO_APT_SOURCES \ - DEPLOY_ISAR_BOOTSTRAP \ - " -python do_apt_config_prepare() { - apt_preferences_out = d.getVar("APTPREFS", True) - apt_preferences_list = ( - d.getVar("DISTRO_APT_PREFERENCES", True) or "" - ).split() - aggregate_files(d, apt_preferences_list, apt_preferences_out) - - apt_sources_out = d.getVar("APTSRCS", True) - apt_sources_init_out = d.getVar("APTSRCS_INIT", True) - apt_sources_list = (d.getVar("DISTRO_APT_SOURCES", True) or "").split() - - aggregate_files(d, apt_sources_list, apt_sources_init_out) - aggregate_aptsources_list(d, apt_sources_list, apt_sources_out) -} -addtask apt_config_prepare before do_bootstrap after do_unpack - OVERRIDES_append = ":${@get_distro_needs_https_support(d, False)}" -do_bootstrap[vardeps] += "DISTRO_APT_SOURCES" do_bootstrap() { isar_bootstrap } -addtask bootstrap before do_build after do_generate_keyrings diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc index b858c8c..a846389 100644 --- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc +++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc @@ -27,6 +27,8 @@ DISTRO_BOOTSTRAP_BASE_PACKAGES = "locales" DISTRO_BOOTSTRAP_BASE_PACKAGES_append_gnupg = ",gnupg" DISTRO_BOOTSTRAP_BASE_PACKAGES_append_https-support = "${@https_support(d)}" +DISTRO_VARS_PREFIX ?= "" + inherit deb-dl-dir python () { @@ -220,15 +222,48 @@ do_generate_keyrings() { } addtask generate_keyrings before do_build after do_unpack +do_apt_config_prepare[dirs] = "${WORKDIR}" +do_apt_config_prepare[vardeps] += " \ + APTPREFS \ + ${DISTRO_VARS_PREFIX}DISTRO_APT_PREFERENCES \ + DEBDISTRONAME \ + APTSRCS \ + ${DISTRO_VARS_PREFIX}DISTRO_APT_SOURCES \ + DEPLOY_ISAR_BOOTSTRAP \ + " +python do_apt_config_prepare() { + apt_preferences_out = d.getVar("APTPREFS", True) + apt_preferences_list = ( + d.getVar(d.getVar("DISTRO_VARS_PREFIX") + "DISTRO_APT_PREFERENCES", True) or "" + ).split() + aggregate_files(d, apt_preferences_list, apt_preferences_out) + + apt_sources_out = d.getVar("APTSRCS", True) + apt_sources_init_out = d.getVar("APTSRCS_INIT", True) + apt_sources_list = ( + d.getVar(d.getVar("DISTRO_VARS_PREFIX") + "DISTRO_APT_SOURCES", True) or "" + ).split() + + aggregate_files(d, apt_sources_list, apt_sources_init_out) + aggregate_aptsources_list(d, apt_sources_list, apt_sources_out) +} +addtask apt_config_prepare before do_bootstrap after do_unpack + def get_host_release(): import platform rel = platform.release() return rel -do_bootstrap[vardeps] += "DISTRO_APT_PREMIRRORS ISAR_ENABLE_COMPAT_ARCH" +do_bootstrap[vardeps] += " \ + DISTRO_APT_PREMIRRORS \ + ISAR_ENABLE_COMPAT_ARCH \ + ${DISTRO_VARS_PREFIX}DISTRO_APT_SOURCES \ + " do_bootstrap[dirs] = "${DEPLOY_DIR_BOOTSTRAP}" do_bootstrap[depends] = "base-apt:do_cache isar-apt:do_cache_config" +addtask bootstrap before do_build after do_generate_keyrings + isar_bootstrap() { IS_HOST="" while true; do -- 2.31.1