public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Uladzimir Bely <ubely@ilbers.de>
To: isar-users@googlegroups.com
Subject: [PATCH v2] dpkg-base: Fix and improve handling of multiple apt sources per package
Date: Sat, 27 Jan 2024 08:56:17 +0100	[thread overview]
Message-ID: <20240127075617.26804-1-ubely@ilbers.de> (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>
Reviewed-by: Uladzimir Bely <ubely@ilbers.de>
---

This goes on top of https://groups.google.com/g/isar-users/c/k8ZNw3OkWLw/m/1s_CPTlPAAAJ
[PATCH v7] dpkg: Restore support for replacing pre-installed packages in sbuild-chroot.

Tested in CI.

We need v2 since previous version conflicts with new changes of "parent" patch v7.

 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 86466b57..a8263046 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -119,10 +119,15 @@ do_apt_fetch() {
 
     schroot -r -c ${session_id} -d / -u root -- \
         rm /etc/apt/sources.list.d/isar-apt.list /etc/apt/preferences.d/isar-apt
-    for uri in "${SRC_APT}"; do
-        schroot -r -c ${session_id} -d / -- \
-            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 -r -c ${session_id} -d / -- \
+        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 -e -c ${session_id}
     schroot_delete_configs
@@ -145,16 +150,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.20.1


             reply	other threads:[~2024-01-27  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-27  7:56 Uladzimir Bely [this message]
2024-01-29 10:49 ` Uladzimir Bely

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=20240127075617.26804-1-ubely@ilbers.de \
    --to=ubely@ilbers.de \
    --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