Include more package information in the progress output
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 19 Mar 2012 06:43:58 +0000 (08:43 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Mon, 19 Mar 2012 06:53:24 +0000 (08:53 +0200)
- For non-hashed mode, dump the full NEVRA string. This might break
  programs that are parsing the --percent format, but such programs
  almost certainly need adjusting for the added erasure progress anyway.
- For hashed mode, show package NEVR instead of just name. Otherwise
  somebody will sooner or later file a bug on "confusing output"
  as it might seem it's removing what it just installed in upgrade-mode.
  Full NEVRA would be better still but screen estate is tight as it is...
- Also get rid of headerFormat() call here, use RPMTAG_NEVR(A) extensions
  instead.

lib/rpminstall.c

index cf7450c..41e796a 100644 (file)
@@ -149,9 +149,8 @@ void * rpmShowProgress(const void * arg,
        rpmcliHashesCurrent = 0;
        if (h == NULL || !(flags & INSTALL_LABEL))
            break;
-       /* @todo Remove headerFormat() on a progress callback. */
        if (flags & INSTALL_HASH) {
-           char *s = headerFormat(h, "%{NAME}", NULL);
+           char *s = headerGetAsString(h, RPMTAG_NEVR);
            if (isatty (STDOUT_FILENO))
                fprintf(stdout, "%4d:%-33.33s", rpmcliProgressCurrent + 1, s);
            else
@@ -159,7 +158,7 @@ void * rpmShowProgress(const void * arg,
            (void) fflush(stdout);
            free(s);
        } else {
-           char *s = headerFormat(h, "%{NAME}-%{VERSION}-%{RELEASE}", NULL);
+           char *s = headerGetAsString(h, RPMTAG_NEVRA);
            fprintf(stdout, "%s\n", s);
            (void) fflush(stdout);
            free(s);