]> git.saurik.com Git - apt.git/commitdiff
* moved most of the real work into depcache::writeStateFile
authorMichael Vogt <michael.vogt@ubuntu.com>
Fri, 24 Jun 2005 09:36:22 +0000 (09:36 +0000)
committerMichael Vogt <michael.vogt@ubuntu.com>
Fri, 24 Jun 2005 09:36:22 +0000 (09:36 +0000)
apt-pkg/algorithms.cc
apt-pkg/depcache.cc
cmdline/apt-get.cc

index 479927d65519372d30a413c84ee55c059d39d9da..2799c2fddaca78b24f54c705b36076fb848b190e 100644 (file)
@@ -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;
 }
                                                                        /*}}}*/
index 552a45a16382acdb4932212079836d6f6bb2af45..c490d89bc5db494e161678ff941b883a87d38651 100644 (file)
@@ -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()
index 9f9ecd37524cc551f3db788e4a9389e867112302..bc8cd1ae56605cfc584ab254088425e366c1752e 100644 (file)
@@ -1703,10 +1703,8 @@ bool DoInstall(CommandLine &CmdL)
         
         if (*J == 0) {
            List += string(I.Name()) + " ";
-           // mark each pkg as auto-installed 
-           Cache[I].AutomaticRemove = pkgCache::State::RemoveRequired;
-        VersionsList += string(Cache[I].CandVersion) + "\n";
-     }
+           VersionsList += string(Cache[I].CandVersion) + "\n";
+        }
       }
       
       ShowList(c1out,_("The following extra packages will be installed:"),List,VersionsList);