dpkg-base: Ignore isar-apt also during apt_unpack

Message ID 6f23d1ba-b2b1-4268-b06d-3847baebd8aa@siemens.com
State Accepted, archived
Headers show
Series dpkg-base: Ignore isar-apt also during apt_unpack | expand

Commit Message

Jan Kiszka Nov. 7, 2024, 7:28 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

Just like apt_fetch, apt_unpack needs to mask out isar-apt so that, when
retrieving the upstream dsc file, it will not stumble over some already
pushed sources in isar-apt for the current package.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 meta/classes/dpkg-base.bbclass | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Uladzimir Bely Nov. 13, 2024, 2:17 p.m. UTC | #1
On Thu, 2024-11-07 at 08:28 +0100, 'Jan Kiszka' via isar-users wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> Just like apt_fetch, apt_unpack needs to mask out isar-apt so that,
> when
> retrieving the upstream dsc file, it will not stumble over some
> already
> pushed sources in isar-apt for the current package.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  meta/classes/dpkg-base.bbclass | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-
> base.bbclass
> index e97e4d72..b4ea8e17 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -146,13 +146,19 @@ do_apt_unpack() {
>      rm -rf ${S}
>      schroot_create_configs
>  
> +    session_id=$(schroot -q -b -c ${SBUILD_CHROOT})
> +    echo "Started session: ${session_id}"
> +
>      schroot_cleanup() {
> +        schroot -q -f -e -c ${session_id} > /dev/null 2>&1
>          schroot_delete_configs
>      }
>      trap 'exit 1' INT HUP QUIT TERM ALRM USR1
>      trap 'schroot_cleanup' EXIT
>  
> -    schroot -d / -c ${SBUILD_CHROOT} -- \
> +    schroot -r -c ${session_id} -d / -u root -- \
> +        rm /etc/apt/sources.list.d/isar-apt.list
> /etc/apt/preferences.d/isar-apt
> +    schroot -r -c ${session_id} -d / -- \
>          sh -c '
>              set -e
>              for uri in $2; do
> @@ -162,6 +168,8 @@ do_apt_unpack() {
>                  dpkg-source -x "${dscfile}" "${PPS}"
>              done' \
>                  my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}"
> "${SRC_APT}"
> +
> +    schroot -e -c ${session_id}
>      schroot_delete_configs
>  }
>  do_apt_unpack[network] = "${TASK_USE_SUDO}"
> -- 
> 2.43.0
> 

Applied to next, thanks.

Patch

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index e97e4d72..b4ea8e17 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -146,13 +146,19 @@  do_apt_unpack() {
     rm -rf ${S}
     schroot_create_configs
 
+    session_id=$(schroot -q -b -c ${SBUILD_CHROOT})
+    echo "Started session: ${session_id}"
+
     schroot_cleanup() {
+        schroot -q -f -e -c ${session_id} > /dev/null 2>&1
         schroot_delete_configs
     }
     trap 'exit 1' INT HUP QUIT TERM ALRM USR1
     trap 'schroot_cleanup' EXIT
 
-    schroot -d / -c ${SBUILD_CHROOT} -- \
+    schroot -r -c ${session_id} -d / -u root -- \
+        rm /etc/apt/sources.list.d/isar-apt.list /etc/apt/preferences.d/isar-apt
+    schroot -r -c ${session_id} -d / -- \
         sh -c '
             set -e
             for uri in $2; do
@@ -162,6 +168,8 @@  do_apt_unpack() {
                 dpkg-source -x "${dscfile}" "${PPS}"
             done' \
                 my_script "${BASE_DISTRO}-${BASE_DISTRO_CODENAME}" "${SRC_APT}"
+
+    schroot -e -c ${session_id}
     schroot_delete_configs
 }
 do_apt_unpack[network] = "${TASK_USE_SUDO}"