- beginnings of install progress API
authorPanu Matilainen <pmatilai@turre.koti.laiskiainen.org>
Sat, 24 Feb 2007 13:25:52 +0000 (15:25 +0200)
committerPanu Matilainen <pmatilai@turre.koti.laiskiainen.org>
Sat, 24 Feb 2007 13:25:52 +0000 (15:25 +0200)
12 files changed:
apt-pkg/Makefile.am
apt-pkg/Makefile.in
apt-pkg/contrib/progress.cc
apt-pkg/contrib/progress.h
apt-pkg/packagemanager.cc
apt-pkg/packagemanager.h
apt-pkg/rpm/rpmpm.cc
apt-pkg/rpm/rpmpm.h
apt-pkg/rpm/rpmshowprogress.cc [deleted file]
apt-pkg/rpm/rpmshowprogress.h [deleted file]
cmdline/apt-get.cc
cmdline/apt-shell.cc

index b7a1ef9..d73a9e2 100644 (file)
@@ -44,6 +44,8 @@ libapt_pkg_la_SOURCES = \
        contrib/system.h \
        rpm/repomd.cc \
        rpm/repomd.h \
+       rpm/rpmcallback.h \
+       rpm/rpmcallback.cc \
        rpm/rpmhandler.cc \
        rpm/rpmhandler.h \
        rpm/rpmindexfile.cc \
@@ -55,8 +57,6 @@ libapt_pkg_la_SOURCES = \
        rpm/rpmpackagedata.h \
        rpm/rpmpm.cc \
        rpm/rpmpm.h \
-       rpm/rpmshowprogress.h \
-       rpm/rpmshowprogress.cc \
        rpm/rpmrecords.cc \
        rpm/rpmrecords.h \
        rpm/rpmsrcrecords.cc \
index 831710b..256e25e 100644 (file)
@@ -71,8 +71,8 @@ am_libapt_pkg_la_OBJECTS = contrib/cdromutl.lo contrib/cmndline.lo \
        contrib/fileutl.lo contrib/hashes.lo contrib/md5.lo \
        contrib/mmap.lo contrib/progress.lo contrib/sha1.lo \
        contrib/sqlite.lo contrib/strutl.lo rpm/repomd.lo \
-       rpm/rpmhandler.lo rpm/rpmindexfile.lo rpm/rpmlistparser.lo \
-       rpm/rpmpackagedata.lo rpm/rpmpm.lo rpm/rpmshowprogress.lo \
+       rpm/rpmcallback.lo rpm/rpmhandler.lo rpm/rpmindexfile.lo \
+       rpm/rpmlistparser.lo rpm/rpmpackagedata.lo rpm/rpmpm.lo \
        rpm/rpmrecords.lo rpm/rpmsrcrecords.lo rpm/rpmsystem.lo \
        rpm/rpmversion.lo acquire.lo acquire-item.lo acquire-method.lo \
        acquire-worker.lo algorithms.lo cachefile.lo clean.lo \
@@ -281,6 +281,8 @@ libapt_pkg_la_SOURCES = \
        contrib/system.h \
        rpm/repomd.cc \
        rpm/repomd.h \
+       rpm/rpmcallback.h \
+       rpm/rpmcallback.cc \
        rpm/rpmhandler.cc \
        rpm/rpmhandler.h \
        rpm/rpmindexfile.cc \
@@ -292,8 +294,6 @@ libapt_pkg_la_SOURCES = \
        rpm/rpmpackagedata.h \
        rpm/rpmpm.cc \
        rpm/rpmpm.h \
-       rpm/rpmshowprogress.h \
-       rpm/rpmshowprogress.cc \
        rpm/rpmrecords.cc \
        rpm/rpmrecords.h \
        rpm/rpmsrcrecords.cc \
@@ -475,6 +475,7 @@ rpm/$(DEPDIR)/$(am__dirstamp):
        @$(mkdir_p) rpm/$(DEPDIR)
        @: > rpm/$(DEPDIR)/$(am__dirstamp)
 rpm/repomd.lo: rpm/$(am__dirstamp) rpm/$(DEPDIR)/$(am__dirstamp)
+rpm/rpmcallback.lo: rpm/$(am__dirstamp) rpm/$(DEPDIR)/$(am__dirstamp)
 rpm/rpmhandler.lo: rpm/$(am__dirstamp) rpm/$(DEPDIR)/$(am__dirstamp)
 rpm/rpmindexfile.lo: rpm/$(am__dirstamp) rpm/$(DEPDIR)/$(am__dirstamp)
 rpm/rpmlistparser.lo: rpm/$(am__dirstamp) \
