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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=0660157a43449bc11af61c07a3494a236f39edf7

commit 0660157a43449bc11af61c07a3494a236f39edf7
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Aug 20 23:46:50 2021 +0200

    dpkg: Distinguish deconfiguration message for installation and multi-arch 
syncs
    
    Make the distinction between the two cases explicit, but printing the
    package we are deconfiguring in-favour of.
---
 src/archives.c |  8 +++++---
 src/archives.h |  4 +++-
 src/cleanup.c  |  6 ++++--
 src/unpack.c   | 19 ++++++++++++++-----
 4 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/src/archives.c b/src/archives.c
index 46800fdb1..f2b602eab 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -1189,7 +1189,8 @@ tar_deferred_extract(struct fsys_namenode_list *files, 
struct pkginfo *pkg)
 }
 
 void
-enqueue_deconfigure(struct pkginfo *pkg, struct pkginfo *pkg_removal)
+enqueue_deconfigure(struct pkginfo *pkg, struct pkginfo *pkg_removal,
+                    enum pkgwant reason)
 {
   struct pkg_deconf_list *newdeconf;
 
@@ -1199,6 +1200,7 @@ enqueue_deconfigure(struct pkginfo *pkg, struct pkginfo 
*pkg_removal)
   newdeconf->next = deconfigure;
   newdeconf->pkg = pkg;
   newdeconf->pkg_removal = pkg_removal;
+  newdeconf->reason = reason;
   deconfigure = newdeconf;
 }
 
@@ -1236,7 +1238,7 @@ try_deconfigure_can(struct pkginfo *pkg, struct deppossi 
*pdep,
             pkgbin_name(pkg_install, &pkg->available, pnaw_nonambig), why);
     return 2;
   } else if (f_autodeconf) {
-    enqueue_deconfigure(pkg, NULL);
+    enqueue_deconfigure(pkg, NULL, PKG_WANT_INSTALL);
     return 1;
   } else {
     notice(_("no, cannot proceed with installation of %s (--auto-deconfigure 
will help):\n%s"),
@@ -1296,7 +1298,7 @@ try_remove_can(struct deppossi *pdep,
       }
     }
 
-    enqueue_deconfigure(pkg, pkg_removal);
+    enqueue_deconfigure(pkg, pkg_removal, PKG_WANT_DEINSTALL);
     return 1;
   } else {
     notice(_("no, cannot proceed with removal of %s (--auto-deconfigure will 
help):\n%s"),
diff --git a/src/archives.h b/src/archives.h
index 2ceab9b1b..2a06360ff 100644
--- a/src/archives.h
+++ b/src/archives.h
@@ -39,6 +39,7 @@ struct pkg_deconf_list {
   struct pkg_deconf_list *next;
   struct pkginfo *pkg;
   struct pkginfo *pkg_removal;
+  enum pkgwant reason;
 };
 
 extern struct varbuf_state fname_state;
@@ -48,7 +49,8 @@ extern struct varbuf fnamenewvb;
 extern struct pkg_deconf_list *deconfigure;
 
 void clear_deconfigure_queue(void);
-void enqueue_deconfigure(struct pkginfo *pkg, struct pkginfo *pkg_removal);
+void enqueue_deconfigure(struct pkginfo *pkg, struct pkginfo *pkg_removal,
+                         enum pkgwant reason);
 void enqueue_conflictor(struct pkginfo *pkg);
 
 void cu_pathname(int argc, void **argv);
diff --git a/src/cleanup.c b/src/cleanup.c
index 3539fbf31..d33e5cb1f 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -126,7 +126,8 @@ void cu_prermupgrade(int argc, void **argv) {
 
 /*
  * Also has conflictor in argv[1] and infavour in argv[2].
- * conflictor may be NULL if deconfigure was due to Breaks.
+ * conflictor may be NULL if deconfigure was due to Breaks or multi-arch
+ * instance sync.
  */
 void ok_prermdeconfigure(int argc, void **argv) {
   struct pkginfo *deconf= (struct pkginfo*)argv[0];
@@ -136,7 +137,8 @@ void ok_prermdeconfigure(int argc, void **argv) {
 }
 
 /*
- * conflictor may be NULL.
+ * conflictor may be NULL if deconfigure was due to Breaks or multi-arch
+ * instance sync.
  */
 void cu_prermdeconfigure(int argc, void **argv) {
   struct pkginfo *deconf= (struct pkginfo*)argv[0];
diff --git a/src/unpack.c b/src/unpack.c
index 4b4648af9..2e0eb7b80 100644
--- a/src/unpack.c
+++ b/src/unpack.c
@@ -273,16 +273,25 @@ pkg_deconfigure_others(struct pkginfo *pkg)
   for (deconpil = deconfigure; deconpil; deconpil = deconpil->next) {
     struct pkginfo *removing = deconpil->pkg_removal;
 
-    if (removing)
+    if (deconpil->reason == PKG_WANT_DEINSTALL) {
       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"),
+    } else if (deconpil->reason == PKG_WANT_INSTALL) {
+      printf(_("De-configuring %s (%s), to allow installation of %s (%s) 
...\n"),
              pkg_name(deconpil->pkg, pnaw_nonambig),
-             versiondescribe(&deconpil->pkg->installed.version, 
vdew_nonambig));
+             versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig),
+             pkg_name(pkg, pnaw_nonambig),
+             versiondescribe(&pkg->available.version, vdew_nonambig));
+    } else {
+      printf(_("De-configuring %s (%s), to allow configuration of %s (%s) 
...\n"),
+             pkg_name(deconpil->pkg, pnaw_nonambig),
+             versiondescribe(&deconpil->pkg->installed.version, vdew_nonambig),
+             pkg_name(pkg, pnaw_nonambig),
+             versiondescribe(&pkg->installed.version, vdew_nonambig));
+    }
 
     trig_activate_packageprocessing(deconpil->pkg);
     pkg_set_status(deconpil->pkg, PKG_STAT_HALFCONFIGURED);
@@ -1221,7 +1230,7 @@ void process_archive(const char *filename) {
 
     if (dpkg_version_compare(&pkg->available.version,
                              &otherpkg->installed.version))
-      enqueue_deconfigure(otherpkg, NULL);
+      enqueue_deconfigure(otherpkg, NULL, PKG_WANT_UNKNOWN);
   }
 
   pkg_check_depcon(pkg, pfilename);

-- 
Dpkg.Org's dpkg

Reply via email to