Item done counters
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:37 +0000 (16:51 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:37 +0000 (16:51 +0000)
Author: jgg
Date: 1998-11-23 07:32:19 GMT
Item done counters

apt-pkg/acquire.cc
apt-pkg/acquire.h
apt-pkg/deb/dpkgpm.cc
cmdline/acqprogress.cc

index 3bd7662..f9691df 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire.cc,v 1.17 1998/11/22 23:37:03 jgg Exp $
+// $Id: acquire.cc,v 1.18 1998/11/23 07:32:19 jgg Exp $
 /* ######################################################################
 
    Acquire - File Acquiration
@@ -612,6 +612,8 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
 {
    TotalBytes = 0;
    CurrentBytes = 0;
+   TotalItems = 0;
+   CurrentItems = 0;
    
    // Compute the total number of bytes to fetch
    unsigned int Unknown = 0;
@@ -619,6 +621,10 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
    for (pkgAcquire::Item **I = Owner->ItemsBegin(); I != Owner->ItemsEnd(); 
        I++, Count++)
    {
+      TotalItems++;
+      if ((*I)->Status == pkgAcquire::Item::StatDone)
+        CurrentItems++;
+      
       // Totally ignore local items
       if ((*I)->Local == true)
         continue;
@@ -685,6 +691,8 @@ void pkgAcquireStatus::Start()
    TotalBytes = 0;
    FetchedBytes = 0;
    ElapsedTime = 0;
+   TotalItems = 0;
+   CurrentItems = 0;
 }
                                                                        /*}}}*/
 // AcquireStatus::Stop - Finished downloading                          /*{{{*/
index acfbb3e..8bdcb8b 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire.h,v 1.13 1998/11/14 01:39:46 jgg Exp $
+// $Id: acquire.h,v 1.14 1998/11/23 07:32:20 jgg Exp $
 /* ######################################################################
 
    Acquire - File Acquiration
@@ -199,6 +199,8 @@ class pkgAcquireStatus
    unsigned long TotalBytes;
    unsigned long FetchedBytes;
    unsigned long ElapsedTime;
+   unsigned long TotalItems;
+   unsigned long CurrentItems;
    
    public:
 
index e437ad7..228e45c 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: dpkgpm.cc,v 1.3 1998/11/23 07:03:11 jgg Exp $
+// $Id: dpkgpm.cc,v 1.4 1998/11/23 07:32:21 jgg Exp $
 /* ######################################################################
 
    DPKG Package Manager - Provide an interface to dpkg
@@ -193,7 +193,7 @@ bool pkgDPkgPM::Go()
         /* No Job Control Stop Env is a magic dpkg var that prevents it
            from using sigstop */
         setenv("DPKG_NO_TSTP","yes",1);
-        execvp("dpkg",(char **)Args);
+        execvp(Args[0],(char **)Args);
         cerr << "Could not exec dpkg!" << endl;
         exit(100);
       }      
index ccc3220..194d3bb 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acqprogress.cc,v 1.2 1998/11/12 05:30:07 jgg Exp $
+// $Id: acqprogress.cc,v 1.3 1998/11/23 07:32:24 jgg Exp $
 /* ######################################################################
 
    Acquire Progress - Command line progress meter 
@@ -136,8 +136,9 @@ void AcqTextStatus::Pulse(pkgAcquire *Owner)
    char *S = Buffer;
    
    // Put in the percent done
-   sprintf(S,"%ld%%",long(double(CurrentBytes*100.0)/double(TotalBytes)));   
-   
+   sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+
+   bool Shown = false;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
        I = Owner->WorkerStep(I))
    {
@@ -151,6 +152,8 @@ void AcqTextStatus::Pulse(pkgAcquire *Owner)
         continue;
       }
 
+      Shown = true;
+      
       // Add in the short description
       if (I->CurrentItem->Owner->ID != 0)
         snprintf(S,End-S," [%x %s",I->CurrentItem->Owner->ID,
@@ -190,6 +193,10 @@ void AcqTextStatus::Pulse(pkgAcquire *Owner)
       snprintf(S,End-S,"]");
    }
 
+   // Show something..
+   if (Shown == false)
+      snprintf(S,End-S," [Working]");
+      
    // Put in the ETA and cps meter
    if (CurrentCPS != 0)
    {