@@ -482,8 +483,6 @@ rpm/rpmlistparser.lo: rpm/$(am__dirstamp) \
 rpm/rpmpackagedata.lo: rpm/$(am__dirstamp) \
        rpm/$(DEPDIR)/$(am__dirstamp)
 rpm/rpmpm.lo: rpm/$(am__dirstamp) rpm/$(DEPDIR)/$(am__dirstamp)
-rpm/rpmshowprogress.lo: rpm/$(am__dirstamp) \
-       rpm/$(DEPDIR)/$(am__dirstamp)
 rpm/rpmrecords.lo: rpm/$(am__dirstamp) rpm/$(DEPDIR)/$(am__dirstamp)
 rpm/rpmsrcrecords.lo: rpm/$(am__dirstamp) \
        rpm/$(DEPDIR)/$(am__dirstamp)
@@ -522,6 +521,8 @@ mostlyclean-compile:
        -rm -f contrib/strutl.lo
        -rm -f rpm/repomd.$(OBJEXT)
        -rm -f rpm/repomd.lo
+       -rm -f rpm/rpmcallback.$(OBJEXT)
+       -rm -f rpm/rpmcallback.lo
        -rm -f rpm/rpmhandler.$(OBJEXT)
        -rm -f rpm/rpmhandler.lo
        -rm -f rpm/rpmindexfile.$(OBJEXT)
@@ -534,8 +535,6 @@ mostlyclean-compile:
        -rm -f rpm/rpmpm.lo
        -rm -f rpm/rpmrecords.$(OBJEXT)
        -rm -f rpm/rpmrecords.lo
-       -rm -f rpm/rpmshowprogress.$(OBJEXT)
-       -rm -f rpm/rpmshowprogress.lo
        -rm -f rpm/rpmsrcrecords.$(OBJEXT)
        -rm -f rpm/rpmsrcrecords.lo
        -rm -f rpm/rpmsystem.$(OBJEXT)
@@ -584,13 +583,13 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@contrib/$(DEPDIR)/sqlite.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@contrib/$(DEPDIR)/strutl.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/repomd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmcallback.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmhandler.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmindexfile.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmlistparser.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmpackagedata.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmpm.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmrecords.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmshowprogress.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmsrcrecords.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmsystem.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@rpm/$(DEPDIR)/rpmversion.Plo@am__quote@
index 65482e8..43b7c80 100644 (file)
@@ -218,3 +218,88 @@ void OpTextProgress::Write(const char *S)
    LastLen = strlen(S);
 }
                                                                        /*}}}*/
+
+InstTextProgress::InstTextProgress(Configuration &Config) : 
+                               InstProgress(Config),
+                                       NoUpdate(false), NoDisplay(false), LastLen(0) 
+{
+}
+
+void InstTextProgress::Done()
+{
+   if (NoUpdate == false && OldOp.empty() == false)
+   {
+      char S[300];
+      if (_error->PendingError() == true)
+        snprintf(S,sizeof(S),_("%c%s... Error!"),'\r',OldOp.c_str());
+      else
+        snprintf(S,sizeof(S),_("%c%s... Done"),'\r',OldOp.c_str());
+      Write(S);
+      cout << endl;
+      OldOp = string();
+   }
+   
+   if (NoUpdate == true && NoDisplay == false && OldOp.empty() == false)
+   {
+      OldOp = string();
+      cout << endl;   
+   }   
+}
+                                                                       /*}}}*/
+// OpTextProgress::Update - Simple text spinner                                /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void InstTextProgress::Update()
+{
+   if (CheckChange((NoUpdate == true?0:0.7)) == false)
+      return;
+   
+   // No percent spinner
+   if (NoUpdate == true)
+   {
+      if (MajorChange == false)
+        return;
+      if (NoDisplay == false)
+      {
+        if (OldOp.empty() == false)
+           cout << endl;
+        OldOp = "a";
+        cout << Op << "..." << flush;
+      }
+      
+      return;
+   }
+
+   // Erase the old text and 'log' the event
+   char S[300];
+   if (MajorChange == true && OldOp.empty() == false)
+   {
+      snprintf(S,sizeof(S),"\r%s",OldOp.c_str());
+      Write(S);
+      cout << endl;
+   }
+   
+   // Print the spinner
+   snprintf(S,sizeof(S),"\r%s... %u%%",Op.c_str(),(unsigned int)Percent);
+   Write(S);
+
+   OldOp = Op;
+}
+                                                                       /*}}}*/
+// OpTextProgress::Write - Write the progress string                   /*{{{*/
+// ---------------------------------------------------------------------
+/* This space fills the end to overwrite the previous text */
+void InstTextProgress::Write(const char *S)
+{
+#if 1
+   cout << S;
+   for (unsigned int I = strlen(S); I < LastLen; I++)
+      cout << ' ';
+   cout << '\r' << flush;
+   LastLen = strlen(S);
+#else
+   cout << S << endl << flush;
+   LastLen = strlen(S);
+#endif
+}
+// vim:sts=3:sw=3
index 4798ba0..aad8d39 100644 (file)
@@ -89,4 +89,31 @@ class OpTextProgress : public OpProgress
    virtual ~OpTextProgress() {Done();};
 };
 
