From f8ff3afcd42d8b2e6506bc6f44a894149bf87442 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Feb 2021 18:23:30 +0100 Subject: Do not require force-loopbreak on Protected packages dpkg will be changed in 1.20.8 to not require --force-remove for deconfiguration anymore, but we want to decouple our changes from the dpkg ones, so let's always pass --force-remove-protected when installing packages such that we can deconfigure protected packages. Closes: #983014 --- apt-pkg/deb/dpkgpm.cc | 3 +++ apt-pkg/packagemanager.cc | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index c496538cc..a8f99a855 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1824,6 +1824,9 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) case Item::Install: ADDARGC("--unpack"); ADDARGC("--auto-deconfigure"); + // dpkg < 1.20.8 needs --force-remove-protected to deconfigure protected packages + if (dpkgProtectedField) + ADDARGC("--force-remove-protected"); break; } diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 0c6998def..ad7612bc3 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -652,8 +652,7 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg, DepIterator const * const D // Essential packages get special treatment bool IsEssential = false; - if ((Pkg->Flags & pkgCache::Flag::Essential) != 0 || - (Pkg->Flags & pkgCache::Flag::Important) != 0) + if ((Pkg->Flags & pkgCache::Flag::Essential) != 0) IsEssential = true; /* Check for packages that are the dependents of essential packages and @@ -663,8 +662,7 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg, DepIterator const * const D for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false && IsEssential == false; ++D) if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) - if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0 || - (D.ParentPkg()->Flags & pkgCache::Flag::Important) != 0) + if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0) IsEssential = true; } -- cgit v1.2.3-70-g09d2