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
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);
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)
/*}}}*/
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;
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(""));
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;
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;
{
bool follow_recommends;
bool follow_suggests;
+ bool debug_autoremove = _config->FindB("Debug::pkgAutoRemove",false);
// init the states
for(PkgIterator p = PkgBegin(); !p.end(); ++p)
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;
}
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())
{
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() << " "
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() << " "
/*}}}*/
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
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;
}
}