public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH] dpkg-base: Fix and improve handling of multiple apt sources per package
Date: Thu, 18 Jan 2024 18:35:04 +0100	[thread overview]
Message-ID: <56cd7e53-f36b-4f9b-8c0f-703c45102ca0@siemens.com> (raw)

From: Jan Kiszka <jan.kiszka@siemens.com>

Due to overeager quoting, multiple entries in SRC_APT would have led to
build errors, rather than mulitple invocations of the fetching and
unpacking steps.

While fixing that, also avoid pointless re-entries into the schroot by
simply pulling the loop into it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

This goes on top of https://groups.google.com/g/isar-users/c/k8ZNw3OkWLw/m/mnzo45T0BQAJ
(v6 of "dpkg: Restore support for replacing pre-installed packages in sbuild-chroot")

Not urgent - this bug is by now more than 4 years old.

 meta/classes/dpkg-base.bbclass | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 80686677..80e31d80 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -115,10 +115,15 @@ do_apt_fetch() {
 
     schroot -d / -u root -c ${SBUILD_CHROOT} -- \
         rm /etc/apt/sources.list.d/isar-apt.list /etc/apt/preferences.d/isar-apt
-    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 "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}" "${uri}"
-    done
+    schroot -d / -c ${SBUILD_CHROOT} -- \
+        sh -c '
+            set -e
+            for uri in $2; do
+                mkdir -p /downloads/deb-src/"$1"/${uri}
+                cd /downloads/deb-src/"$1"/${uri}
+                apt-get -y --download-only --only-source source ${uri}
+            done' \
+                my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}" "${SRC_APT}"
     schroot_delete_configs
 }
 
@@ -139,16 +144,16 @@ do_apt_unpack() {
     trap 'exit 1' INT HUP QUIT TERM ALRM USR1
     trap 'schroot_cleanup' EXIT
 
-    for uri in "${SRC_APT}"; do
-        schroot -d / -c ${SBUILD_CHROOT} -- \
-            sh -c ' \
-                set -e
-                dscfile="$(apt-get -y -qq --print-uris --only-source source "${2}" | cut -d " " -f2 | grep -E "*.dsc")"
+    schroot -d / -c ${SBUILD_CHROOT} -- \
+        sh -c '
+            set -e
+            for uri in $2; do
+                dscfile="$(apt-get -y -qq --print-uris --only-source source $uri | cut -d " " -f2 | grep -E "*.dsc")"
                 cd ${PP}
-                cp /downloads/deb-src/"${1}"/"${2}"/* ${PP}
-                dpkg-source -x "${dscfile}" "${PPS}"' \
-                    my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}" "${uri}"
-    done
+                cp /downloads/deb-src/"${1}"/${uri}/* ${PP}
+                dpkg-source -x "${dscfile}" "${PPS}"
+            done' \
+                my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}" "${SRC_APT}"
     schroot_delete_configs
 }
 do_apt_unpack[network] = "${TASK_USE_SUDO}"
-- 
2.35.3

                 reply	other threads:[~2024-01-18 17:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=56cd7e53-f36b-4f9b-8c0f-703c45102ca0@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