]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/deb/dpkgpm.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 27 May 2010 13:17:52 +0000 (15:17 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 27 May 2010 13:17:52 +0000 (15:17 +0200)
  - write Disappeared also to the history.log

apt-pkg/deb/dpkgpm.cc
apt-pkg/deb/dpkgpm.h
debian/changelog

index 8318fe37fc70f36d8047ee2dd64ff04a99017a0a..35b10975f0d97df1a09fbaf998ae17d7b03b1aaa 100644 (file)
@@ -568,15 +568,15 @@ void pkgDPkgPM::DoDpkgStatusFd(int statusfd, int OutStatusFd)
 }
                                                                        /*}}}*/
 // DPkgPM::WriteHistoryTag                                             /*{{{*/
-void pkgDPkgPM::WriteHistoryTag(string tag, string value)
+void pkgDPkgPM::WriteHistoryTag(string const &tag, string value)
 {
-   if (value.size() > 0)
-   {
-      // poor mans rstrip(", ")
-      if (value[value.size()-2] == ',' && value[value.size()-1] == ' ')
-        value.erase(value.size() - 2, 2);
-      fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str());
-   }
+   size_t const length = value.length();
+   if (length == 0)
+      return;
+   // poor mans rstrip(", ")
+   if (value[length-2] == ',' && value[length-1] == ' ')
+      value.erase(length - 2, 2);
+   fprintf(history_out, "%s: %s\n", tag.c_str(), value.c_str());
 }                                                                      /*}}}*/
 // DPkgPM::OpenLog                                                     /*{{{*/
 bool pkgDPkgPM::OpenLog()
@@ -663,7 +663,22 @@ bool pkgDPkgPM::CloseLog()
 
    if(history_out)
    {
-      if (dpkg_error.size() > 0)
+      if (disappearedPkgs.empty() == false)
+      {
+        string disappear;
+        for (std::set<std::string>::const_iterator d = disappearedPkgs.begin();
+             d != disappearedPkgs.end(); ++d)
+        {
+           pkgCache::PkgIterator P = Cache.FindPkg(*d);
+           disappear.append(*d);
+           if (P.end() == true)
+              disappear.append(", ");
+           else
+              disappear.append(" (").append(Cache[P].CurVersion).append("), ");
+        }
+        WriteHistoryTag("Disappeared", disappear);
+      }
+      if (dpkg_error.empty() == false)
         fprintf(history_out, "Error: %s\n", dpkg_error.c_str());
       fprintf(history_out, "End-Date: %s\n", timestr);
       fclose(history_out);
index 330c788a25319fc74e5cea393946bebfe49b893f..b1459b1f671c60de42d9087365d86dcc44ec58e2 100644 (file)
@@ -68,7 +68,7 @@ class pkgDPkgPM : public pkgPackageManager
    // Helpers
    bool RunScriptsWithPkgs(const char *Cnf);
    bool SendV2Pkgs(FILE *F);
-   void WriteHistoryTag(string tag, string value);
+   void WriteHistoryTag(string const &tag, string value);
 
    // dpkg log
    bool OpenLog();
index 3771ca41577afb2400f747d3899c11e84c5c566c..ee571a5376932b30c4a653dd48f45d6a561c0850 100644 (file)
@@ -1,3 +1,11 @@
+apt (0.7.26~exp6) UNRELEASED; urgency=low
+
+  [ David Kalnischkies ]
+  * apt-pkg/deb/dpkgpm.cc:
+    - write Disappeared also to the history.log
+
+ -- David Kalnischkies <kalnischkies@gmail.com>  Thu, 27 May 2010 15:12:02 +0200
+
 apt (0.7.26~exp5) experimental; urgency=low
 
   [ David Kalnischkies ]