X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/af29ffb44d95dfb0f7b0c1835e2e501313f74723..d116d66834b77cc77750c89969c43e0ba9d5807e:/apt-pkg/depcache.cc diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index e9ef9cedc..b1b8f970f 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -47,14 +48,6 @@ ConfigValueInSubTree(const char* SubTree, const char *needle) return false; } -std::string OutputInDepth(const unsigned long Depth) -{ - std::string output = ""; - for(unsigned long d=Depth; d > 0; d--) - output += " "; - return output; -} - pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) : cache(cache), released(false) { @@ -1011,7 +1004,8 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, } } - if (InstPkg.end() == false) + if (InstPkg.end() == false && + AutoInstOk(InstPkg, (*this)[InstPkg].CandidateVerIter(*this), Start)) { if(DebugAutoInstall == true) std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name() @@ -1049,15 +1043,31 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, PkgIterator Pkg = Ver.ParentPkg(); if (Start->Type != Dep::DpkgBreaks) - MarkDelete(Pkg,false,Depth + 1); + { + if(AutoInstOk(Pkg, VerIterator(*this), Start)) + MarkDelete(Pkg); + } else - if (PkgState[Pkg->ID].CandidateVer != *I) + if (PkgState[Pkg->ID].CandidateVer != *I && + AutoInstOk(Pkg, VerIterator(*this, PkgState[Pkg->ID].CandidateVer), Start)) MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps); } continue; } } } + +// DepCache::AutoInstOk - check if it is to install this package /*{{{*/ +// --------------------------------------------------------------------- +/* The default implementation just honors dpkg hold + But an application using this library can override this method + to control the MarkInstall behaviour */ +bool pkgDepCache::AutoInstOk(const PkgIterator &Pkg, + const VerIterator &v, + const DepIterator &d) +{ + return (Pkg->SelectedState != pkgCache::State::Hold); +} /*}}}*/ // DepCache::SetReInstall - Set the reinstallation flag /*{{{*/ // ---------------------------------------------------------------------