summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2021-02-23 18:23:30 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2021-02-23 19:10:29 +0100
commitf8ff3afcd42d8b2e6506bc6f44a894149bf87442 (patch)
tree37847887af449a251f9469192d53da424b2f23ce /apt-pkg
parentdb391379e175aa742e390aab24dcf224a8a97e88 (diff)
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
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc3
-rw-r--r--apt-pkg/packagemanager.cc6
2 files changed, 5 insertions, 4 deletions
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;
}