[1/1] fix copy out of apt cache after sbuild

Message ID 20240122132647.779902-2-felix.moessbauer@siemens.com
State Accepted, archived
Headers show
Series fix copy out of apt cache after sbuild | expand

Commit Message

MOESSBAUER, Felix Jan. 22, 2024, 1:26 p.m. UTC
During the setup of the sbuild chroot, all packages from the
global apt cache are symlinked into the sbuild chroot. After the build,
the newly downloaded packages should be copied out from the local cache
to the global apt cache. However, the current logic tried to copy out
all packages, including the symlinks. This does not work, as the
symlinks might point to non-existing locations.

This is now fixed by only copying out the newly downloaded debs (the
ones which are not a symlink).

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/classes/dpkg.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index c699a84d..3057329f 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -121,7 +121,7 @@  dpkg_runbuild() {
         --chroot-setup-commands="mkdir -p ${deb_dir}" \
         --chroot-setup-commands="ln -sf ${ext_deb_dir}/*.deb -t ${deb_dir}/" \
         --finished-build-commands="rm -f ${deb_dir}/sbuild-build-depends-main-dummy_*.deb" \
-        --finished-build-commands="[ -z \"\$(find ${deb_dir} -maxdepth 1 -name '*.deb' -print -quit)\" ] || cp ${CP_FLAGS} ${deb_dir}/*.deb -t ${ext_deb_dir}/" \
+        --finished-build-commands="find ${deb_dir} -maxdepth 1 -type f -name '*.deb' -print -exec cp ${CP_FLAGS} -t ${ext_deb_dir}/ {} \;" \
         --finished-build-commands="cp /var/log/dpkg.log ${ext_root}/dpkg_partial.log" \
         --debbuildopts="--source-option=-I" \
         --build-dir=${WORKDIR} --dist="isar" ${DSC_FILE}