From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH v2 2/4] isar-bootstrap: Consolidate common host and target bits
Date: Wed, 11 Aug 2021 21:02:35 +0200 [thread overview]
Message-ID: <cb163a8915d661a3a4a1818379fd56aeb2aeec24.1628708557.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1628708557.git.jan.kiszka@siemens.com>
From: Jan Kiszka <jan.kiszka@siemens.com>
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 <jan.kiszka@siemens.com>
---
.../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
next prev parent reply other threads:[~2021-08-11 19:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-11 19:02 [PATCH v2 0/4] isar-bootstrap cleanups, fixes and improvements Jan Kiszka
2021-08-11 19:02 ` [PATCH v2 1/4] isar-bootstrap: Remove obsolete and incorrect skipping of rebuild Jan Kiszka
2021-08-11 19:02 ` Jan Kiszka [this message]
2021-08-11 19:02 ` [PATCH v2 3/4] isar-bootstrap: Further consolidate host and target Jan Kiszka
2021-08-11 19:02 ` [PATCH v2 4/4] isar-bootstrap: Ensure rebuild on changes in DISTRO_APT_SOURCES/PREFERENCES files Jan Kiszka
2021-08-24 13:48 ` [PATCH v2 0/4] isar-bootstrap cleanups, fixes and improvements Anton Mikanovich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb163a8915d661a3a4a1818379fd56aeb2aeec24.1628708557.git.jan.kiszka@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox