Преглед изворни кода

dpkg: Do not call modstatdb_note() unnecessarily on remove or purge

Move the modstatdb_note() inside the !f_pending conditional where
the want status is being changed, there's no point in always calling
this function afterwards if there's been no status change at all.
Guillem Jover пре 13 година
родитељ
комит
5bbc18af9d
2 измењених фајлова са 5 додато и 2 уклоњено
  1. 1 0
      debian/changelog
  2. 4 2
      src/remove.c

+ 1 - 0
debian/changelog

@@ -59,6 +59,7 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Execute maintainer scripts in a new execution context, based on the
   * Execute maintainer scripts in a new execution context, based on the
     current one and the specific maintainer script filename, and if it's
     current one and the specific maintainer script filename, and if it's
     not different to the current one, use "dpkg_script_t" as a fallback.
     not different to the current one, use "dpkg_script_t" as a fallback.
+  * Do not unnecessarily create a dpkg update log record on remove or purge.
 
 
  -- Guillem Jover <guillem@debian.org>  Fri, 03 Aug 2012 13:21:00 +0200
  -- Guillem Jover <guillem@debian.org>  Fri, 03 Aug 2012 13:21:00 +0200
 
 

+ 4 - 2
src/remove.c

@@ -3,7 +3,7 @@
  * remove.c - functionality for removing packages
  * remove.c - functionality for removing packages
  *
  *
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
  * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk>
- * Copyright © 2007-2012 Guillem Jover <guillem@debian.org>
+ * Copyright © 2007-2013 Guillem Jover <guillem@debian.org>
  *
  *
  * This is free software; you can redistribute it and/or modify
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * it under the terms of the GNU General Public License as published by
@@ -114,8 +114,10 @@ void deferred_remove(struct pkginfo *pkg) {
       pkg_set_want(pkg, want_purge);
       pkg_set_want(pkg, want_purge);
     else
     else
       pkg_set_want(pkg, want_deinstall);
       pkg_set_want(pkg, want_deinstall);
+
+    if (!f_noact)
+      modstatdb_note(pkg);
   }
   }
-  if (!f_noact) modstatdb_note(pkg);
 
 
   debug(dbg_general, "checking dependencies for remove '%s'",
   debug(dbg_general, "checking dependencies for remove '%s'",
         pkg_name(pkg, pnaw_always));
         pkg_name(pkg, pnaw_always));