+class InstProgress : public OpProgress
+{
+   protected:
+
+   public:
+   InstProgress(Configuration &Config) : OpProgress() {};
+   virtual ~InstProgress() {};
+};
+
+class InstTextProgress : public InstProgress
+{
+   protected:
+   string OldOp;
+   bool NoUpdate;
+   bool NoDisplay;
+   unsigned long LastLen;
+   virtual void Update();
+   void Write(const char *S);
+
+   public:
+   virtual void Done();
+
+   InstTextProgress(Configuration &Config);
+   virtual ~InstTextProgress() {Done();};
+};
 #endif
+
+// vim:sts=3:sw=3
index 72ea97b..83b80ca 100644 (file)
@@ -664,11 +664,11 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
 // ---------------------------------------------------------------------
 /* This uses the filenames in FileNames and the information in the
    DepCache to perform the installation of packages.*/
-pkgPackageManager::OrderResult pkgPackageManager::DoInstall()
+pkgPackageManager::OrderResult pkgPackageManager::DoInstall(InstProgress &Prog)
 {
    OrderResult Res = OrderInstall();
    if (Res != Failed)
-      if (Go() == false)
+      if (Go(Prog) == false)
         return Failed;
    return Res;
 }
index 1099099..42128a6 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <string>
 #include <apt-pkg/pkgcache.h>
+#include <apt-pkg/progress.h>
 
 using std::string;
 
@@ -68,7 +69,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
    virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
    virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
-   virtual bool Go() {return true;};
+   virtual bool Go(InstProgress &Prog) {return true;};
    virtual void Reset() {};
    
    public:
@@ -76,7 +77,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    // Main action members
    bool GetArchives(pkgAcquire *Owner,pkgSourceList *Sources,
                    pkgRecords *Recs);
-   OrderResult DoInstall();
+   OrderResult DoInstall(InstProgress &Prog);
    bool FixMissing();
    
    pkgPackageManager(pkgDepCache *Cache);
index 61044bd..91eeb30 100644 (file)
@@ -45,7 +45,9 @@
 #define rpmprobFilterFlags int
 #endif
 #endif
-#include "rpmshowprogress.h"
+#include "rpmcallback.h"
+
+extern int packagesTotal;
 
 // RPMPM::pkgRPMPM - Constructor                                       /*{{{*/
 // ---------------------------------------------------------------------
@@ -236,7 +238,7 @@ bool pkgRPMPM::RunScriptsWithPkgs(const char *Cnf)
 // RPMPM::Go - Run the sequence                                                /*{{{*/
 // ---------------------------------------------------------------------
 /* This globs the operations and calls rpm */
-bool pkgRPMPM::Go()
+bool pkgRPMPM::Go(InstProgress &Prog)
 {
    if (List.empty() == true)
       return true;
@@ -339,7 +341,7 @@ bool pkgRPMPM::Go()
    }
 #endif
 
-   if (Process(install, upgrade, uninstall) == false)
+   if (Process(Prog, install, upgrade, uninstall) == false)
       Ret = false;
 
 #ifdef APT_WITH_LUA
@@ -638,7 +640,8 @@ bool pkgRPMExtPM::ExecRPM(Item::RPMOps op, vector<const char*> &files)
    return true;
 }
 
