[Reproducible-commits] [dpkg] 34/63: dpkg: Refactor pkg_deconfigure_others()

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Mar 4 17:44:44 UTC 2016


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

lunar pushed a commit to branch pu/buildinfo
in repository dpkg.

commit 3e3458881624cf349e8c0684d3b69111c37c720d
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Feb 20 09:21:49 2016 +0100

    dpkg: Refactor pkg_deconfigure_others()
---
 src/unpack.c | 99 ++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 53 insertions(+), 46 deletions(-)

diff --git a/src/unpack.c b/src/unpack.c
index 31ec7d2..6b9b9f4 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -197,6 +197,58 @@ get_control_dir(char *cidir)
   return cidir;
 }
 
+static void
+pkg_deconfigure_others(struct pkginfo *pkg)
+{
+  struct pkg_deconf_list *deconpil;
+
+  for (deconpil = deconfigure; deconpil; deconpil = deconpil->next) {
+    struct pkginfo *removing = deconpil->pkg_removal;
+
+    if (removing)
+      printf(_("De-configuring %s (%s), to allow removal of %s (%s) ...\n"),
+             pkg_name(deconpil->pkg, pnaw_nonambig),
+             versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig),
+             pkg_name(removing, pnaw_nonambig),
+             versiondescribe(&removing->installed.version, vdew_nonambig));
+    else
+      printf(_("De-configuring %s (%s) ...\n"),
+             pkg_name(deconpil->pkg, pnaw_nonambig),
+             versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig));
+
+    trig_activate_packageprocessing(deconpil->pkg);
+    pkg_set_status(deconpil->pkg, PKG_STAT_HALFCONFIGURED);
+    modstatdb_note(deconpil->pkg);
+
+    /* This means that we *either* go and run postinst abort-deconfigure,
+     * *or* queue the package for later configure processing, depending
+     * on which error cleanup route gets taken. */
+    push_cleanup(cu_prermdeconfigure, ~ehflag_normaltidy,
+                 ok_prermdeconfigure, ehflag_normaltidy,
+                 3, (void *)deconpil->pkg, (void *)removing, (void *)pkg);
+
+    if (removing) {
+      maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal",
+                            "deconfigure", "in-favour",
+                            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
+                            versiondescribe(&pkg->available.version,
+                                            vdew_nonambig),
+                            "removing",
+                            pkg_name(removing, pnaw_nonambig),
+                            versiondescribe(&removing->installed.version,
+                                            vdew_nonambig),
+                            NULL);
+    } else {
+      maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal",
+                            "deconfigure", "in-favour",
+                            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
+                            versiondescribe(&pkg->available.version,
+                                            vdew_nonambig),
+                            NULL);
+    }
+  }
+}
+
 /**
  * Read the conffiles, and copy the hashes across.
  */
@@ -964,7 +1016,6 @@ void process_archive(const char *filename) {
   struct dependency *dsearch;
   struct deppossi *psearch;
   struct stat stab;
-  struct pkg_deconf_list *deconpil;
   struct pkginfo *fixbytrigaw;
 
   cleanup_pkg_failed= cleanup_conflictor_failed= 0;
@@ -1191,51 +1242,7 @@ void process_archive(const char *filename) {
     modstatdb_note(pkg);
   }
 
-  for (deconpil= deconfigure; deconpil; deconpil= deconpil->next) {
-    struct pkginfo *removing = deconpil->pkg_removal;
-
-    if (removing)
-      printf(_("De-configuring %s (%s), to allow removal of %s (%s) ...\n"),
-             pkg_name(deconpil->pkg, pnaw_nonambig),
-             versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig),
-             pkg_name(removing, pnaw_nonambig),
-             versiondescribe(&removing->installed.version, vdew_nonambig));
-    else
-      printf(_("De-configuring %s (%s) ...\n"),
-             pkg_name(deconpil->pkg, pnaw_nonambig),
-             versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig));
-
-    trig_activate_packageprocessing(deconpil->pkg);
-    pkg_set_status(deconpil->pkg, PKG_STAT_HALFCONFIGURED);
-    modstatdb_note(deconpil->pkg);
-
-    /* This means that we *either* go and run postinst abort-deconfigure,
-     * *or* queue the package for later configure processing, depending
-     * on which error cleanup route gets taken. */
-    push_cleanup(cu_prermdeconfigure, ~ehflag_normaltidy,
-                 ok_prermdeconfigure, ehflag_normaltidy,
-                 3, (void*)deconpil->pkg, (void*)removing, (void*)pkg);
-
-    if (removing) {
-      maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal",
-                            "deconfigure", "in-favour",
-                            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
-                            versiondescribe(&pkg->available.version,
-                                            vdew_nonambig),
-                            "removing",
-                            pkg_name(removing, pnaw_nonambig),
-                            versiondescribe(&removing->installed.version,
-                                            vdew_nonambig),
-                            NULL);
-    } else {
-      maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal",
-                            "deconfigure", "in-favour",
-                            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
-                            versiondescribe(&pkg->available.version,
-                                            vdew_nonambig),
-                            NULL);
-    }
-  }
+  pkg_deconfigure_others(pkg);
 
   for (conflictor_iter = conflictors.head;
        conflictor_iter;

-- 
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