diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-06-29 18:00:54 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-06-29 18:00:54 +0200 |
commit | af29ffb44d95dfb0f7b0c1835e2e501313f74723 (patch) | |
tree | dd1c5f45e2cb5a681558408598ca4fe44ee4961b /apt-pkg/depcache.cc | |
parent | 55a5a46c235a30bf024fb2301066553953701cc5 (diff) |
* add depth information to the debug output and show what depends
type triggers a autoinst (closes: #458389)
* add debug::pkgDepCache::Marker with more detailed debug output
(closes: #87520)
Diffstat (limited to 'apt-pkg/depcache.cc')
-rw-r--r-- | apt-pkg/depcache.cc | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 2411bfe89..e9ef9cedc 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -47,6 +47,13 @@ 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) @@ -83,6 +90,8 @@ pkgDepCache::ActionGroup::~ActionGroup() pkgDepCache::pkgDepCache(pkgCache *pCache,Policy *Plcy) : group_level(0), Cache(pCache), PkgState(0), DepState(0) { + DebugMarker = _config->FindB("Debug::pkgDepCache::Marker", false); + DebugAutoInstall = _config->FindB("Debug::pkgDepCache::AutoInstall", false); delLocalPolicy = 0; LocalPolicy = Plcy; if (LocalPolicy == 0) @@ -705,7 +714,8 @@ void pkgDepCache::Update(PkgIterator const &Pkg) // DepCache::MarkKeep - Put the package in the keep state /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser) +void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser, + unsigned long Depth) { // Simplifies other routines. if (Pkg.end() == true) @@ -746,6 +756,9 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser) P.Flags &= ~Flag::Auto; #endif + if (DebugMarker == true) + std::clog << OutputInDepth(Depth) << "MarkKeep " << Pkg << std::endl; + RemoveSizes(Pkg); RemoveStates(Pkg); @@ -765,7 +778,8 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser) // DepCache::MarkDelete - Put the package in the delete state /*{{{*/ // --------------------------------------------------------------------- /* */ -void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge) +void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, + unsigned long Depth) { // Simplifies other routines. if (Pkg.end() == true) @@ -787,6 +801,9 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge) if (Pkg->VersionList == 0) return; + if (DebugMarker == true) + std::clog << OutputInDepth(Depth) << "MarkDelete " << Pkg << std::endl; + RemoveSizes(Pkg); RemoveStates(Pkg); @@ -826,7 +843,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, P.CandidateVer == (Version *)Pkg.CurrentVer())) { if (P.CandidateVer == (Version *)Pkg.CurrentVer() && P.InstallVer == 0) - MarkKeep(Pkg, false, FromUser); + MarkKeep(Pkg, false, FromUser, Depth+1); return; } @@ -868,6 +885,9 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if (AutoInst == false) return; + if (DebugMarker == true) + std::clog << OutputInDepth(Depth) << "MarkInstall " << Pkg << std::endl; + DepIterator Dep = P.InstVerIter(*this).DependsList(); for (; Dep.end() != true;) { @@ -937,12 +957,12 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, } } if(isNewImportantDep) - if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true) - std::clog << "new important dependency: " + if(DebugAutoInstall == true) + std::clog << OutputInDepth(Depth) << "new important dependency: " << Start.TargetPkg().Name() << std::endl; if(isPreviouslySatisfiedImportantDep) - if(_config->FindB("Debug::pkgDepCache::AutoInstall", false) == true) - std::clog << "previously satisfied important dependency on " + if(DebugAutoInstall == true) + std::clog << OutputInDepth(Depth) << "previously satisfied important dependency on " << Start.TargetPkg().Name() << std::endl; // skip important deps if the package is already installed @@ -993,15 +1013,16 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, if (InstPkg.end() == false) { - if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true) - std::clog << "Installing " << InstPkg.Name() - << " as dep of " << Pkg.Name() + if(DebugAutoInstall == true) + std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name() + << " as " << Start.DepType() << " of " << Pkg.Name() << std::endl; // now check if we should consider it a automatic dependency or not if(Pkg.Section() && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", Pkg.Section())) { - if(_config->FindB("Debug::pkgDepCache::AutoInstall",false) == true) - std::clog << "Setting NOT as auto-installed (direct dep of pkg in APT::Never-MarkAuto-Sections)" << std::endl; + if(DebugAutoInstall == true) + std::clog << OutputInDepth(Depth) << "Setting NOT as auto-installed (direct " + << Start.DepType() << " of pkg in APT::Never-MarkAuto-Sections)" << std::endl; MarkInstall(InstPkg,true,Depth + 1, true); } else @@ -1028,7 +1049,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, PkgIterator Pkg = Ver.ParentPkg(); if (Start->Type != Dep::DpkgBreaks) - MarkDelete(Pkg); + MarkDelete(Pkg,false,Depth + 1); else if (PkgState[Pkg->ID].CandidateVer != *I) MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps); |