-bool pkgRPMExtPM::Process(vector<const char*> &install, 
+bool pkgRPMExtPM::Process(InstProgress &Prog, 
+                      vector<const char*> &install, 
                       vector<const char*> &upgrade,
                       vector<const char*> &uninstall)
 {
@@ -742,7 +745,8 @@ bool pkgRPMLibPM::AddToTransaction(Item::RPMOps op, vector<const char*> &files)
    return true;
 }
 
-bool pkgRPMLibPM::Process(vector<const char*> &install, 
+bool pkgRPMLibPM::Process(InstProgress &Prog,
+                         vector<const char*> &install, 
                          vector<const char*> &upgrade,
                          vector<const char*> &uninstall)
 {
@@ -887,13 +891,12 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
       goto exit;
    }
 
-   cout << _("Committing changes...") << endl << flush;
-
+   Prog.OverallProgress(0, 1, 1, "Committing changes...");
 #if RPM_VERSION >= 0x040100
    probFilter |= rpmtsFilterFlags(TS);
    rpmtsSetFlags(TS, (rpmtransFlags)(rpmtsFlags(TS) | tsFlags));
    rpmtsClean(TS);
-   rc = rpmtsSetNotifyCallback(TS, rpmpmShowProgress, (void *)notifyFlags);
+   rc = rpmtsSetNotifyCallback(TS, rpmCallback, &Prog);
    rc = rpmtsRun(TS, NULL, (rpmprobFilterFlags)probFilter);
    probs = rpmtsProblems(TS);
 #else
@@ -910,8 +913,6 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
       Success = true;
       if (rc < 0)
         _error->Warning(_("Some errors occurred while running transaction"));
-      else if (Interactive == true)
-        cout << _("Done.") << endl;
    }
    rpmpsFree(probs);
 
index 5b1f96e..6206444 100644 (file)
@@ -56,11 +56,12 @@ class pkgRPMPM : public pkgPackageManager
    virtual bool Configure(PkgIterator Pkg);
    virtual bool Remove(PkgIterator Pkg,bool Purge = false);
     
-   virtual bool Process(vector<const char*> &install,
+   virtual bool Process(InstProgress &Prog,
+               vector<const char*> &install,
                vector<const char*> &upgrade,
                vector<const char*> &uninstall) {return false;};
    
-   virtual bool Go();
+   virtual bool Go(InstProgress &Prog);
    virtual void Reset();
    
    public:
@@ -73,7 +74,8 @@ class pkgRPMExtPM : public pkgRPMPM
 {
    protected:
    bool ExecRPM(Item::RPMOps op, vector<const char*> &files);
-   virtual bool Process(vector<const char*> &install,
+   virtual bool Process(InstProgress &Prog,
+               vector<const char*> &install,
                vector<const char*> &upgrade,
                vector<const char*> &uninstall);
 
@@ -94,7 +96,8 @@ class pkgRPMLibPM : public pkgRPMPM
 
    bool ParseRpmOpts(const char *Cnf, int *tsFlags, int *probFilter);
    bool AddToTransaction(Item::RPMOps op, vector<const char*> &files);
-   virtual bool Process(vector<const char*> &install,
+   virtual bool Process(InstProgress &Prog,
+               vector<const char*> &install,
                vector<const char*> &upgrade,
                vector<const char*> &uninstall);
 
diff --git a/apt-pkg/rpm/rpmshowprogress.cc b/apt-pkg/rpm/rpmshowprogress.cc
deleted file mode 100644 (file)
index d3d61eb..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-
-#include <stdio.h>
-#include <rpm/rpmlib.h>
-#include <apti18n.h>
-
-#include "rpmshowprogress.h"
-
-static int hashesTotal = 0;
-static int hashesCurrent = 0;
-static int progressCurrent = 0;
-static int progressTotal = 0;
-
-int packagesTotal;
-
-static void printHash(const unsigned long amount, const unsigned long total)
-{
-    int hashesNeeded;
-
-    hashesTotal = (isatty (STDOUT_FILENO) ? 44 : 50);
-
-    if (hashesCurrent != hashesTotal) {
-       float pct = (total ? (((float) amount) / total) : 1.0);
-       hashesNeeded = (int) ((hashesTotal * pct) + 0.5);
-       while (hashesNeeded > hashesCurrent) {
-           if (isatty (STDOUT_FILENO)) {
-               int i;
-               for (i = 0; i < hashesCurrent; i++)
-                   (void) putchar ('#');
-               for (; i < hashesTotal; i++)
-                   (void) putchar (' ');
-               fprintf(stdout, "(%3d%%)", (int)((100 * pct) + 0.5));
-               for (i = 0; i < (hashesTotal + 6); i++)
-                   (void) putchar ('\b');
-           } else
-               fprintf(stdout, "#");
-
-           hashesCurrent++;
-       }
-       (void) fflush(stdout);
-
-       if (hashesCurrent == hashesTotal) {
-           int i;
-           progressCurrent++;
-           if (isatty(STDOUT_FILENO)) {
-               for (i = 1; i < hashesCurrent; i++)
-                   (void) putchar ('#');
-               pct = (progressTotal
-                   ? (((float) progressCurrent) / progressTotal)
-                   : 1);
-               fprintf(stdout, " [%3d%%]", (int)((100 * pct) + 0.5));
-           }
-           fprintf(stdout, "\n");
-       }
-       (void) fflush(stdout);
-    }
-}
-
-#if RPM_VERSION < 0x040000
-void * rpmpmShowProgress(const Header h,
-#else
-void * rpmpmShowProgress(const void * arg, 
-#endif
-                       const rpmCallbackType what,
-#if RPM_VERSION >= 0x040405
-                       const unsigned long long amount,
-                       const unsigned long long total,
-#else
-                       const unsigned long amount,
-                       const unsigned long total,
-#endif
-                       const void * pkgKey, void * data)
-
-{
-#if RPM_VERSION >= 0x040000
-    Header h = (Header) arg;
-#endif
-
-    char * s;
-    int flags = (int) ((long)data);
-    void * rc = NULL;
-    const char * filename = (const char *) pkgKey;
-    static FD_t fd = NULL;
-    static rpmCallbackType state;
-    static bool repackage;
-
-    switch (what) {
-    case RPMCALLBACK_INST_OPEN_FILE:
-       if (filename == NULL || filename[0] == '\0')
-           return NULL;
-       fd = Fopen(filename, "r.ufdio");
-       if (fd)
-           fd = fdLink(fd, "persist (showProgress)");
-       return fd;
-       /*@notreached@*/ break;
-
-    case RPMCALLBACK_INST_CLOSE_FILE:
-       fd = fdFree(fd, "persist (showProgress)");
-       if (fd) {
-           (void) Fclose(fd);
-           fd = NULL;
-       }
-       break;
-
-    case RPMCALLBACK_INST_START:
-       hashesCurrent = 0;
-       if (h == NULL || !(flags & INSTALL_LABEL))
-           break;
-
-       if (state != what && repackage == false) {
-           state = what;
-           fprintf(stdout, "%s\n", _("Installing / Updating..."));
-           (void) fflush(stdout);
-       }
-
-       if (flags & INSTALL_HASH) {
-           s = headerSprintf(h, "%{NAME}.%{ARCH}",
-                               rpmTagTable, rpmHeaderFormats, NULL);
-           if (isatty (STDOUT_FILENO))
-               fprintf(stdout, "%4d:%-23.23s", progressCurrent + 1, s);
-           else
-               fprintf(stdout, "%-28.28s", s);
-           (void) fflush(stdout);
-           free(s);
-           s = NULL;
-       } else {
-           s = headerSprintf(h, "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}",
-                                 rpmTagTable, rpmHeaderFormats, NULL);
-           fprintf(stdout, "%s\n", s);
-           (void) fflush(stdout);
-           free(s);
-           s = NULL;
-       }
-       break;
-
-    case RPMCALLBACK_TRANS_PROGRESS:
-    case RPMCALLBACK_INST_PROGRESS:
-       if (flags & INSTALL_PERCENT)
-           fprintf(stdout, "%%%% %f\n", (double) (total
-                               ? ((((float) amount) / total) * 100)
-                               : 100.0));
-       else if (flags & INSTALL_HASH)
-           printHash(amount, total);
-       (void) fflush(stdout);
-       break;
-
-    case RPMCALLBACK_TRANS_START:
-       state = what;
-       repackage = false;
-       hashesCurrent = 0;
-       progressTotal = 1;
-       progressCurrent = 0;
-       if (!(flags & INSTALL_LABEL))
-           break;
-       if (flags & INSTALL_HASH)
-           fprintf(stdout, "%-28s", _("Preparing..."));
-       else
-           fprintf(stdout, "%s\n", _("Preparing..."));
-       (void) fflush(stdout);
-       break;
-
-    case RPMCALLBACK_TRANS_STOP:
-       if (flags & INSTALL_HASH)
-           printHash(1, 1);    /* Fixes "preparing..." progress bar */
-       progressTotal = packagesTotal;
-       progressCurrent = 0;
-       break;
-
-    case RPMCALLBACK_REPACKAGE_START:
-        hashesCurrent = 0;
-        progressCurrent = 0;
-        repackage = true;
-        if (!(flags & INSTALL_LABEL))
-            break;
-        if (flags & INSTALL_HASH)
-            fprintf(stdout, "%-28s\n", _("Repackaging..."));
-        else
-            fprintf(stdout, "%s\n", _("Repackaging..."));
-        (void) fflush(stdout);
-        break;
-
-    case RPMCALLBACK_REPACKAGE_PROGRESS:
-        if (amount && (flags & INSTALL_HASH))
-            printHash(1, 1);    /* Fixes "preparing..." progress bar */
-        break;
-
-    case RPMCALLBACK_REPACKAGE_STOP:
-        progressTotal = total;
-        progressCurrent = total;
-        if (flags & INSTALL_HASH)
-            printHash(1, 1);    /* Fixes "preparing..." progress bar */
-        progressTotal = packagesTotal;
-        repackage = false;
-        break;
-
-    case RPMCALLBACK_UNINST_PROGRESS:
-       break;
-    case RPMCALLBACK_UNINST_START:
-       hashesCurrent = 0;
-       if (!(flags & INSTALL_LABEL))
-           break;
-       if (state != what) {
-           state = what;
-           fprintf(stdout, "%s\n", _("Removing / Cleaning up..."));
-           (void) fflush(stdout);
-       }
-       break;
-
-    case RPMCALLBACK_UNINST_STOP:
-       if (h == NULL || !(flags & INSTALL_LABEL))
-           break;
-       s = headerSprintf(h, "%{NAME}.%{ARCH}", rpmTagTable, rpmHeaderFormats, NULL);
-       if (flags & INSTALL_HASH) {
-           fprintf(stdout, "%4d:%-23.23s", progressCurrent + 1, s);
-           printHash(1, 1);
-       } else {
-           fprintf(stdout, "%-28.28s", s);
-       }
-       fflush(stdout);
-       s = NULL;
-       break;
-    default: // Fall through
-        break;
-    }
-    return rc;
-}      
-
diff --git a/apt-pkg/rpm/rpmshowprogress.h b/apt-pkg/rpm/rpmshowprogress.h
deleted file mode 100644 (file)
index 9c33f96..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-
-extern int packagesTotal;
-
-#if RPM_VERSION < 0x040000
-void * rpmpmShowProgress(const Header h,
-#else
-void * rpmpmShowProgress(const void * arg, 
-#endif
-                       const rpmCallbackType what,
-#if RPM_VERSION >= 0x040405
-                        const unsigned long long amount,
-                        const unsigned long long total,
-#else
-                        const unsigned long amount,
-                        const unsigned long total,
-#endif
-                       const void * pkgKey, void * data);
index 7eaa3ec..91c18e9 100644 (file)
@@ -271,7 +271,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
    if (_config->FindB("APT::Get::Simulate") == true)
    {
       pkgSimulate PM(Cache);
-      pkgPackageManager::OrderResult Res = PM.DoInstall();
+      InstTextProgress Prog(*_config);
+      pkgPackageManager::OrderResult Res = PM.DoInstall(Prog);
       if (Res == pkgPackageManager::Failed)
         return false;
       if (Res != pkgPackageManager::Completed)
@@ -513,7 +514,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
            _config->Set("RPM::Install-Options::", "--nodeps");
         }
         _system->UnLock();
-        pkgPackageManager::OrderResult Res = PM->DoInstall();
+        InstTextProgress Prog(*_config);
+        pkgPackageManager::OrderResult Res = PM->DoInstall(Prog);
         if (Res == pkgPackageManager::Failed || _error->PendingError() == true)
         {
            if (Transient == false)
index dfcdb2d..d4ad8fe 100644 (file)
@@ -333,7 +333,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
    if (_config->FindB("APT::Get::Simulate") == true)
    {
       pkgSimulate PM(Cache);
-      pkgPackageManager::OrderResult Res = PM.DoInstall();
+      InstTextProgress Prog(*_config);
+      pkgPackageManager::OrderResult Res = PM.DoInstall(Prog);
       if (Res == pkgPackageManager::Failed)
         return false;
       if (Res != pkgPackageManager::Completed)
@@ -574,7 +575,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
            _config->Set("RPM::Install-Options::", "--nodeps");
         }
         _system->UnLock();
-        pkgPackageManager::OrderResult Res = PM->DoInstall();
+        InstTextProgress Prog(*_config);
+        pkgPackageManager::OrderResult Res = PM->DoInstall(Prog);
         if (Res == pkgPackageManager::Failed || _error->PendingError() == true)
         {
            if (Transient == false)