public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used
@ 2022-11-29 12:20 Uladzimir Bely
  2022-11-29 12:20 ` [PATCH v5 1/4] Populate base-apt from both DISTRO and HOST_DISTRO download dirs Uladzimir Bely
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Uladzimir Bely @ 2022-11-29 12:20 UTC (permalink / raw)
  To: isar-users

This patchset is mostly intended for downstreams that prefer
renaming DISTRO variable (like `meta-iot2050`) and use
ISAR_CROSS_COMPILE = "1".

This also fixes the case with cross-build on raspberry targets
from cached base-apt repo. While it uses separate repositories
for host (Debian) and target (Raspbian) distros, base-apt is
splittend onto two parts corresponding to the original repos.

Also, testsuite repro tests were updated to cover crosss-build case
and raspberry target is now used in them.

Additionally, download directories for deb packages are now rely
on {HOST_}BASE_DISTRO variables instead of {HOST_}DISTRO.

Changes since v4:
- Normalized download directories (patch 4)

Changes since v3:
- Renamed BASE_HOST_DISTRO to HOST_BASE_DISTRO.

Changes since v2:
- Cleaned garbage in commit message for patch 2.

Changes since v1:
- Support cached cross-build from base-apt for different base distros
for host and target (e.g. raspberry).

Uladzimir Bely (4):
  Populate base-apt from both DISTRO and HOST_DISTRO download dirs
  testsuite: Run signed repro test in cross mode
  testsuite: Replace bananapi with rpi-arm-v7 in signed repro tests
  Normalize deb download dirs when custom DISTRO used

 meta-isar/conf/distro/raspbian-stretch.conf   |  2 +
 meta-isar/conf/distro/raspios-bullseye.conf   |  2 +
 meta-isar/conf/distro/ubuntu-focal.conf       |  2 +
 meta/classes/dpkg-base.bbclass                |  4 +-
 meta/classes/dpkg.bbclass                     |  4 +-
 meta/classes/image-tools-extension.bbclass    |  4 +-
 meta/classes/rootfs.bbclass                   |  9 ++--
 meta/conf/distro/debian-common.conf           |  2 +
 .../isar-bootstrap/isar-bootstrap.inc         | 13 ++++--
 meta/recipes-devtools/base-apt/base-apt.bb    | 46 ++++++++++---------
 .../buildchroot/buildchroot-host.bb           |  1 +
 .../sbuild-chroot/sbuild-chroot-host.bb       |  1 +
 testsuite/citest.py                           |  4 +-
 13 files changed, 56 insertions(+), 38 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 1/4] Populate base-apt from both DISTRO and HOST_DISTRO download dirs
  2022-11-29 12:20 [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Uladzimir Bely
@ 2022-11-29 12:20 ` Uladzimir Bely
  2022-11-29 12:20 ` [PATCH v5 2/4] testsuite: Run signed repro test in cross mode Uladzimir Bely
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Uladzimir Bely @ 2022-11-29 12:20 UTC (permalink / raw)
  To: isar-users

Downstreams may want to change DISTRO to some custom value.
When cross-building, this leads to downloading packages for host
and target distros to the different download subdirs.

While base-apt is populated only from DISTRO download subdir,
second cached (ISAR_USE_CACHED_BASE_REPO = "1") build fails due to
missing packages in base-apt.

The similar issue happens with cross-building raspberry targets
since they use their own mirrors and DISTRO.

Fix the issue by splitting base-apt by introducing HOST_BASE_DISTRO
variable that is used instead of BASE_DISTRO for caching builds
for host-related components (e.g., isar-bootstrap, buildchroot-host,
sbuild-chroot-host). Target components still use BASE_DISTRO.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta-isar/conf/distro/raspbian-stretch.conf   |  2 +
 meta-isar/conf/distro/raspios-bullseye.conf   |  2 +
 meta-isar/conf/distro/ubuntu-focal.conf       |  2 +
 meta/conf/distro/debian-common.conf           |  2 +
 .../isar-bootstrap/isar-bootstrap.inc         |  9 +++-
 meta/recipes-devtools/base-apt/base-apt.bb    | 47 ++++++++++---------
 6 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/meta-isar/conf/distro/raspbian-stretch.conf b/meta-isar/conf/distro/raspbian-stretch.conf
index c8f523b3..1ad0152f 100644
--- a/meta-isar/conf/distro/raspbian-stretch.conf
+++ b/meta-isar/conf/distro/raspbian-stretch.conf
@@ -6,6 +6,8 @@
 BASE_DISTRO = "raspbian"
 BASE_DISTRO_CODENAME = "stretch"
 
+HOST_BASE_DISTRO = "debian"
+
 HOST_DISTRO ?= "debian-stretch"
 HOST_DISTRO_APT_SOURCES ?= "conf/distro/${HOST_DISTRO}.list"
 
diff --git a/meta-isar/conf/distro/raspios-bullseye.conf b/meta-isar/conf/distro/raspios-bullseye.conf
index 5e4a09c9..1f65c3cd 100644
--- a/meta-isar/conf/distro/raspios-bullseye.conf
+++ b/meta-isar/conf/distro/raspios-bullseye.conf
@@ -6,6 +6,8 @@
 BASE_DISTRO = "raspios"
 BASE_DISTRO_arm64 = "debian"
 
+HOST_BASE_DISTRO ?= "debian"
+
 BASE_DISTRO_CODENAME = "bullseye"
 HOST_DISTRO ?= "debian-bullseye"
 HOST_DISTRO_APT_SOURCES ?= "conf/distro/${HOST_DISTRO}.list"
diff --git a/meta-isar/conf/distro/ubuntu-focal.conf b/meta-isar/conf/distro/ubuntu-focal.conf
index 379b5b30..084f8e3d 100644
--- a/meta-isar/conf/distro/ubuntu-focal.conf
+++ b/meta-isar/conf/distro/ubuntu-focal.conf
@@ -8,6 +8,8 @@ require conf/distro/debian-common.conf
 BASE_DISTRO = "ubuntu"
 BASE_DISTRO_CODENAME = "focal"
 
+HOST_BASE_DISTRO = "${BASE_DISTRO}"
+
 DISTRO_APT_SOURCES_arm64 ?= "conf/distro/${BASE_DISTRO}-${BASE_DISTRO_CODENAME}-ports.list"
 HOST_DISTRO_APT_SOURCES_arm64 ?= "conf/distro/${HOST_DISTRO}.list conf/distro/${HOST_DISTRO}-ports.list"
 
diff --git a/meta/conf/distro/debian-common.conf b/meta/conf/distro/debian-common.conf
index c18eebc2..ada7dc6e 100644
--- a/meta/conf/distro/debian-common.conf
+++ b/meta/conf/distro/debian-common.conf
@@ -5,6 +5,8 @@
 
 BASE_DISTRO = "debian"
 
+HOST_BASE_DISTRO ?= "${BASE_DISTRO}"
+
 HOST_DISTRO_APT_SOURCES ?= "conf/distro/${HOST_DISTRO}.list"
 DISTRO_APT_SOURCES ?= "conf/distro/${BASE_DISTRO}-${BASE_DISTRO_CODENAME}.list"
 
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index f32d192e..14d876aa 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -29,6 +29,7 @@ DISTRO_BOOTSTRAP_BASE_PACKAGES_append_gnupg = ",gnupg"
 DISTRO_BOOTSTRAP_BASE_PACKAGES_append_https-support = "${@https_support(d)}"
 DISTRO_VARS_PREFIX ?= "${@'HOST_' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else ''}"
 BOOTSTRAP_DISTRO = "${@d.getVar('HOST_DISTRO' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'DISTRO')}"
+BOOTSTRAP_BASE_DISTRO = "${@d.getVar('HOST_BASE_DISTRO' if d.getVar('BOOTSTRAP_FOR_HOST') == '1' else 'BASE_DISTRO')}"
 FILESEXTRAPATHS_append = ":${BBPATH}"
 
 inherit deb-dl-dir
@@ -111,7 +112,7 @@ def get_apt_source_mirror(d, aptsources_entry_list):
     import re
 
     if bb.utils.to_boolean(d.getVar('ISAR_USE_CACHED_BASE_REPO')):
-        premirrors = "\S* file://${REPO_BASE_DIR}/${BASE_DISTRO}\n"
+        premirrors = "\S* file://${REPO_BASE_DIR}/${BOOTSTRAP_BASE_DISTRO}\n"
     else:
         premirrors = d.getVar('DISTRO_APT_PREMIRRORS', True) or ""
     mirror_list = [entry.split()
@@ -319,11 +320,15 @@ do_bootstrap() {
                          "${ROOTFSDIR}/etc/apt/preferences.d/bootstrap"
         mkdir -p "${ROOTFSDIR}/etc/apt/sources.list.d"
         if [ "${ISAR_USE_CACHED_BASE_REPO}" = "1" ]; then
-            line="file:///base-apt/${BASE_DISTRO} ${BASE_DISTRO_CODENAME} main"
+            line="file:///base-apt/${BOOTSTRAP_BASE_DISTRO} ${BASE_DISTRO_CODENAME} main"
             if [ -z "${BASE_REPO_KEY}" ]; then
                 line="[trusted=yes] ${line}"
             fi
             echo "deb ${line}" >  "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
+            line="file:///base-apt/${BASE_DISTRO} ${BASE_DISTRO_CODENAME} main"
+            if [ -z "${BASE_REPO_KEY}" ]; then
+                line="[trusted=yes] ${line}"
+            fi
             echo "deb-src ${line}" >>  "${ROOTFSDIR}/etc/apt/sources.list.d/base-apt.list"
 
             mkdir -p ${ROOTFSDIR}/base-apt
diff --git a/meta/recipes-devtools/base-apt/base-apt.bb b/meta/recipes-devtools/base-apt/base-apt.bb
index 506a28ff..05016d80 100644
--- a/meta/recipes-devtools/base-apt/base-apt.bb
+++ b/meta/recipes-devtools/base-apt/base-apt.bb
@@ -13,7 +13,10 @@ KEYFILES ?= ""
 BASE_REPO_FEATURES ?= ""
 
 populate_base_apt() {
-    find "${DEBDIR}"/"${DISTRO}" -name '*\.deb' | while read package; do
+    distro="${1}"
+    base_distro="${2}"
+
+    find "${DEBDIR}"/"${distro}" -name '*\.deb' | while read package; do
         # NOTE: due to packages stored by reprepro are not modified, we can
         # use search by filename to check if package is already in repo. In
         # addition, md5sums are compared to ensure that the package is the
@@ -22,25 +25,25 @@ populate_base_apt() {
 
         # Check if this package is already in base-apt
         ret=0
-        repo_contains_package "${REPO_BASE_DIR}/${BASE_DISTRO}" "${package}" ||
+        repo_contains_package "${REPO_BASE_DIR}/${base_distro}" "${package}" ||
             ret=$?
         [ "${ret}" = "0" ] && continue
         if [ "${ret}" = "1" ]; then
-            repo_del_package "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
-                "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
+            repo_del_package "${REPO_BASE_DIR}"/"${base_distro}" \
+                "${REPO_BASE_DB_DIR}"/"${base_distro}" \
                 "${BASE_DISTRO_CODENAME}" \
-                "${base_apt_p}"
+                "${package}"
         fi
 
-        repo_add_packages "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
-            "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
+        repo_add_packages "${REPO_BASE_DIR}"/"${base_distro}" \
+            "${REPO_BASE_DB_DIR}"/"${base_distro}" \
             "${BASE_DISTRO_CODENAME}" \
             "${package}"
     done
 
-    find "${DEBSRCDIR}"/"${DISTRO}" -name '*\.dsc' | while read package; do
-        repo_add_srcpackage "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
-            "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}" \
+    find "${DEBSRCDIR}"/"${distro}" -name '*\.dsc' | while read package; do
+        repo_add_srcpackage "${REPO_BASE_DIR}"/"${base_distro}" \
+            "${REPO_BASE_DB_DIR}"/"${base_distro}" \
             "${BASE_DISTRO_CODENAME}" \
             "${package}"
     done
@@ -55,20 +58,20 @@ repo() {
         "${BASE_DISTRO_CODENAME}" \
         "${WORKDIR}/distributions.in" \
         "${KEYFILES}"
-
-    if [ -d '${BUILDCHROOT_HOST_DIR}/var/cache/apt' ] &&
-        [ '${DISTRO}' != '${HOST_DISTRO}' ]; then
-        # We would need two separate repository paths for that.
-        # Otherwise packages (especially the 'all' arch ones) from one
-        # distribution can influence the package versions of the other
-        # distribution.
-        bbfatal "Different host and target distributions are currently not supported." \
-                "Try it without cross-build."
-    fi
-
-    populate_base_apt
+    populate_base_apt "${DISTRO}" "${BASE_DISTRO}"
     repo_sanity_test "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
         "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}"
+
+    if [ '${DISTRO}' != '${HOST_DISTRO}' ]; then
+        repo_create "${REPO_BASE_DIR}"/"${HOST_BASE_DISTRO}" \
+            "${REPO_BASE_DB_DIR}"/"${HOST_BASE_DISTRO}" \
+            "${BASE_DISTRO_CODENAME}" \
+            "${WORKDIR}/distributions.in" \
+            "${KEYFILES}"
+        populate_base_apt "${HOST_DISTRO}" "${HOST_BASE_DISTRO}"
+        repo_sanity_test "${REPO_BASE_DIR}"/"${HOST_BASE_DISTRO}" \
+            "${REPO_BASE_DB_DIR}"/"${HOST_BASE_DISTRO}"
+    fi
 }
 
 python do_cache() {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 2/4] testsuite: Run signed repro test in cross mode
  2022-11-29 12:20 [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Uladzimir Bely
  2022-11-29 12:20 ` [PATCH v5 1/4] Populate base-apt from both DISTRO and HOST_DISTRO download dirs Uladzimir Bely
