]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/dpkgpm.cc
add wrapper around dpkg to be able to use it easily in the tests
[apt.git] / apt-pkg / deb / dpkgpm.cc
index 9af7a0792d1b5c79439b2003af229cf5d3c4c46f..5530ef12975862f9b24e0aa5d06e7b588689c671 100644 (file)
@@ -554,7 +554,7 @@ void pkgDPkgPM::handleDisappearAction(string const &pkgname)
    // the disappeared package was auto-installed - nothing to do
    if ((Cache[Pkg].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
       return;
-   pkgCache::VerIterator PkgVer = Pkg.CurrentVer();
+   pkgCache::VerIterator PkgVer = Cache[Pkg].InstVerIter(Cache);
    if (unlikely(PkgVer.end() == true))
       return;
    /* search in the list of dependencies for (Pre)Depends,
@@ -571,7 +571,9 @@ void pkgDPkgPM::handleDisappearAction(string const &pkgname)
       // the package is already marked as manual
       if ((Cache[Tar].Flags & pkgCache::Flag::Auto) != pkgCache::Flag::Auto)
         continue;
-      pkgCache::VerIterator TarVer = Tar.CurrentVer();
+      pkgCache::VerIterator TarVer =  Cache[Tar].InstVerIter(Cache);
+      if (TarVer.end() == true)
+        continue;
       for (pkgCache::DepIterator Rep = TarVer.DependsList(); Rep.end() != true; ++Rep)
       {
         if (Rep->Type != pkgCache::Dep::Replaces)
@@ -656,7 +658,7 @@ bool pkgDPkgPM::OpenLog()
       term_out = fopen(logfile_name.c_str(),"a");
       if (term_out == NULL)
         return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str());
-
+      setvbuf(term_out, NULL, _IONBF, 0);
       chmod(logfile_name.c_str(), 0600);
       fprintf(term_out, "\nLog started: %s\n", timestr);
    }
@@ -675,17 +677,22 @@ bool pkgDPkgPM::OpenLog()
       for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
       {
         if (Cache[I].NewInstall())
-           install += I.Name() + string(" (") + Cache[I].CandVersion + string("), ");
+        {
+           install += I.FullName(false) + string(" (") + Cache[I].CandVersion;
+           if (Cache[I].Flags & pkgCache::Flag::Auto)
+              install+= ", automatic";
+           install += string("), ");
+        }
         else if (Cache[I].Upgrade())
-           upgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
+           upgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
         else if (Cache[I].Downgrade())
-           downgrade += I.Name() + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
+           downgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
         else if (Cache[I].Delete())
         {
            if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge)
-              purge += I.Name() + string(" (") + Cache[I].CurVersion + string("), ");      
+              purge += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), ");     
            else
-              remove += I.Name() + string(" (") + Cache[I].CurVersion + string("), ");     
+              remove += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), ");            
         }
       }
       if (_config->Exists("Commandline::AsString") == true)