]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/depcache.cc
* slighly more debug output, renamed "--automatic-remove" to "--auto-remove"
[apt.git] / apt-pkg / depcache.cc
index 05512e179d94d8267059f4b1a035b2c0a1987b37..9adc4e3901f9cecab2f1cf42e770e71ff35e40fc 100644 (file)
@@ -112,8 +112,9 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
    if(FileExists(state)) {
       state_file.Open(state, FileFd::ReadOnly);
       int file_size = state_file.Size();
-      Prog->OverallProgress(0, file_size, 1, 
-                           _("Reading state information"));
+      if(Prog != NULL)
+        Prog->OverallProgress(0, file_size, 1, 
+                              _("Reading state information"));
 
       pkgTagFile tagfile(&state_file);
       pkgTagSection section;
@@ -124,18 +125,19 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
         // Silently ignore unknown packages and packages with no actual
         // version.
         if(!pkg.end() && !pkg.VersionList().end()) {
-           short reason = section.FindI("Install-Reason", 0);
+           short reason = section.FindI("Auto-Installed", 0);
            if(reason > 0)
-              PkgState[pkg->ID].Flags  |= pkgCache::Flag::Auto;
+              PkgState[pkg->ID].Flags  |= Flag::Auto;
            if(_config->FindB("Debug::pkgAutoRemove",false))
-              std::cout << "Install-Reason for: " << pkgname 
-                        << " is " << reason << std::endl;
+              std::cout << "Auto-Installed : " << pkgname << std::endl;
            amt+=section.size();
-           Prog->OverallProgress(amt, file_size, 1, 
-                                 _("Reading state information"));
+           if(Prog != NULL)
+              Prog->OverallProgress(amt, file_size, 1, 
+                                    _("Reading state information"));
         }
-        Prog->OverallProgress(file_size, file_size, 1, 
-                              _("Reading state information"));
+        if(Prog != NULL)
+           Prog->OverallProgress(file_size, file_size, 1, 
+                                 _("Reading state information"));
       }
    }
 
@@ -157,12 +159,12 @@ bool pkgDepCache::writeStateFile(OpProgress *prog)
    std::ostringstream ostr;
    for(pkgCache::PkgIterator pkg=Cache->PkgBegin(); !pkg.end();pkg++) {
 
-      if(PkgState[pkg->ID].Flags & pkgCache::Flag::Auto) {
+      if(PkgState[pkg->ID].Flags & Flag::Auto) {
         if(_config->FindB("Debug::pkgAutoRemove",false))
            std::clog << "AutoInstal: " << pkg.Name() << std::endl;
         ostr.str(string(""));
         ostr << "Package: " << pkg.Name() 
-             << "\nInstall-Reason: 1\n\n";
+             << "\nAuto-Installed: 1\n\n";
         StateFile.Write(ostr.str().c_str(), ostr.str().size());
       }
    }