diff options
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r-- | apt-pkg/depcache.cc | 68 |
1 files changed, 43 insertions, 25 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 4d193dc2e..1e4771dda 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -8,9 +8,6 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ -#ifdef __GNUG__ -#pragma implementation "apt-pkg/depcache.h" -#endif #include <apt-pkg/depcache.h> #include <apt-pkg/version.h> #include <apt-pkg/error.h> @@ -712,9 +709,17 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser) // We dont even try to keep virtual packages.. if (Pkg->VersionList == 0) return; - +#if 0 // reseting the autoflag here means we lose the + // auto-mark information if a user selects a package for removal + // but changes his mind then and sets it for keep again + // - this makes sense as default when all Garbage dependencies + // are automatically marked for removal (as aptitude does). + // setting a package for keep then makes it no longer autoinstalled + // for all other use-case this action is rather suprising if(FromUser && !P.Marked) P.Flags &= ~Flag::Auto; +#endif + RemoveSizes(Pkg); RemoveStates(Pkg); @@ -873,6 +878,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, bool found=false; VerIterator instVer = Pkg.CurrentVer(); if(!instVer.end()) + { for (DepIterator D = instVer.DependsList(); D.end() != true; D++) { //FIXME: deal better with or-groups(?) @@ -881,9 +887,10 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if(IsImportantDep(D) && Start.TargetPkg() == D.TargetPkg()) found=true; } - // this is a new dep if it was not found to be already - // a important dep of the installed pacakge - isNewImportantDep = !found; + // this is a new dep if it was not found to be already + // a important dep of the installed pacakge + isNewImportantDep = !found; + } } if(isNewImportantDep) if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true) @@ -1108,6 +1115,34 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg) return Last; } /*}}}*/ +// Policy::IsImportantDep - True if the dependency is important /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep) +{ + if(Dep.IsCritical()) + return true; + else if(Dep->Type == pkgCache::Dep::Recommends) + { + if ( _config->FindB("APT::Install-Recommends", false)) + return true; + // we suport a special mode to only install-recommends for certain + // sections + // FIXME: this is a meant as a temporarly solution until the + // recommends are cleaned up + string s = _config->Find("APT::Install-Recommends-Section",""); + if(s.size() > 0) + { + const char *sec = Dep.TargetPkg().Section(); + if (sec && strcmp(sec, s.c_str()) == 0) + return true; + } + } + else if(Dep->Type == pkgCache::Dep::Suggests) + return _config->FindB("APT::Install-Suggests", false); + + return false; +} /*}}}*/ pkgDepCache::DefaultRootSetFunc::DefaultRootSetFunc() @@ -1311,8 +1346,7 @@ bool pkgDepCache::Sweep() StateCache &state=PkgState[p->ID]; // if it is not marked and it is installed, it's garbage - if(!state.Marked && (!p.CurrentVer().end() || state.Install()) && - !state.Delete()) + if(!state.Marked && (!p.CurrentVer().end() || state.Install())) { state.Garbage=true; if(_config->FindB("Debug::pkgAutoRemove",false)) @@ -1322,19 +1356,3 @@ bool pkgDepCache::Sweep() return true; } - -// Policy::IsImportantDep - True if the dependency is important /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep) -{ - if(Dep.IsCritical()) - return true; - else if(Dep->Type == pkgCache::Dep::Recommends) - return _config->FindB("APT::Install-Recommends", false); - else if(Dep->Type == pkgCache::Dep::Suggests) - return _config->FindB("APT::Install-Suggests", false); - - return false; -} - /*}}}*/ |