Просмотр исходного кода

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 лет назад: 15
Родитель
Сommit
23cd7bf437
2 измененных файлов с 16 добавлено и 8 удалено
  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
     installed files. Add a --verify-format option to excplicitly select the
     output format, currently only rpm compatible output is supported, but
     output format, currently only rpm compatible output is supported, but
     the default might change in the future. Closes: #187019
     the default might change in the future. Closes: #187019
+  * Improve dpkg “Preparing to replace” and “Unpacking” progress messages.
+    Closes: #32427, #71106
 
 
   [ Updated programs translations ]
   [ Updated programs translations ]
   * German (Sven Joachim).
   * German (Sven Joachim).

+ 14 - 8
src/unpack.c

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