summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/configuration.cc1
-rw-r--r--apt-pkg/contrib/fileutl.cc4
-rw-r--r--apt-pkg/deb/dpkgpm.cc3
-rw-r--r--apt-pkg/packagemanager.cc25
4 files changed, 24 insertions, 9 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index a8fced724..03bdb12a8 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -31,6 +31,7 @@
#include <string.h>
#include <algorithm>
+#include <array>
#include <fstream>
#include <iterator>
#include <numeric>
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 091def3d4..eb5dc859d 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -140,10 +140,6 @@ bool RunScripts(const char *Cnf)
return _error->Errno("waitpid","Couldn't wait for subprocess");
}
- // Restore sig int/quit
- signal(SIGQUIT,SIG_DFL);
- signal(SIGINT,SIG_DFL);
-
// Check for an error code.
if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0)
{
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..1a2850a2a 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -652,9 +652,11 @@ 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;
+ bool IsProtected = false;
+ if ((Pkg->Flags & pkgCache::Flag::Important) != 0)
+ IsProtected = true;
/* Check for packages that are the dependents of essential packages and
promote them too */
@@ -662,14 +664,17 @@ 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->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) {
+ if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0)
IsEssential = true;
+ if ((D.ParentPkg()->Flags & pkgCache::Flag::Important) != 0)
+ IsProtected = true;
+ }
}
if (IsEssential == true)
{
+ // FIXME: Unify messaging with Protected below.
if (_config->FindB("APT::Force-LoopBreak",false) == false)
return _error->Error(_("This installation run will require temporarily "
"removing the essential package %s due to a "
@@ -680,6 +685,16 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg, DepIterator const * const D
// dpkg will auto-deconfigure it, no need for the big remove hammer
else if (Dep != NULL && (*Dep)->Type == pkgCache::Dep::DpkgBreaks)
return true;
+ else if (IsProtected == true)
+ {
+ // FIXME: Message should talk about Protected, not Essential, and unified.
+ if (_config->FindB("APT::Force-LoopBreak",false) == false)
+ return _error->Error(_("This installation run will require temporarily "
+ "removing the essential package %s due to a "
+ "Conflicts/Pre-Depends loop. This is often bad, "
+ "but if you really want to do it, activate the "
+ "APT::Force-LoopBreak option."),Pkg.FullName().c_str());
+ }
bool Res = SmartRemove(Pkg);
if (Cache[Pkg].Delete() == false)