]> git.saurik.com Git - apt.git/commitdiff
don't explicitly configure the last round of packages
authorDavid Kalnischkies <david@kalnischkies.de>
Wed, 8 Jun 2016 15:31:45 +0000 (17:31 +0200)
committerDavid Kalnischkies <david@kalnischkies.de>
Wed, 8 Jun 2016 15:31:45 +0000 (17:31 +0200)
We end our operation by calling "dpkg --configure -a", so instead of
running a (big) configure run with all packages mentioned explicitly
before this, we simply skip them and let them be handled by this call
implicitly.

There isn't really an observeable gain to be had here from a speed
point, but it helps in avoiding an (uncommon) problem of having a too
long commandline passed to dpkg, which we would split up (probably
incorrectly).

apt-pkg/deb/dpkgpm.cc
test/integration/test-apt-progress-fd
test/integration/test-apt-progress-fd-deb822
test/integration/test-dpkg-assert-multi-arch
test/integration/test-no-fds-leaked-to-maintainer-scripts

index 4a77942f169c711040e50c1fbf59ec0bc894798b..4591049a906d0526f35d77500ef9d6b92a15e36d 100644 (file)
@@ -1248,15 +1248,28 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
    if (RunScriptsWithPkgs("DPkg::Pre-Install-Pkgs") == false)
       return false;
 
+   decltype(List)::const_iterator::difference_type const notconfidx =
+      _config->FindB("Dpkg::ExplicitLastConfigure", false) ? std::numeric_limits<decltype(notconfidx)>::max() :
+      std::distance(List.cbegin(), std::find_if_not(List.crbegin(), List.crend(), [](Item const &i) { return i.Op == Item::Configure; }).base());
+
    // support subpressing of triggers processing for special
    // cases like d-i that runs the triggers handling manually
    bool const TriggersPending = _config->FindB("DPkg::TriggersPending", false);
-   if (_config->FindB("DPkg::ConfigurePending", true) == true)
+   bool const ConfigurePending = _config->FindB("DPkg::ConfigurePending", true);
+   if (ConfigurePending)
       List.push_back(Item(Item::ConfigurePending, PkgIterator()));
 
    // for the progress
    BuildPackagesProgressMap();
 
+   if (notconfidx != std::numeric_limits<decltype(notconfidx)>::max())
+   {
+      if (ConfigurePending)
+        List.erase(std::next(List.cbegin(), notconfidx), std::prev(List.cend()));
+      else
+        List.erase(std::next(List.cbegin(), notconfidx), List.cend());
+   }
+
    d->stdin_is_dev_null = false;
 
    // create log
index 86eaa1354134763488da25024fc5808a25b98863..57728ca81ca7ce9056808f4a529de2fa603eb6da 100755 (executable)
@@ -25,8 +25,7 @@ pmstatus:testing:50.0000:Preparing to configure testing (amd64)
 pmstatus:dpkg-exec:50.0000:Running dpkg
 pmstatus:testing:50.0000:Configuring testing (amd64)
 pmstatus:testing:66.6667:Configuring testing (amd64)
-pmstatus:testing:83.3333:Installed testing (amd64)
-pmstatus:dpkg-exec:83.3333:Running dpkg'
+pmstatus:testing:83.3333:Installed testing (amd64)'
 
 # upgrade
 exec 3> apt-progress.log
@@ -41,8 +40,7 @@ pmstatus:testing:50.0000:Preparing to configure testing (amd64)
 pmstatus:dpkg-exec:50.0000:Running dpkg
 pmstatus:testing:50.0000:Configuring testing (amd64)
 pmstatus:testing:66.6667:Configuring testing (amd64)
-pmstatus:testing:83.3333:Installed testing (amd64)
-pmstatus:dpkg-exec:83.3333:Running dpkg'
+pmstatus:testing:83.3333:Installed testing (amd64)'
 
 # reinstall
 exec 3> apt-progress.log
@@ -57,8 +55,7 @@ pmstatus:testing:50.0000:Preparing to configure testing (amd64)
 pmstatus:dpkg-exec:50.0000:Running dpkg
 pmstatus:testing:50.0000:Configuring testing (amd64)
 pmstatus:testing:66.6667:Configuring testing (amd64)
-pmstatus:testing:83.3333:Installed testing (amd64)
-pmstatus:dpkg-exec:83.3333:Running dpkg'
+pmstatus:testing:83.3333:Installed testing (amd64)'
 
 # and remove
 exec 3> apt-progress.log
@@ -83,7 +80,6 @@ pmstatus:testing2:50.0000:Preparing to configure testing2 (i386)
 pmstatus:dpkg-exec:50.0000:Running dpkg
 pmstatus:testing2:50.0000:Configuring testing2 (i386)
 pmstatus:testing2:66.6667:Configuring testing2 (i386)
-pmstatus:testing2:83.3333:Installed testing2 (i386)
-pmstatus:dpkg-exec:83.3333:Running dpkg'
+pmstatus:testing2:83.3333:Installed testing2 (i386)'
 
 rm -f apt-progress*.log
index a8d59608d5aced3c3049ad4e16f583210c65e3bc..d9a4505d1089eb22b1726df365cc9e8681aaf7e5 100755 (executable)
@@ -58,10 +58,6 @@ Status: progress
 Package: testing:amd64
 Percent: 83.3333
 Message: Installed testing (amd64)
-
-Status: progress
-Percent: 83.3333
-Message: Running dpkg
 '
 
 rm -f apt-progress*.log
index f73c78935fb433336d83da60611f54edb50e5f49..14b29ec87d5ff99f6f93be9c2332a4f3f22a4e1e 100755 (executable)
@@ -16,12 +16,15 @@ setupaptarchive
 
 testqualifier() {
        msgtest 'Test with' $1 'for correct qualifier mode' $2
-       GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -v -- '--unpack' | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')"
+       #aptget install $1 -qq -o Debug::pkgDPkgPM=1 || true
+       aptget install $1 -qq -o Debug::pkgDPkgPM=1 -o Dpkg::ExplicitLastConfigure=1 > testqualifier.output 2>&1 || true
+       GIVEN="$(grep -v -- '--unpack' testqualifier.output | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')"
        if [ "$GIVEN" = "$2" ]; then
                msgpass
        else
-               echo
-               echo "$GIVEN"
+               cat >&2 testqualifier.output
+               echo >&2
+               echo >&2 "$GIVEN"
                msgfail
        fi
 }
index d86e638cdecfdc0fba2023349d6e4ba808aeaa93..56cbff0957d5b0a214b040789affaabb10aae52e 100755 (executable)
@@ -59,8 +59,7 @@ startup packages configure
 configure $PKGNAME 1.0 <none>
 status unpacked $PKGNAME 1.0
 status half-configured $PKGNAME 1.0
-status installed $PKGNAME 1.0
-startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log
+status installed $PKGNAME 1.0" cut -f 3- -d' ' rootdir/var/log/dpkg.log
 }
 checkinstall