summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-06-24 09:36:22 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-06-24 09:36:22 +0000
commit80fa0d8a1a77f4dab696dcf11d1908ecda761fab (patch)
tree05da7a74ad98dabd48c5ea94cfb6f241d4c83bcb /apt-pkg
parenta83d884db24933000f19dbff706529db057d50c1 (diff)
* moved most of the real work into depcache::writeStateFile
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/algorithms.cc11
-rw-r--r--apt-pkg/depcache.cc11
2 files changed, 22 insertions, 0 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 479927d65..2799c2fdd 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -1061,6 +1061,17 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
return _error->Error(_("Unable to correct problems, you have held broken packages."));
}
+ // set the auto-flags (mvo: I'm not sure if we _really_ need this, but
+ // I didn't managed
+ pkgCache::PkgIterator I = Cache.PkgBegin();
+ for (;I.end() != true; I++) {
+ if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) {
+ std::cout << "Resolve installed new pkg: " << I.Name() << " (now marking it as auto)" << std::endl;
+ Cache[I].Flags |= pkgCache::Flag::Auto;
+ }
+ }
+
+
return true;
}
/*}}}*/
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 552a45a16..c490d89bc 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -151,6 +151,17 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
std::ostringstream ostr;
for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end();pkg++) {
+
+ // clear out no longer installed pkg
+ if(PkgState[pkg->ID].Delete() || pkg.CurrentVer() == NULL)
+ PkgState[pkg->ID].AutomaticRemove = pkgCache::State::RemoveUnknown;
+
+ // check if we have new information
+ if(PkgState[pkg->ID].Flags & pkgCache::Flag::Auto) {
+ std::cout << "pkg: " << pkg.Name() << " is auto-dep" << std::endl;
+ PkgState[pkg->ID].AutomaticRemove = pkgCache::State::RemoveRequired;
+ }
+
if(PkgState[pkg->ID].AutomaticRemove != pkgCache::State::RemoveUnknown) {
ostr.str(string(""));
ostr << "Package: " << pkg.Name()