[dpkg] 129/187: dpkg: Do not log nor print duplicate removal action

Reiner Herrmann reiner at reiner-h.de
Sun Nov 6 12:46:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository dpkg.

commit b4e88220c2ba83bb96fc8f7430437b7d3e1bf1bf
Author: Guillem Jover <guillem at debian.org>
Date:   Tue Sep 13 03:16:20 2016 +0200

    dpkg: Do not log nor print duplicate removal action
    
    We print “Removing <package> (<version>)” lines and log remove action
    twice when purging a package from frontends, because they usually first
    call --remove and then --purge sequentially. When purging a package
    which is already in config-files (i.e. it has been removed before),
    do not print nor log the remove action.
---
 debian/changelog |  6 ++++++
 src/remove.c     | 11 ++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index bff4328..3058474 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -46,6 +46,12 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
     version of this function we can avoid the dependency on either libstdc++
     or libsup++.
   * Include missing <new> for new and delete operator declarations.
+  * Do not log nor print duplicate dpkg removal action. We print
+    “Removing <package> (<version>)” lines and log remove action twice
+    when purging a package from frontends, because they usually first call
+    --remove and then --purge sequentially. When purging a package which is
+    already in config-files (i.e. it has been removed before), do not print
+    nor log the remove action.
   * Architecture support:
     - Add support for AIX operating system.
   * Portability:
diff --git a/src/remove.c b/src/remove.c
index 88479ea..9cfd7d0 100644
--- a/src/remove.c
+++ b/src/remove.c
@@ -171,9 +171,14 @@ void deferred_remove(struct pkginfo *pkg) {
 
   pkg_conffiles_mark_old(pkg);
 
-  printf(_("Removing %s (%s) ...\n"), pkg_name(pkg, pnaw_nonambig),
-         versiondescribe(&pkg->installed.version, vdew_nonambig));
-  log_action("remove", pkg, &pkg->installed);
+  /* Only print and log removal action once. This avoids duplication when
+   * using --remove and --purge in sequence. */
+  if (pkg->status > PKG_STAT_CONFIGFILES) {
+    printf(_("Removing %s (%s) ...\n"), pkg_name(pkg, pnaw_nonambig),
+           versiondescribe(&pkg->installed.version, vdew_nonambig));
+    log_action("remove", pkg, &pkg->installed);
+  }
+
   trig_activate_packageprocessing(pkg);
   if (pkg->status >= PKG_STAT_HALFCONFIGURED) {
     static enum pkgstatus oldpkgstatus;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list