From 12ec2c50aa69014239d2db03b0debdde520c57d4 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Wed, 22 Sep 2021 15:22:15 +0200 Subject: [PATCH] also create cmethopt and available in chrootless mode - this allows bit-by-bit identical output of chrootless mode compared to other modes --- coverage.sh | 26 +------------------------- mmdebstrap | 10 ++++++---- 2 files changed, 7 insertions(+), 29 deletions(-) diff --git a/coverage.sh b/coverage.sh index e3c2983..5bbdc60 100755 --- a/coverage.sh +++ b/coverage.sh @@ -240,7 +240,7 @@ rm /tmp/debian-$dist-debootstrap/var/lib/dpkg/status-old \ /tmp/debian-$dist-mm/var/lib/dpkg/status-old # remove dpkg files rm /tmp/debian-$dist-debootstrap/var/lib/dpkg/available -touch /tmp/debian-$dist-debootstrap/var/lib/dpkg/available +rm /tmp/debian-$dist-debootstrap/var/lib/dpkg/cmethopt # since we installed packages directly from the .deb files, Priorities differ # thus we first check for equality and then remove the files chroot /tmp/debian-$dist-debootstrap dpkg --list > dpkg1 @@ -2763,8 +2763,6 @@ rm /tmp/debian-chroot/etc/fstab rm /tmp/debian-chroot/etc/hostname rm /tmp/debian-chroot/etc/resolv.conf rm /tmp/debian-chroot/var/lib/apt/lists/lock -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt rm /tmp/debian-chroot/var/lib/dpkg/status # the rest should be empty directories that we can rmdir recursively find /tmp/debian-chroot -depth -print0 | xargs -0 rmdir @@ -2793,8 +2791,6 @@ rm /tmp/debian-chroot/etc/fstab rm /tmp/debian-chroot/etc/hostname rm /tmp/debian-chroot/etc/resolv.conf rm /tmp/debian-chroot/var/lib/apt/lists/lock -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt rm /tmp/debian-chroot/var/lib/dpkg/status # the rest should be empty directories that we can rmdir recursively find /tmp/debian-chroot -depth -print0 | xargs -0 rmdir @@ -2824,8 +2820,6 @@ rm /tmp/debian-chroot/etc/fstab rm /tmp/debian-chroot/etc/hostname rm /tmp/debian-chroot/etc/resolv.conf rm /tmp/debian-chroot/var/lib/apt/lists/lock -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt rm /tmp/debian-chroot/var/lib/dpkg/status # the rest should be empty directories that we can rmdir recursively find /tmp/debian-chroot -depth -print0 | xargs -0 rmdir @@ -2971,8 +2965,6 @@ rm /tmp/debian-chroot/etc/fstab rm /tmp/debian-chroot/etc/hostname rm /tmp/debian-chroot/etc/resolv.conf rm /tmp/debian-chroot/var/lib/apt/lists/lock -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt rm /tmp/debian-chroot/var/lib/dpkg/status # the rest should be empty directories that we can rmdir recursively find /tmp/debian-chroot -depth -print0 | xargs -0 rmdir @@ -3216,10 +3208,6 @@ rm /tmp/debian-chroot/var/lib/dpkg/status rm /tmp/debian-chroot/var/cache/apt/archives/lock rm /tmp/debian-chroot/var/lib/dpkg/lock rm /tmp/debian-chroot/var/lib/dpkg/lock-frontend -if [ "$mode" != "chrootless" ] || dpkg --compare-versions "\$(dpkg --robot --version)" lt 1.20.0; then -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt -fi rm /tmp/debian-chroot/var/lib/apt/lists/lock ## delete merged usr symlinks #rm /tmp/debian-chroot/libx32 @@ -3285,10 +3273,6 @@ rm /tmp/debian-chroot/var/cache/apt/archives/lock rm /tmp/debian-chroot/var/lib/dpkg/lock rm /tmp/debian-chroot/var/lib/dpkg/lock-frontend rm /tmp/debian-chroot/var/lib/apt/lists/lock -if [ "$mode" != "chrootless" ] || dpkg --compare-versions "\$(dpkg --robot --version)" lt 1.20.0; then -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt -fi ## delete merged usr symlinks #rm /tmp/debian-chroot/libx32 #rm /tmp/debian-chroot/lib64 @@ -3435,10 +3419,6 @@ rm /tmp/debian-chroot/var/cache/apt/archives/lock rm /tmp/debian-chroot/var/lib/dpkg/lock rm /tmp/debian-chroot/var/lib/dpkg/lock-frontend rm /tmp/debian-chroot/var/lib/apt/lists/lock -if dpkg --compare-versions "\$(dpkg --robot --version)" lt 1.20.0; then -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt -fi ## delete merged usr symlinks #rm /tmp/debian-chroot/libx32 #rm /tmp/debian-chroot/lib64 @@ -3497,10 +3477,6 @@ rm /tmp/debian-chroot/var/cache/apt/archives/lock rm /tmp/debian-chroot/var/lib/dpkg/lock rm /tmp/debian-chroot/var/lib/dpkg/lock-frontend rm /tmp/debian-chroot/var/lib/apt/lists/lock -if dpkg --compare-versions "\$(dpkg --robot --version)" lt 1.20.0; then -rm /tmp/debian-chroot/var/lib/dpkg/available -rm /tmp/debian-chroot/var/lib/dpkg/cmethopt -fi ## delete merged usr symlinks #rm /tmp/debian-chroot/libx32 #rm /tmp/debian-chroot/lib64 diff --git a/mmdebstrap b/mmdebstrap index 95c9685..117f6c4 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1732,8 +1732,9 @@ sub run_setup() { # removals will fail # since we do not know the dpkg version inside the chroot at this point, we # can only omit it in chrootless mode - if ( $options->{mode} ne 'chrootless' - or $dpkgversion < "1.20.0") { + # since we want to produce equivalent output independent on the mode, we + # only check for the dpkg version + if ($dpkgversion < "1.20.0") { open my $fh, '>', "$options->{root}/var/lib/dpkg/available" or error "failed to open(): $!"; close $fh; @@ -1743,8 +1744,9 @@ sub run_setup() { # see #930788 # since we do not know the dpkg version inside the chroot at this point, we # can only omit it in chrootless mode - if ( $options->{mode} ne 'chrootless' - or $dpkgversion < "1.20.0") { + # since we want to produce equivalent output independent on the mode, we + # only check for the dpkg version + if ($dpkgversion < "1.20.0") { open my $fh, '>', "$options->{root}/var/lib/dpkg/cmethopt" or error "failed to open(): $!"; print $fh "apt apt\n";