From 9c6b9c95633f7f6b6350a2c77e010e9137e4fb78 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Thu, 7 Jul 2022 12:37:57 +0800 Subject: [PATCH] [Build] Fix the missing debian package for reproducible build issue (#11333) Why I did it Fix the missing debian package for reproducible build issue. The gnupg2 should be added into the version file. https://dev.azure.com/mssonic/build/_build/results?buildId=118139&view=logs&j=88ce9a53-729c-5fa9-7b6e-3d98f2488e3f&t=8d99be27-49d0-54d0-99b1-cfc0d47f0318 The following packages have unmet dependencies: gnupg2 : Depends: gnupg (>= 2.2.27-2+deb11u2) but 2.2.27-2+deb11u1 is to be installed E: Unable to correct problems, you have held broken packages. The issue was caused by the gnupg2 removed, and not detected. sonic-buildimage/build_debian.sh Line 250 in 4fb6cf0 sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y remove software-properties-common gnupg2 python3-gi How I did it Export the debian packages when any debian package being removed. --- src/sonic-build-hooks/hooks/apt-get | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sonic-build-hooks/hooks/apt-get b/src/sonic-build-hooks/hooks/apt-get index bdff703d01..068293a3e3 100755 --- a/src/sonic-build-hooks/hooks/apt-get +++ b/src/sonic-build-hooks/hooks/apt-get @@ -20,7 +20,7 @@ if [ "$INSTALL" == y ]; then [ "$lock_result" == y ] && release_apt_installation_lock exit $command_result else - if [[ "$1" == "purge" || "$@" == *" purge "* ]]; then + if [[ "$1" == "purge" || "$@" == *" purge "* || "$@" == *" remove "* ]]; then # When running the purge command, collect the debian versions dpkg-query -W -f '${Package}==${Version}\n' >> $POST_VERSION_PATH/purge-versions-deb chmod a+wr $POST_VERSION_PATH/purge-versions-deb