@ 2022-11-29 12:20 ` Uladzimir Bely
  2022-11-29 12:20 ` [PATCH v5 3/4] testsuite: Replace bananapi with rpi-arm-v7 in signed repro tests Uladzimir Bely
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Uladzimir Bely @ 2022-11-29 12:20 UTC (permalink / raw)
  To: isar-users

Both signed and unsigned tests are done in non-cross mode.

Changing CROSS_COMPILE to "1" for one signed variant in order
to cover cross-build from local `base-apt` testing

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 testsuite/citest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/citest.py b/testsuite/citest.py
index 2dc78015..cf9139f8 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -32,7 +32,7 @@ class ReproTest(CIBaseTest):
 
         self.init()
         try:
-            self.perform_repro_test(targets, signed=True)
+            self.perform_repro_test(targets, signed=True, cross=True)
         finally:
             self.move_in_build_dir('tmp', 'tmp_repro_signed')
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 3/4] testsuite: Replace bananapi with rpi-arm-v7 in signed repro tests
  2022-11-29 12:20 [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Uladzimir Bely
  2022-11-29 12:20 ` [PATCH v5 1/4] Populate base-apt from both DISTRO and HOST_DISTRO download dirs Uladzimir Bely
  2022-11-29 12:20 ` [PATCH v5 2/4] testsuite: Run signed repro test in cross mode Uladzimir Bely
@ 2022-11-29 12:20 ` Uladzimir Bely
  2022-11-29 12:20 ` [PATCH v5 4/4] Normalize deb download dirs when custom DISTRO used Uladzimir Bely
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Uladzimir Bely @ 2022-11-29 12:20 UTC (permalink / raw)
  To: isar-users

While rpi-arm-v7 target uses own repositories and DISTRO variable,
it has more chances to fail in cross-build repro test, so it looks
like a better choice for this test than debian-only bananapi target.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 testsuite/citest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuite/citest.py b/testsuite/citest.py
index cf9139f8..d4fb177f 100755
--- a/testsuite/citest.py
+++ b/testsuite/citest.py
@@ -26,7 +26,7 @@ class ReproTest(CIBaseTest):
     """
     def test_repro_signed(self):
         targets = [
-            'mc:bananapi-bullseye:isar-image-base',
+            'mc:rpi-arm-v7-bullseye:isar-image-base',
             'mc:qemuarm64-bullseye:isar-image-base'
                   ]
 
-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v5 4/4] Normalize deb download dirs when custom DISTRO used
  2022-11-29 12:20 [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Uladzimir Bely
                   ` (2 preceding siblings ...)
  2022-11-29 12:20 ` [PATCH v5 3/4] testsuite: Replace bananapi with rpi-arm-v7 in signed repro tests Uladzimir Bely
@ 2022-11-29 12:20 ` Uladzimir Bely
  2022-12-04 19:06 ` [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Jan Kiszka
  2022-12-13 12:37 ` Anton Mikanovich
  5 siblings, 0 replies; 7+ messages in thread
From: Uladzimir Bely @ 2022-11-29 12:20 UTC (permalink / raw)
  To: isar-users

This changes deb download directory to the path related to BASE_DISTRO
variable (instead of DISTRO previously used).

In this case, if cross-compile mode used, equal host and target
packages will be placed to the same download directory, if their
"base" distros are equal.

In case of cross-build, this saves disk space, reduces network usage
and makes download directory look cleaner.

Signed-off-by: Uladzimir Bely <ubely@ilbers.de>
---
 meta/classes/dpkg-base.bbclass                      |  4 ++--
 meta/classes/dpkg.bbclass                           |  4 ++--
 meta/classes/image-tools-extension.bbclass          |  4 ++--
 meta/classes/rootfs.bbclass                         |  9 +++++----
 meta/recipes-core/isar-bootstrap/isar-bootstrap.inc |  4 ++--
 meta/recipes-devtools/base-apt/base-apt.bb          | 13 ++++++-------
 .../buildchroot/buildchroot-host.bb                 |  1 +
 .../sbuild-chroot/sbuild-chroot-host.bb             |  1 +
 8 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index e4f6711c..260aa73e 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -115,7 +115,7 @@ do_apt_fetch() {
 
     for uri in "${SRC_APT}"; do
         schroot -d / -c ${SBUILD_CHROOT} -- \
-            sh -c 'mkdir -p /downloads/deb-src/"$1"/"$2" && cd /downloads/deb-src/"$1"/"$2" && apt-get -y --download-only --only-source source "$2"' my_script "${DISTRO}" "${uri}"
+            sh -c 'mkdir -p /downloads/deb-src/"$1"/"$2" && cd /downloads/deb-src/"$1"/"$2" && apt-get -y --download-only --only-source source "$2"' my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}" "${uri}"
     done
     schroot_delete_configs
 }
@@ -147,7 +147,7 @@ do_apt_unpack() {
                 cd ${PP}
                 cp /downloads/deb-src/"${1}"/"${2}"/* ${PP}
                 dpkg-source -x "${dscfile}" "${PPS}"' \
-                    my_script "${DISTRO}" "${uri}"
+                    my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}" "${uri}"
     done
     schroot_delete_configs
 }
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 1f55e3e7..4ac4273f 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -52,9 +52,9 @@ dpkg_runbuild() {
         bbwarn "Export of '${line}' detected, please migrate to templates"
     done
 
-    distro="${DISTRO}"
+    distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
     if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
-        distro="${HOST_DISTRO}"
+        distro="${HOST_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
     fi
 
     deb_dl_dir_import "${WORKDIR}/rootfs" "${distro}"
diff --git a/meta/classes/image-tools-extension.bbclass b/meta/classes/image-tools-extension.bbclass
index ecd4365b..101704d0 100644
--- a/meta/classes/image-tools-extension.bbclass
+++ b/meta/classes/image-tools-extension.bbclass
@@ -19,9 +19,9 @@ do_install_imager_deps() {
         exit
     fi
 
-    distro="${DISTRO}"
+    distro="${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
     if [ ${ISAR_CROSS_COMPILE} -eq 1 ]; then
-        distro="${HOST_DISTRO}"
+        distro="${HOST_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
     fi
 
     buildchroot_do_mounts
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index d19ac037..786682d9 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -6,6 +6,7 @@ inherit deb-dl-dir
 ROOTFS_ARCH ?= "${DISTRO_ARCH}"
 ROOTFS_DISTRO ?= "${DISTRO}"
 ROOTFS_PACKAGES ?= ""
+ROOTFS_BASE_DISTRO ?= "${BASE_DISTRO}"
 
 # Features of the rootfs creation:
 # available features are:
@@ -137,7 +138,7 @@ rootfs_install_resolvconf() {
 ROOTFS_INSTALL_COMMAND += "rootfs_import_package_cache"
 rootfs_import_package_cache[weight] = "5"
 rootfs_import_package_cache() {
-    deb_dl_dir_import ${ROOTFSDIR} ${ROOTFS_DISTRO}
+    deb_dl_dir_import ${ROOTFSDIR} ${ROOTFS_BASE_DISTRO}-${BASE_DISTRO_CODENAME}
 }
 
 ROOTFS_INSTALL_COMMAND += "rootfs_install_pkgs_download"
@@ -154,7 +155,7 @@ ROOTFS_INSTALL_COMMAND += "${ROOTFS_INSTALL_COMMAND_BEFORE_EXPORT}"
 ROOTFS_INSTALL_COMMAND += "rootfs_export_package_cache"
 rootfs_export_package_cache[weight] = "5"
 rootfs_export_package_cache() {
-    deb_dl_dir_export ${ROOTFSDIR} ${ROOTFS_DISTRO}
+    deb_dl_dir_export ${ROOTFSDIR} ${ROOTFS_BASE_DISTRO}-${BASE_DISTRO_CODENAME}
 }
 
 ROOTFS_INSTALL_COMMAND += "${@ 'rootfs_install_clean_files' if (d.getVar('ROOTFS_CLEAN_FILES') or '').strip() else ''}"
@@ -219,8 +220,8 @@ cache_deb_src() {
     # which generates a new state from upstream.
     sudo cp -Trpn "${BOOTSTRAP_SRC}/var/lib/apt/lists/" "${ROOTFSDIR}/var/lib/apt/lists/"
 
-    deb_dl_dir_import ${ROOTFSDIR} ${ROOTFS_DISTRO}
-    debsrc_download ${ROOTFSDIR} ${ROOTFS_DISTRO}
+    deb_dl_dir_import ${ROOTFSDIR} ${ROOTFS_BASE_DISTRO}-${BASE_DISTRO_CODENAME}
+    debsrc_download ${ROOTFSDIR} ${ROOTFS_BASE_DISTRO}-${BASE_DISTRO_CODENAME}
 
     sudo rm -f "${ROOTFSDIR}"/etc/resolv.conf
     if [ -e "${ROOTFSDIR}"/etc/resolv.conf.isar ] ||
diff --git a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
index 14d876aa..b9ae16cd 100644
--- a/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
+++ b/meta/recipes-core/isar-bootstrap/isar-bootstrap.inc
@@ -299,7 +299,7 @@ do_bootstrap() {
     export BOOTSTRAP_FOR_HOST debootstrap_args E
 
     sudo rm -rf --one-file-system "${ROOTFSDIR}"
-    deb_dl_dir_import "${ROOTFSDIR}" "${BOOTSTRAP_DISTRO}"
+    deb_dl_dir_import "${ROOTFSDIR}" "${BOOTSTRAP_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
 
     sudo -E -s <<'EOSUDO'
         set -e
@@ -407,7 +407,7 @@ do_bootstrap() {
         # Finalize debootstrap by setting the link in deploy
         ln -Tfsr "${ROOTFSDIR}" "${DEPLOY_ISAR_BOOTSTRAP}"
 EOSUDO
-    deb_dl_dir_export "${ROOTFSDIR}" "${BOOTSTRAP_DISTRO}"
+    deb_dl_dir_export "${ROOTFSDIR}" "${BOOTSTRAP_BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
 }
 
 addtask bootstrap before do_build after do_generate_keyrings
diff --git a/meta/recipes-devtools/base-apt/base-apt.bb b/meta/recipes-devtools/base-apt/base-apt.bb
index 05016d80..ea885fe6 100644
--- a/meta/recipes-devtools/base-apt/base-apt.bb
+++ b/meta/recipes-devtools/base-apt/base-apt.bb
@@ -13,10 +13,9 @@ KEYFILES ?= ""
 BASE_REPO_FEATURES ?= ""
 
 populate_base_apt() {
-    distro="${1}"
-    base_distro="${2}"
+    base_distro="${1}"
 
-    find "${DEBDIR}"/"${distro}" -name '*\.deb' | while read package; do
+    find "${DEBDIR}"/"${base_distro}-${BASE_DISTRO_CODENAME}" -name '*\.deb' | while read package; do
         # NOTE: due to packages stored by reprepro are not modified, we can
         # use search by filename to check if package is already in repo. In
         # addition, md5sums are compared to ensure that the package is the
@@ -41,7 +40,7 @@ populate_base_apt() {
             "${package}"
     done
 
-    find "${DEBSRCDIR}"/"${distro}" -name '*\.dsc' | while read package; do
+    find "${DEBSRCDIR}"/"${base_distro}-${BASE_DISTRO_CODENAME}" -name '*\.dsc' | while read package; do
         repo_add_srcpackage "${REPO_BASE_DIR}"/"${base_distro}" \
             "${REPO_BASE_DB_DIR}"/"${base_distro}" \
             "${BASE_DISTRO_CODENAME}" \
@@ -58,17 +57,17 @@ repo() {
         "${BASE_DISTRO_CODENAME}" \
         "${WORKDIR}/distributions.in" \
         "${KEYFILES}"
-    populate_base_apt "${DISTRO}" "${BASE_DISTRO}"
+    populate_base_apt "${BASE_DISTRO}"
     repo_sanity_test "${REPO_BASE_DIR}"/"${BASE_DISTRO}" \
         "${REPO_BASE_DB_DIR}"/"${BASE_DISTRO}"
 
-    if [ '${DISTRO}' != '${HOST_DISTRO}' ]; then
+    if [ '${BASE_DISTRO}' != '${HOST_BASE_DISTRO}' ]; then
         repo_create "${REPO_BASE_DIR}"/"${HOST_BASE_DISTRO}" \
             "${REPO_BASE_DB_DIR}"/"${HOST_BASE_DISTRO}" \
             "${BASE_DISTRO_CODENAME}" \
             "${WORKDIR}/distributions.in" \
             "${KEYFILES}"
-        populate_base_apt "${HOST_DISTRO}" "${HOST_BASE_DISTRO}"
+        populate_base_apt "${HOST_BASE_DISTRO}"
         repo_sanity_test "${REPO_BASE_DIR}"/"${HOST_BASE_DISTRO}" \
             "${REPO_BASE_DB_DIR}"/"${HOST_BASE_DISTRO}"
     fi
diff --git a/meta/recipes-devtools/buildchroot/buildchroot-host.bb b/meta/recipes-devtools/buildchroot/buildchroot-host.bb
index d8498a56..529578d6 100644
--- a/meta/recipes-devtools/buildchroot/buildchroot-host.bb
+++ b/meta/recipes-devtools/buildchroot/buildchroot-host.bb
@@ -10,6 +10,7 @@ BUILDCHROOT_VARIANT = "host"
 require buildchroot.inc
 ROOTFS_ARCH = "${HOST_ARCH}"
 ROOTFS_DISTRO = "${HOST_DISTRO}"
+ROOTFS_BASE_DISTRO = "${HOST_BASE_DISTRO}"
 
 BUILDCHROOT_PREINSTALL ?= " \
     ${BUILDCHROOT_PREINSTALL_COMMON} \
diff --git a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
index aa82846b..a37e49b7 100644
--- a/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
+++ b/meta/recipes-devtools/sbuild-chroot/sbuild-chroot-host.bb
@@ -11,3 +11,4 @@ require sbuild-chroot.inc
 
 ROOTFS_ARCH = "${HOST_ARCH}"
 ROOTFS_DISTRO = "${HOST_DISTRO}"
+ROOTFS_BASE_DISTRO = "${HOST_BASE_DISTRO}"
-- 
2.20.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used
  2022-11-29 12:20 [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Uladzimir Bely
                   ` (3 preceding siblings ...)
  2022-11-29 12:20 ` [PATCH v5 4/4] Normalize deb download dirs when custom DISTRO used Uladzimir Bely
@ 2022-12-04 19:06 ` Jan Kiszka
  2022-12-13 12:37 ` Anton Mikanovich
  5 siblings, 0 replies; 7+ messages in thread
From: Jan Kiszka @ 2022-12-04 19:06 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

On 29.11.22 13:20, Uladzimir Bely wrote:
> This patchset is mostly intended for downstreams that prefer
> renaming DISTRO variable (like `meta-iot2050`) and use
> ISAR_CROSS_COMPILE = "1".
> 
> This also fixes the case with cross-build on raspberry targets
> from cached base-apt repo. While it uses separate repositories
> for host (Debian) and target (Raspbian) distros, base-apt is
> splittend onto two parts corresponding to the original repos.
> 
> Also, testsuite repro tests were updated to cover crosss-build case
> and raspberry target is now used in them.
> 
> Additionally, download directories for deb packages are now rely
> on {HOST_}BASE_DISTRO variables instead of {HOST_}DISTRO.
> 
> Changes since v4:
> - Normalized download directories (patch 4)
> 
> Changes since v3:
> - Renamed BASE_HOST_DISTRO to HOST_BASE_DISTRO.
> 
> Changes since v2:
> - Cleaned garbage in commit message for patch 2.
> 
> Changes since v1:
> - Support cached cross-build from base-apt for different base distros
> for host and target (e.g. raspberry).
> 
> Uladzimir Bely (4):
>   Populate base-apt from both DISTRO and HOST_DISTRO download dirs
>   testsuite: Run signed repro test in cross mode
>   testsuite: Replace bananapi with rpi-arm-v7 in signed repro tests
>   Normalize deb download dirs when custom DISTRO used
> 
>  meta-isar/conf/distro/raspbian-stretch.conf   |  2 +
>  meta-isar/conf/distro/raspios-bullseye.conf   |  2 +
>  meta-isar/conf/distro/ubuntu-focal.conf       |  2 +
>  meta/classes/dpkg-base.bbclass                |  4 +-
>  meta/classes/dpkg.bbclass                     |  4 +-
>  meta/classes/image-tools-extension.bbclass    |  4 +-
>  meta/classes/rootfs.bbclass                   |  9 ++--
>  meta/conf/distro/debian-common.conf           |  2 +
>  .../isar-bootstrap/isar-bootstrap.inc         | 13 ++++--
>  meta/recipes-devtools/base-apt/base-apt.bb    | 46 ++++++++++---------
>  .../buildchroot/buildchroot-host.bb           |  1 +
>  .../sbuild-chroot/sbuild-chroot-host.bb       |  1 +
>  testsuite/citest.py                           |  4 +-
>  13 files changed, 56 insertions(+), 38 deletions(-)
> 

Tested locally, and it looks good!

Thanks,
Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used
  2022-11-29 12:20 [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Uladzimir Bely
                   ` (4 preceding siblings ...)
  2022-12-04 19:06 ` [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Jan Kiszka
@ 2022-12-13 12:37 ` Anton Mikanovich
  5 siblings, 0 replies; 7+ messages in thread
From: Anton Mikanovich @ 2022-12-13 12:37 UTC (permalink / raw)
  To: Uladzimir Bely, isar-users

29.11.2022 15:20, Uladzimir Bely wrote:
> This patchset is mostly intended for downstreams that prefer
> renaming DISTRO variable (like `meta-iot2050`) and use
> ISAR_CROSS_COMPILE = "1".
>
> This also fixes the case with cross-build on raspberry targets
> from cached base-apt repo. While it uses separate repositories
> for host (Debian) and target (Raspbian) distros, base-apt is
> splittend onto two parts corresponding to the original repos.
>
> Also, testsuite repro tests were updated to cover crosss-build case
> and raspberry target is now used in them.
>
> Additionally, download directories for deb packages are now rely
> on {HOST_}BASE_DISTRO variables instead of {HOST_}DISTRO.

Applied to next, thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-12-13 12:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-29 12:20 [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Uladzimir Bely
2022-11-29 12:20 ` [PATCH v5 1/4] Populate base-apt from both DISTRO and HOST_DISTRO download dirs Uladzimir Bely
2022-11-29 12:20 ` [PATCH v5 2/4] testsuite: Run signed repro test in cross mode Uladzimir Bely
2022-11-29 12:20 ` [PATCH v5 3/4] testsuite: Replace bananapi with rpi-arm-v7 in signed repro tests Uladzimir Bely
2022-11-29 12:20 ` [PATCH v5 4/4] Normalize deb download dirs when custom DISTRO used Uladzimir Bely
2022-12-04 19:06 ` [PATCH v5 0/4] Fix cross-build from base-apt when custom DISTRO name used Jan Kiszka
2022-12-13 12:37 ` Anton Mikanovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox