it's possible that apt is already downloaded at the time where we want to install it

This commit is contained in:
Johannes 'josch' Schauer 2019-10-19 08:33:00 +02:00
parent 78358eaf9a
commit 22c90c2ca6
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1
2 changed files with 31 additions and 13 deletions

View file

@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then
fi fi
starttime= starttime=
total=103 total=104
i=1 i=1
print_header() { print_header() {
@ -1143,6 +1143,23 @@ else
echo "HAVE_QEMU != yes -- Skipping test..." echo "HAVE_QEMU != yes -- Skipping test..."
fi fi
print_header "mode=$defaultmode,variant=essential: test not having to installing apt with --include"
cat << END > shared/test.sh
#!/bin/sh
set -eu
export LC_ALL=C.UTF-8
$CMD --mode=$defaultmode --variant=essential --include=apt --setup-hook="apt-get update" --setup-hook="apt-get --yes -oApt::Get::Download-Only=true install apt" $DEFAULT_DIST /tmp/debian-chroot.tar $mirror
tar -tf /tmp/debian-chroot.tar | sort | diff -u tar1.txt -
rm /tmp/debian-chroot.tar
END
if [ "$HAVE_QEMU" = "yes" ]; then
./run_qemu.sh
elif [ "$defaultmode" = "root" ]; then
./run_null.sh SUDO
else
./run_null.sh
fi
# test all variants # test all variants
for variant in essential apt required minbase buildd important debootstrap - standard; do for variant in essential apt required minbase buildd important debootstrap - standard; do

View file

@ -1695,18 +1695,19 @@ sub setup {
} }
close $dh; close $dh;
if (scalar @debs_to_install == 0) { if (scalar @debs_to_install == 0) {
error "nothing got downloaded"; warning "nothing got downloaded -- maybe the packages were already installed?";
} } else {
# we need --force-depends because dpkg does not take Pre-Depends # we need --force-depends because dpkg does not take Pre-Depends
# into account and thus doesn't install them in the right order # into account and thus doesn't install them in the right order
info 'installing ' . (join ', ', keys %pkgs_to_install_from_outside) . "..."; info 'installing ' . (join ', ', keys %pkgs_to_install_from_outside) . "...";
run_dpkg_progress({ run_dpkg_progress({
ARGV => [@chrootcmd, 'env', '--unset=TMPDIR', ARGV => [@chrootcmd, 'env', '--unset=TMPDIR',
'dpkg', '--install', '--force-depends'], 'dpkg', '--install', '--force-depends'],
PKGS => \@debs_to_install, PKGS => \@debs_to_install,
}); });
foreach my $deb (@debs_to_install) { foreach my $deb (@debs_to_install) {
unlink "$options->{root}/$deb" or error "cannot unlink $deb: $!"; unlink "$options->{root}/$deb" or error "cannot unlink $deb: $!";
}
} }
} }