X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/3e2d7cce4febc923d4b9bcb363717dd161cbb856..99158c43616f0c09dc1810ce9913090acd02311e:/apt-pkg/depcache.cc diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index e17b7b0e8..228750b74 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -129,7 +129,7 @@ bool pkgDepCache::Init(OpProgress *Prog) int Done = 0; for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++) { - if (Prog != 0) + if (Prog != 0 && Done%20 == 0) Prog->Progress(Done); // Find the proper cache slot @@ -175,6 +175,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog) /*{{{*/ pkgTagFile tagfile(&state_file); pkgTagSection section; int amt=0; + bool debug_autoremove=_config->FindB("Debug::pkgAutoRemove",false); while(tagfile.Step(section)) { string pkgname = section.FindS("Package"); pkgCache::PkgIterator pkg=Cache->FindPkg(pkgname); @@ -184,7 +185,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog) /*{{{*/ short reason = section.FindI("Auto-Installed", 0); if(reason > 0) PkgState[pkg->ID].Flags |= Flag::Auto; - if(_config->FindB("Debug::pkgAutoRemove",false)) + if(debug_autoremove) std::cout << "Auto-Installed : " << pkgname << std::endl; amt+=section.size(); if(Prog != NULL) @@ -202,7 +203,9 @@ bool pkgDepCache::readStateFile(OpProgress *Prog) /*{{{*/ /*}}}*/ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) /*{{{*/ { - if(_config->FindB("Debug::pkgAutoRemove",false)) + bool debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false); + + if(debug_autoremove) std::clog << "pkgDepCache::writeStateFile()" << std::endl; FileFd StateFile; @@ -257,14 +260,14 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly) /*{{{*/ for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end(); pkg++) { if(PkgState[pkg->ID].Flags & Flag::Auto) { if (pkgs_seen.find(pkg.Name()) != pkgs_seen.end()) { - if(_config->FindB("Debug::pkgAutoRemove",false)) + if(debug_autoremove) std::clog << "Skipping already written " << pkg.Name() << std::endl; continue; } // skip not installed ones if requested if(InstalledOnly && pkg->CurrentVer == 0) continue; - if(_config->FindB("Debug::pkgAutoRemove",false)) + if(debug_autoremove) std::clog << "Writing new AutoInstall: " << pkg.Name() << std::endl; ostr.str(string("")); @@ -820,7 +823,7 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge, bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge, unsigned long Depth, bool FromUser) { - if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold) + if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold && _config->FindB("APT::Ignore-Hold",false) == false) { if (DebugMarker == true) std::clog << OutputInDepth(Depth) << "Hold prevents MarkDelete of " << Pkg << " FU=" << FromUser << std::endl; @@ -1082,7 +1085,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst, bool pkgDepCache::IsInstallOk(PkgIterator const &Pkg,bool AutoInst, unsigned long Depth, bool FromUser) { - if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold) + if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold && _config->FindB("APT::Ignore-Hold",false) == false) { if (DebugMarker == true) std::clog << OutputInDepth(Depth) << "Hold prevents MarkInstall of " << Pkg << " FU=" << FromUser << std::endl; @@ -1326,6 +1329,7 @@ bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc) { bool follow_recommends; bool follow_suggests; + bool debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false); // init the states for(PkgIterator p = PkgBegin(); !p.end(); ++p) @@ -1334,8 +1338,7 @@ bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc) PkgState[p->ID].Garbage = false; // debug output - if(_config->FindB("Debug::pkgAutoRemove",false) - && PkgState[p->ID].Flags & Flag::Auto) + if(debug_autoremove && PkgState[p->ID].Flags & Flag::Auto) std::clog << "AutoDep: " << p.Name() << std::endl; } @@ -1406,7 +1409,9 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg, if(state.Marked) return; - if(_config->FindB("Debug::pkgAutoRemove",false)) + bool debug_autoremove = _config->FindB("Debug::pkgAutoRemove", false); + + if(debug_autoremove) { std::clog << "Marking: " << pkg.Name(); if(!ver.end()) @@ -1437,7 +1442,7 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg, { if(_system->VS->CheckDep(V.VerStr(), d->CompareOp, d.TargetVer())) { - if(_config->FindB("Debug::pkgAutoRemove",false)) + if(debug_autoremove) { std::clog << "Following dep: " << d.ParentPkg().Name() << " " << d.ParentVer().VerStr() << " " @@ -1461,7 +1466,7 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg, if(_system->VS->CheckDep(prv.ProvideVersion(), d->CompareOp, d.TargetVer())) { - if(_config->FindB("Debug::pkgAutoRemove",false)) + if(debug_autoremove) { std::clog << "Following dep: " << d.ParentPkg().Name() << " " << d.ParentVer().VerStr() << " " @@ -1489,9 +1494,11 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg, /*}}}*/ bool pkgDepCache::Sweep() /*{{{*/ { + bool debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false); + // do the sweep for(PkgIterator p=PkgBegin(); !p.end(); ++p) - { + { StateCache &state=PkgState[p->ID]; // skip required packages @@ -1503,7 +1510,7 @@ bool pkgDepCache::Sweep() /*{{{*/ if(!state.Marked && (!p.CurrentVer().end() || state.Install())) { state.Garbage=true; - if(_config->FindB("Debug::pkgAutoRemove",false)) + if(debug_autoremove) std::cout << "Garbage: " << p.Name() << std::endl; } }