Modify eu-strip option to perform strip in post script of rpm package & add option...
[platform/upstream/rpm.git] / lib / rpminstall.c
index d3cf449..a3623fd 100644 (file)
@@ -33,7 +33,7 @@ static void printHash(const rpm_loff_t amount, const rpm_loff_t total)
 {
     int hashesNeeded;
 
-    rpmcliHashesTotal = (isatty (STDOUT_FILENO) ? 44 : 50);
+    rpmcliHashesTotal = (isatty (STDOUT_FILENO) ? 34 : 40);
 
     if (rpmcliHashesCurrent != rpmcliHashesTotal) {
        float pct = (total ? (((float) amount) / total) : 1.0);
@@ -149,17 +149,16 @@ 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:%-23.23s", rpmcliProgressCurrent + 1, s);
+               fprintf(stdout, "%4d:%-33.33s", rpmcliProgressCurrent + 1, s);
            else
-               fprintf(stdout, "%-28.28s", s);
+               fprintf(stdout, "%-38.38s", s);
            (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);
@@ -190,7 +189,7 @@ void * rpmShowProgress(const void * arg,
        if (!(flags & INSTALL_LABEL))
            break;
        if (flags & INSTALL_HASH)
-           fprintf(stdout, "%-28s", _("Preparing..."));
+           fprintf(stdout, "%-38s", _("Preparing..."));
        else
            fprintf(stdout, "%s\n", _("Preparing packages..."));
        (void) fflush(stdout);
@@ -647,17 +646,10 @@ int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv)
 
     qfmt = rpmExpand("%{?_query_all_fmt}\n", NULL);
     for (arg = argv; *arg; arg++) {
-       rpmdbMatchIterator mi;
-       int matches = 0;
+       rpmdbMatchIterator mi = rpmtsInitIterator(ts, RPMDBI_LABEL, *arg, 0);
+       int matches = rpmdbGetIteratorCount(mi);
        int erasing = 1;
 
-       /* Iterator count isn't reliable with labels, count manually... */
-       mi = rpmtsInitIterator(ts, RPMDBI_LABEL, *arg, 0);
-       while (rpmdbNextIterator(mi) != NULL) {
-           matches++;
-       }
-       rpmdbFreeIterator(mi);
-
        if (! matches) {
            rpmlog(RPMLOG_ERR, _("package %s is not installed\n"), *arg);
            numFailed++;
@@ -672,7 +664,6 @@ int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv)
                erasing = 0;
            }
 
-           mi = rpmtsInitIterator(ts, RPMDBI_LABEL, *arg, 0);
            while ((h = rpmdbNextIterator(mi)) != NULL) {
                if (erasing) {
                    (void) rpmtsAddEraseElement(ts, h, -1);
@@ -683,8 +674,8 @@ int rpmErase(rpmts ts, struct rpmInstallArguments_s * ia, ARGV_const_t argv)
                    free(nevra);
                }
            }
-           rpmdbFreeIterator(mi);
        }
+       rpmdbFreeIterator(mi);
     }
     free(qfmt);