Explorar el Código

dpkg: Improve “Preparing to replace” and “Unpacking” messages

Unifies the output, makes it symmetric in case of upgrade or new install
by always printing two messages, properly shows from what version we
are upgrading to which one, and some cases of cross-grading.

Closes: #32427, #71106
Guillem Jover hace 15 años
padre
commit
23cd7bf437
Se han modificado 2 ficheros con 16 adiciones y 8 borrados
  1. 2 0
      debian/changelog
  2. 14 8
      src/unpack.c

+ 2 - 0
debian/changelog

@@ -51,6 +51,8 @@ dpkg (1.17.2) UNRELEASED; urgency=low
     installed files. Add a --verify-format option to excplicitly select the
     output format, currently only rpm compatible output is supported, but
     the default might change in the future. Closes: #187019
+  * Improve dpkg “Preparing to replace” and “Unpacking” progress messages.
+    Closes: #32427, #71106
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 14 - 8
src/unpack.c

@@ -599,15 +599,11 @@ void process_archive(const char *filename) {
   filesdbinit();
   trig_file_interests_ensure();
 
+  printf(_("Preparing to unpack %s ...\n"), pfilename);
+
   if (pkg->status != stat_notinstalled && pkg->status != stat_configfiles) {
-    printf(_("Preparing to replace %s %s (using %s) ...\n"),
-           pkg_name(pkg, pnaw_nonambig),
-           versiondescribe(&pkg->installed.version,vdew_nonambig),
-           pfilename);
     log_action("upgrade", pkg, &pkg->installed);
   } else {
-    printf(_("Unpacking %s (from %s) ...\n"),
-           pkgbin_name(pkg, &pkg->available, pnaw_nonambig), pfilename);
     log_action("install", pkg, &pkg->available);
   }
 
@@ -823,8 +819,18 @@ void process_archive(const char *filename) {
                           "upgrade", versiondescribe(&pkg->installed.version,
                                                      vdew_nonambig),
                           NULL);
-    printf(_("Unpacking replacement %.250s ...\n"),
-           pkgbin_name(pkg, &pkg->available, pnaw_nonambig));
+  }
+
+  if (oldversionstatus == stat_notinstalled ||
+      oldversionstatus == stat_configfiles) {
+    printf(_("Unpacking %s (%s) ...\n"),
+           pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
+           versiondescribe(&pkg->available.version, vdew_nonambig));
+  } else {
+    printf(_("Unpacking %s (%s) over (%s) ...\n"),
+           pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
+           versiondescribe(&pkg->available.version, vdew_nonambig),
+           versiondescribe(&pkg->installed.version, vdew_nonambig));
   }
 
   /*