diff --git a/examples/hooks/reproducible/1005-reproducible-libxmlb2-appstream.hook.chroot b/examples/hooks/reproducible/1005-reproducible-libxmlb2-appstream.hook.chroot index 9d786de60..257856c06 100755 --- a/examples/hooks/reproducible/1005-reproducible-libxmlb2-appstream.hook.chroot +++ b/examples/hooks/reproducible/1005-reproducible-libxmlb2-appstream.hook.chroot @@ -4,7 +4,7 @@ set -e # libxmlb2 creates random GUIDs # See https://github.com/hughsie/libxmlb/issues/110 # Fixed upstream: https://github.com/hughsie/libxmlb/commit/0652ec042cc0611b9b98e080e64e1025db9b4183 -# Not released in Debian yet +# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1006358 # # Until a sufficiently new version is installed, apply the work-around @@ -21,7 +21,7 @@ then fi # Don't run if the version of libxmlb2 is sufficiently new -if [ $(dpkg --compare-versions $(dpkg-query --show --showformat '${Version}\n' libxmlb2 | head -1) le 0.3.6-2) ]; +if [ $(dpkg --compare-versions $(dpkg-query --show --showformat '${Version}\n' libxmlb2 | head -1) ge 0.3.7~) ]; then exit 0 fi @@ -29,8 +29,17 @@ fi # Refresh the compressed XML files appstreamcli refresh --force > /dev/null +# appstream <= 0.15.1 uses /var/cache/app-info +# appstream >= 0.15.2 uses /var/cache/swcatalog +if [ -d /var/cache/swcatalog ]; +then + CACHE_PATH=/var/cache/swcatalog/cache +else + CACHE_PATH=/var/cache/app-info/cache +fi + # Set the GUID field for each compressed XML file to zero -for f in $(ls /var/cache/app-info/cache/*.xb); +for f in $(ls ${CACHE_PATH}/*.xb); do dd if=$f of=tmp.xb count=8 iflag=count_bytes status=none dd if=/dev/zero of=tmp.xb count=16 iflag=count_bytes status=none oflag=append conv=notrunc @@ -46,7 +55,7 @@ done cat << EOF > /etc/apt/apt.conf.d/51appstream_reset_guid # Reset the GUID of the AppStream cache files when APT's cache is updated (i.e. apt update) APT::Update::Post-Invoke-Success { - "if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then for f in \$(ls /var/cache/app-info/cache/*.xb); do dd if=\$f of=tmp.xb count=8 iflag=count_bytes status=none; dd if=/dev/zero of=tmp.xb count=16 iflag=count_bytes status=none oflag=append conv=notrunc; dd if=\$f of=tmp.xb skip=24 iflag=skip_bytes status=none oflag=append conv=notrunc; rm \$f; mv tmp.xb \$f; done; fi"; + "if /usr/bin/test -w ${CACHE_PATH} -a -e /usr/bin/appstreamcli; then for f in \$(ls ${CACHE_PATH}/*.xb); do dd if=\$f of=tmp.xb count=8 iflag=count_bytes status=none; dd if=/dev/zero of=tmp.xb count=16 iflag=count_bytes status=none oflag=append conv=notrunc; dd if=\$f of=tmp.xb skip=24 iflag=skip_bytes status=none oflag=append conv=notrunc; rm \$f; mv tmp.xb \$f; done; fi"; }; EOF