From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6995155626989977600 X-Received: by 2002:a05:6512:4026:: with SMTP id br38mr12544236lfb.531.1628686587389; Wed, 11 Aug 2021 05:56:27 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:651c:88c:: with SMTP id d12ls371206ljq.9.gmail; Wed, 11 Aug 2021 05:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX54RvD1h1BXmmqgSWAVwuVYJyndz6ZGr2nSjKaEkNhb7kC74nK9IiQsg27IWBtfwDTMC6 X-Received: by 2002:a05:651c:481:: with SMTP id s1mr21967767ljc.446.1628686586181; Wed, 11 Aug 2021 05:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628686586; cv=none; d=google.com; s=arc-20160816; b=bNJR4hOwBCp1gtBDgei8iK+ssWReielDWkMGeyB0Rgm65rNDQzC3KBf9ZIoBhJLskI 8qs3/VEDeAYSVurFD0y65xDMHmlLLY5sdiez5eZoSq217AWOTNNjWH6dN58IpkIZVFv1 NGEvz9jUBcBr1AveVXwdGhV72o5d7ly05hfnEenM0+Xpc1u++GqJ6r3Kb3AiqmNJOP4u rJCAcGHdrAf3CsSH3kyKftmB/GFMRLjiCYMTQASqr4EVA9WDyk95uPsK9Q9VpsZ/Axee CPISxraTwZ1J8J0vlYOya+TwUEITnReBsQ4IBMhIqM459ExcnDTWNDg/WEBQMLN/9+Tx F90g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:mime-version:user-agent :date:message-id:to:subject:from; bh=ZhWeyyXD5urpelB0BRwrSNZV+xAn6svEuIFIzWK2EAg=; b=0DyIMZV1R3tOTiUIFIW/0HB3twDrrqL+SYswSCybG4aUrs5ssTGraAEqXASFvqrVtT bjch0W1r0iDzNExD4G7YkMxymcI2euvxQk7BUOMfi7QJchzS4tFu/N0qonVQLuPuznx1 0NsSeObfuRxhIFeFnxj2RE5U1jImbmle+CjY4VOg4GiAn6hyEbjgpVQcz9D9+sh0bqKu qVRukSfMTdT+sZs4bPRfqBh35zVDcVSgLkpYkAg7gwebIaRrAoCxr7A6i6+5sSAK8YSH n2LPVtBD6ALMS0bck8XJ9LBe2ZmqSxXsrPbZu9ImUCnS2xwQBOpd3+fiNsgkxhdwiaTX oW9w== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 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 lizzard.sbs.de (lizzard.sbs.de. [194.138.37.39]) by gmr-mx.google.com with ESMTPS id j7si1348762ljc.1.2021.08.11.05.56.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Aug 2021 05:56:26 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 as permitted sender) client-ip=194.138.37.39; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 194.138.37.39 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 lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id 17BCuPOF016690 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 11 Aug 2021 14:56:25 +0200 Received: from [167.87.241.87] ([167.87.241.87]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 17BCuOBn023592 for ; Wed, 11 Aug 2021 14:56:25 +0200 From: Jan Kiszka Subject: [PATCH] isar-bootstrap: Consolidate common host and target bits To: isar-users Message-ID: <2e8f2ae5-8bc1-ded2-af6a-cee6d059c102@siemens.com> Date: Wed, 11 Aug 2021 14:56:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: LleA1fy7dQkp 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