- always use our own progress meter with internal pm
authorpmatilai <pmatilai>
Thu, 25 May 2006 13:14:44 +0000 (13:14 +0000)
committerpmatilai <pmatilai>
Thu, 25 May 2006 13:14:44 +0000 (13:14 +0000)
- show arch for packages in progress (to clarify multilib situations)

apt-pkg/rpm/rpmpm.cc
apt-pkg/rpm/rpmshowprogress.h

index 13b0131..5df695b 100644 (file)
@@ -36,7 +36,6 @@
 
 #if RPM_VERSION >= 0x040100
 #include <rpm/rpmdb.h>
-#define packagesTotal rpmcliPackagesTotal 
 #else
 #define rpmpsPrint(a,b) rpmProblemSetPrint(a,b)
 #define rpmpsFree(a) rpmProblemSetFree(a)
@@ -44,9 +43,9 @@
 #if RPM_VERSION < 0x040000
 #define rpmtransFlags int
 #define rpmprobFilterFlags int
-#include "rpmshowprogress.h"
 #endif
 #endif
+#include "rpmshowprogress.h"
 
 // RPMPM::pkgRPMPM - Constructor                                       /*{{{*/
 // ---------------------------------------------------------------------
@@ -874,11 +873,11 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
    probFilter |= rpmtsFilterFlags(TS);
    rpmtsSetFlags(TS, (rpmtransFlags)(rpmtsFlags(TS) | tsFlags));
    rpmtsClean(TS);
-   rc = rpmtsSetNotifyCallback(TS, rpmShowProgress, (void *)notifyFlags);
+   rc = rpmtsSetNotifyCallback(TS, rpmpmShowProgress, (void *)notifyFlags);
    rc = rpmtsRun(TS, NULL, (rpmprobFilterFlags)probFilter);
    probs = rpmtsProblems(TS);
 #else
-   rc = rpmRunTransactions(TS, rpmShowProgress, (void *)notifyFlags, NULL,
+   rc = rpmRunTransactions(TS, rpmpmShowProgress, (void *)notifyFlags, NULL,
                            &probs, (rpmtransFlags)tsFlags,
                           (rpmprobFilterFlags)probFilter);
 #endif
index ddc26a6..41dd3fa 100644 (file)
@@ -46,12 +46,20 @@ static void printHash(const unsigned long amount, const unsigned long total)
     }
 }
 
-void * rpmShowProgress(const Header h,
+#if RPM_VERSION < 0x040000
+void * rpmpmShowProgress(const Header h,
+#else
+void * rpmpmShowProgress(const void * arg, 
+#endif
                        const rpmCallbackType what,
                        const unsigned long amount,
                        const unsigned long total,
                        const void * pkgKey, void * data)
 {
+#if RPM_VERSION >= 0x040000
+    Header h = (Header) arg;
+#endif
+
     char * s;
     int flags = (int) ((long)data);
     void * rc = NULL;
@@ -81,7 +89,7 @@ void * rpmShowProgress(const Header h,
        if (h == NULL || !(flags & INSTALL_LABEL))
            break;
        if (flags & INSTALL_HASH) {
-           s = headerSprintf(h, "%{NAME}",
+           s = headerSprintf(h, "%{NAME}.%{ARCH}",
                                rpmTagTable, rpmHeaderFormats, NULL);
            if (isatty (STDOUT_FILENO))
                fprintf(stdout, "%4d:%-23.23s", progressCurrent + 1, s);
@@ -91,7 +99,7 @@ void * rpmShowProgress(const Header h,
            free(s);
            s = NULL;
        } else {
-           s = headerSprintf(h, "%{NAME}-%{VERSION}-%{RELEASE}",
+           s = headerSprintf(h, "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}",
                                  rpmTagTable, rpmHeaderFormats, NULL);
            fprintf(stdout, "%s\n", s);
            (void) fflush(stdout);