/* Set the current state of everything. In this state all of the
packages are kept exactly as is. See AllUpgrade */
int Done = 0;
+ int Update_interval = Head().PackageCount/100;
+ if (Update_interval == 0)
+ Update_interval = 1;
for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++)
{
- if (Prog != 0)
+ if (Prog != 0 && Done%Update_interval == 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(""));
// Perform the depends pass
int Done = 0;
+ int Update_interval = Head().PackageCount;
+ if (Update_interval == 0)
+ Update_interval = 1;
for (PkgIterator I = PkgBegin(); I.end() != true; I++,Done++)
{
- if (Prog != 0 && Done%20 == 0)
+ if (Prog != 0 && Done%Update_interval == 0)
Prog->Progress(Done);
for (VerIterator V = I.VersionList(); V.end() != true; V++)
{
{
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;
}
}