summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-08-22 21:33:38 +0200
committerJulian Andres Klode <jak@debian.org>2016-08-24 10:08:12 +0200
commit084562e7a59b356c98254c56679d6c3038b159e8 (patch)
tree9507c62e33498f3e976d576dfc2fafcc8cff4aa9 /apt-pkg
parent43329109786beca8f2eb7a239050059b249651b7 (diff)
do dpkg --configure before --remove/--purge --pending
Commit 7ec343309b7bc6001b465c870609b3c570026149 got us most of the way, but the last mile was botched by having the pending calls in the wrong order as this way we potentially 'force' dpkg to remove/purge a package it doesn't want to as another package still depends on it and the replacement isn't fully installed yet. So what we do now is a configure before remove and purge (all with --no-triggers) and finishing off with another configure pending call to take care of the triggers. Note that in the bugreport example our current planner is forcing dpkg to remove the package earlier via --force-depends which we could do for the pending calls as well and could be used as a workaround, but we want to do less forcing eventually. Closes: 835094 (cherry picked from commit fb51ce3295929947555f4883054f210a53d9fbdf)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 54a8dffd7..c8807b82c 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1539,9 +1539,13 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
if (I.Op == Item::Remove || I.Op == Item::Purge)
toBeRemoved[I.Pkg->ID] = false;
- if (std::find(toBeRemoved.begin(), toBeRemoved.end(), true) != toBeRemoved.end())
+ bool const RemovePending = std::find(toBeRemoved.begin(), toBeRemoved.end(), true) != toBeRemoved.end();
+ bool const PurgePending = approvedStates.Purge().empty() == false;
+ if (RemovePending != false || PurgePending != false)
+ List.emplace_back(Item::ConfigurePending, pkgCache::PkgIterator());
+ if (RemovePending)
List.emplace_back(Item::RemovePending, pkgCache::PkgIterator());
- if (approvedStates.Purge().empty() == false)
+ if (PurgePending)
List.emplace_back(Item::PurgePending, pkgCache::PkgIterator());
// support subpressing of triggers processing for special
@@ -1610,7 +1614,7 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
unsigned long const Op = I->Op;
if (NoTriggers == true && I->Op != Item::TriggersPending &&
- I->Op != Item::ConfigurePending)
+ (I->Op != Item::ConfigurePending || std::next(I) != List.end()))
{
ADDARGC("--no-triggers");
}