summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/depcache.cc44
1 files changed, 35 insertions, 9 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index e466cba28..99e694a06 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -836,6 +836,41 @@ bool pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
ActionGroup group(*this);
+ if (FromUser == false)
+ {
+ VerIterator const PV = P.InstVerIter(*this);
+ if (PV.end() == false)
+ {
+ // removed metapackages mark their dependencies as manual to prevent in "desktop depends browser, texteditor"
+ // the removal of browser to suggest the removal of desktop and texteditor.
+ // We ignore the auto-bit here as we can't deal with metapackage cascardes otherwise.
+ // We do not check for or-groups here as we don't know which package takes care of
+ // providing the feature the user likes e.g.: browser1 | browser2 | browser3
+ // Temporary removals are effected by this as well, which is bad, but unlikely in practice
+ bool const PinNeverMarkAutoSection = (PV->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", PV.Section()));
+ if (PinNeverMarkAutoSection)
+ {
+ for (DepIterator D = PV.DependsList(); D.end() != true; ++D)
+ {
+ if (D.IsMultiArchImplicit() == true || D.IsNegative() == true || IsImportantDep(D) == false)
+ continue;
+
+ pkgCacheFile CacheFile(this);
+ APT::VersionList verlist = APT::VersionList::FromDependency(CacheFile, D, APT::CacheSetHelper::INSTALLED);
+ for (auto const &V : verlist)
+ {
+ PkgIterator const DP = V.ParentPkg();
+ if(DebugAutoInstall == true)
+ std::clog << OutputInDepth(Depth) << "Setting " << DP.FullName(false) << " NOT as auto-installed (direct "
+ << D.DepType() << " of " << Pkg.FullName(false) << " which is in APT::Never-MarkAuto-Sections)" << std::endl;
+
+ MarkAuto(DP, false);
+ }
+ }
+ }
+ }
+ }
+
if (DebugMarker == true)
std::clog << OutputInDepth(Depth) << (rPurge ? "MarkPurge " : "MarkDelete ") << Pkg << " FU=" << FromUser << std::endl;
@@ -1096,7 +1131,6 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
VerIterator const PV = P.InstVerIter(*this);
if (unlikely(PV.end() == true))
return false;
- bool const PinNeverMarkAutoSection = (PV->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", PV.Section()));
DepIterator Dep = PV.DependsList();
for (; Dep.end() != true;)
@@ -1210,14 +1244,6 @@ bool pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
verlist.erase(InstVer);
continue;
}
- // now check if we should consider it a automatic dependency or not
- if(InstPkg->CurrentVer == 0 && PinNeverMarkAutoSection)
- {
- if(DebugAutoInstall == true)
- std::clog << OutputInDepth(Depth) << "Setting NOT as auto-installed (direct "
- << Start.DepType() << " of pkg in APT::Never-MarkAuto-Sections)" << std::endl;
- MarkAuto(InstPkg, false);
- }
break;
} while(true);
continue;