From 0caa5a4c6472d1b74444c4f38ced6c3b89fa50fe Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 8 Mar 2014 17:29:46 +0100 Subject: do not configure already unpacked packages needlessly The unpack of a M-A:same package will force the unpack of all its siblings directly to prevent that they could be separated by later immediate actions. In commit 634985f8 a call to SmartConfigure was introduced to configure these packages at the time the installation order encounters them. Usually, the unpack order is already okay, so that this 'earlier' unpack was not needed and if it wouldn't have been done, the package would now only be unpacked, but by configuring the package now we impose new requirements which must be satisfied. The code is clever enough to handle this most of the time (it worked for 2 years!), but it isn't needed and in very coupled cases this can fail. Removing this call again removes this extra burden and so simplifies the ordering as can be seen in the modified tests. Famous last words, but I don't see a reason for this extra burden to exist hence the remove. Closes: 740843 --- apt-pkg/packagemanager.cc | 17 +++---- test/integration/framework | 14 ++++-- .../test-bug-740843-versioned-up-down-breaks | 55 ++++++++++++++++++++++ test/integration/test-bug-multiarch-upgrade | 4 +- .../test-ignore-provides-if-versioned-breaks | 4 +- .../test-ignore-provides-if-versioned-conflicts | 4 +- ...prevent-markinstall-multiarch-same-versionscrew | 8 ++-- ...ight-loop-configure-with-unpacking-new-packages | 4 +- 8 files changed, 82 insertions(+), 28 deletions(-) create mode 100755 test/integration/test-bug-740843-versioned-up-down-breaks diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 4d08fb3ba..5d6bc6bd2 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -622,6 +622,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c clog << " (replace version " << Pkg.CurrentVer().VerStr() << " with " << InstallVer.VerStr() << ")"; if (PkgLoop) clog << " (Only Perform PreUnpack Checks)"; + if (Immediate) + clog << " immediately"; clog << endl; } @@ -963,21 +965,14 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() for (pkgOrderList::iterator I = List->begin(); I != List->end(); ++I) { PkgIterator Pkg(Cache,*I); - + if (List->IsNow(Pkg) == false) { - if (!List->IsFlag(Pkg,pkgOrderList::Configured) && !NoImmConfigure) { - if (SmartConfigure(Pkg, 0) == false && Debug) - _error->Warning("Internal Error, Could not configure %s",Pkg.FullName().c_str()); - // FIXME: The above warning message might need changing - } else { - if (Debug == true) - clog << "Skipping already done " << Pkg.FullName() << endl; - } + if (Debug == true) + clog << "Skipping already done " << Pkg.FullName() << endl; continue; - } - + if (List->IsMissing(Pkg) == true) { if (Debug == true) diff --git a/test/integration/framework b/test/integration/framework index 83deafe88..d66171783 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1010,11 +1010,15 @@ testequalor2() { shift 2 msgtest "Test for equality OR of" "$*" $* >$COMPAREAGAINST 2>&1 || true - (checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null || - checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass || - ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \ - "\n${CINFO}Diff against OR 2${CNORMAL}" "$(checkdiff $COMPAREFILE2 $COMPAREAGAINST)" && - msgfail ) + if checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null || checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null; then + msgpass + else + echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" + checkdiff $COMPAREFILE1 $COMPAREAGAINST || true + echo -n "${CINFO}Diff against OR 2${CNORMAL}" + checkdiff $COMPAREFILE2 $COMPAREAGAINST || true + msgfail + fi } testshowvirtual() { diff --git a/test/integration/test-bug-740843-versioned-up-down-breaks b/test/integration/test-bug-740843-versioned-up-down-breaks new file mode 100755 index 000000000..cb035a71f --- /dev/null +++ b/test/integration/test-bug-740843-versioned-up-down-breaks @@ -0,0 +1,55 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'foo-driver' 'amd64' '1' 'Depends: libfoo (= 1) +Recommends: libgl1-foo-glx (= 1) +Breaks: libgl1-foo-glx (<< 1), libgl1-foo-glx (>> 1)' +insertinstalledpackage 'libgl1-foo-glx' 'amd64,i386' '1' 'Depends: libfoo (= 1) +Multi-Arch: same' +insertinstalledpackage 'libfoo' 'amd64,i386' '1' 'Multi-Arch: same' + +buildsimplenativepackage 'foo-driver' 'amd64' '2' 'stable' 'Depends: libfoo (= 2) +Recommends: libgl1-foo-glx (= 2) +Breaks: libgl1-foo-glx (<< 2), libgl1-foo-glx (>> 2)' +buildsimplenativepackage 'libgl1-foo-glx' 'amd64,i386' '2' 'stable' 'Depends: libfoo (= 2) +Multi-Arch: same' +buildsimplenativepackage 'libfoo' 'amd64,i386' '2' 'stable' 'Multi-Arch: same' + +setupaptarchive + +testequalor2 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 +5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst libgl1-foo-glx [1] (2 stable [amd64]) [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:i386 foo-driver:amd64 ] +Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ] +Inst foo-driver [1] (2 stable [amd64]) [] +Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ] +Inst libfoo [1] (2 stable [amd64]) +Conf libfoo:i386 (2 stable [i386]) +Conf libfoo (2 stable [amd64]) +Conf libgl1-foo-glx:i386 (2 stable [i386]) +Conf libgl1-foo-glx (2 stable [amd64]) +Conf foo-driver (2 stable [amd64])' 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 +5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst libgl1-foo-glx [1] (2 stable [amd64]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 libgl1-foo-glx:i386 ] +Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ] +Inst foo-driver [1] (2 stable [amd64]) [] +Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ] +Inst libfoo [1] (2 stable [amd64]) +Conf libfoo:i386 (2 stable [i386]) +Conf libfoo (2 stable [amd64]) +Conf libgl1-foo-glx:i386 (2 stable [i386]) +Conf libgl1-foo-glx (2 stable [amd64]) +Conf foo-driver (2 stable [amd64])' aptget dist-upgrade -s + +testsuccess aptget dist-upgrade -y -o Debug::pkgPackageManager=1 -o Debug::pkgOrderList=1 diff --git a/test/integration/test-bug-multiarch-upgrade b/test/integration/test-bug-multiarch-upgrade index dc3725df1..c29e1f903 100755 --- a/test/integration/test-bug-multiarch-upgrade +++ b/test/integration/test-bug-multiarch-upgrade @@ -25,5 +25,5 @@ The following packages will be upgraded: 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Inst libcups2 [1] (2 unstable [amd64]) [libcups2:amd64 on libcups2:i386] [libcups2:i386 on libcups2:amd64] [libcups2:i386 ] Inst libcups2:i386 [1] (2 unstable [i386]) -Conf libcups2 (2 unstable [amd64]) -Conf libcups2:i386 (2 unstable [i386])' aptget install -s libcups2:i386 +Conf libcups2:i386 (2 unstable [i386]) +Conf libcups2 (2 unstable [amd64])' aptget install -s libcups2:i386 diff --git a/test/integration/test-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks index f8b4544a0..745f7d206 100755 --- a/test/integration/test-ignore-provides-if-versioned-breaks +++ b/test/integration/test-ignore-provides-if-versioned-breaks @@ -142,9 +142,9 @@ The following packages will be upgraded: 2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] Inst foo-same [2.0] (4.0 unstable [i386]) -Conf foo-same:amd64 (4.0 unstable [amd64]) -Conf foo-same (4.0 unstable [i386]) Inst foo-same-breaker-3 (1.0 unstable [i386]) Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) Conf foo-same-breaker-3 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-ignore-provides-if-versioned-conflicts b/test/integration/test-ignore-provides-if-versioned-conflicts index 44eafcff1..a07252768 100755 --- a/test/integration/test-ignore-provides-if-versioned-conflicts +++ b/test/integration/test-ignore-provides-if-versioned-conflicts @@ -142,9 +142,9 @@ The following packages will be upgraded: 2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] Inst foo-same [2.0] (4.0 unstable [i386]) -Conf foo-same:amd64 (4.0 unstable [amd64]) -Conf foo-same (4.0 unstable [i386]) Inst foo-same-breaker-3 (1.0 unstable [i386]) Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) Conf foo-same-breaker-3 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index fed12dad0..d647856cb 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -55,14 +55,14 @@ Remv out-of-sync-gone-foreign:i386 [1] Remv out-of-sync-gone-native [1] Inst fine [1] (2 unstable [amd64]) [fine:amd64 on fine:i386] [fine:i386 on fine:amd64] [fine:i386 ] Inst fine:i386 [1] (2 unstable [i386]) -Conf fine (2 unstable [amd64]) -Conf fine:i386 (2 unstable [i386]) Inst fine-installed [1] (2 unstable [amd64]) [fine-installed:amd64 on fine-installed:i386] [fine-installed:i386 on fine-installed:amd64] [fine-installed:i386 ] Inst fine-installed:i386 [1] (2 unstable [i386]) -Conf fine-installed (2 unstable [amd64]) -Conf fine-installed:i386 (2 unstable [i386]) Inst out-of-sync-gone-foreign [1] (2 unstable [amd64]) Inst out-of-sync-gone-native:i386 [1] (2 unstable [i386]) +Conf fine:i386 (2 unstable [i386]) +Conf fine (2 unstable [amd64]) +Conf fine-installed:i386 (2 unstable [i386]) +Conf fine-installed (2 unstable [amd64]) Conf out-of-sync-gone-foreign (2 unstable [amd64]) Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1 diff --git a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages index 5856cd744..c1d454f88 100755 --- a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages +++ b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages @@ -39,9 +39,9 @@ Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-core:amd64 on libreoffice Inst libreoffice-common [3] (4 sid [all]) [] Inst ure (4 sid [amd64]) Conf ure (4 sid [amd64]) -Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice-common (4 sid [all]) Conf libreoffice-core (4 sid [amd64]) +Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice (4 sid [amd64])' 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -55,7 +55,7 @@ Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-common:amd64 on libreoffi Inst libreoffice-common [3] (4 sid [all]) [] Inst ure (4 sid [amd64]) Conf ure (4 sid [amd64]) -Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice-common (4 sid [all]) Conf libreoffice-core (4 sid [amd64]) +Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice (4 sid [amd64])' aptget dist-upgrade -s -- cgit v1.2.3