From 22c90c2ca64d6ecf634870647413379c48bf71a6 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Sat, 19 Oct 2019 08:33:00 +0200 Subject: [PATCH] it's possible that apt is already downloaded at the time where we want to install it --- coverage.sh | 19 ++++++++++++++++++- mmdebstrap | 25 +++++++++++++------------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/coverage.sh b/coverage.sh index a13acfb..a0cccd4 100755 --- a/coverage.sh +++ b/coverage.sh @@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then fi starttime= -total=103 +total=104 i=1 print_header() { @@ -1143,6 +1143,23 @@ else echo "HAVE_QEMU != yes -- Skipping test..." 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 for variant in essential apt required minbase buildd important debootstrap - standard; do diff --git a/mmdebstrap b/mmdebstrap index 9671274..9c61864 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1695,18 +1695,19 @@ sub setup { } close $dh; if (scalar @debs_to_install == 0) { - error "nothing got downloaded"; - } - # we need --force-depends because dpkg does not take Pre-Depends - # into account and thus doesn't install them in the right order - info 'installing ' . (join ', ', keys %pkgs_to_install_from_outside) . "..."; - run_dpkg_progress({ - ARGV => [@chrootcmd, 'env', '--unset=TMPDIR', - 'dpkg', '--install', '--force-depends'], - PKGS => \@debs_to_install, - }); - foreach my $deb (@debs_to_install) { - unlink "$options->{root}/$deb" or error "cannot unlink $deb: $!"; + warning "nothing got downloaded -- maybe the packages were already installed?"; + } else { + # we need --force-depends because dpkg does not take Pre-Depends + # into account and thus doesn't install them in the right order + info 'installing ' . (join ', ', keys %pkgs_to_install_from_outside) . "..."; + run_dpkg_progress({ + ARGV => [@chrootcmd, 'env', '--unset=TMPDIR', + 'dpkg', '--install', '--force-depends'], + PKGS => \@debs_to_install, + }); + foreach my $deb (@debs_to_install) { + unlink "$options->{root}/$deb" or error "cannot unlink $deb: $!"; + } } }