Kaynağa Gözat

Item done counters
Author: jgg
Date: 1998-11-23 07:32:19 GMT
Item done counters

Arch Librarian 22 yıl önce
ebeveyn
işleme
d568ed2d3b
4 değiştirilmiş dosya ile 24 ekleme ve 7 silme
  1. 9 1
      apt-pkg/acquire.cc
  2. 3 1
      apt-pkg/acquire.h
  3. 2 2
      apt-pkg/deb/dpkgpm.cc
  4. 10 3
      cmdline/acqprogress.cc

+ 9 - 1
apt-pkg/acquire.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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
    Acquire - File Acquiration
@@ -612,6 +612,8 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
 {
 {
    TotalBytes = 0;
    TotalBytes = 0;
    CurrentBytes = 0;
    CurrentBytes = 0;
+   TotalItems = 0;
+   CurrentItems = 0;
    
    
    // Compute the total number of bytes to fetch
    // Compute the total number of bytes to fetch
    unsigned int Unknown = 0;
    unsigned int Unknown = 0;
@@ -619,6 +621,10 @@ void pkgAcquireStatus::Pulse(pkgAcquire *Owner)
    for (pkgAcquire::Item **I = Owner->ItemsBegin(); I != Owner->ItemsEnd(); 
    for (pkgAcquire::Item **I = Owner->ItemsBegin(); I != Owner->ItemsEnd(); 
 	I++, Count++)
 	I++, Count++)
    {
    {
+      TotalItems++;
+      if ((*I)->Status == pkgAcquire::Item::StatDone)
+	 CurrentItems++;
+      
       // Totally ignore local items
       // Totally ignore local items
       if ((*I)->Local == true)
       if ((*I)->Local == true)
 	 continue;
 	 continue;
@@ -685,6 +691,8 @@ void pkgAcquireStatus::Start()
    TotalBytes = 0;
    TotalBytes = 0;
    FetchedBytes = 0;
    FetchedBytes = 0;
    ElapsedTime = 0;
    ElapsedTime = 0;
+   TotalItems = 0;
+   CurrentItems = 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // AcquireStatus::Stop - Finished downloading				/*{{{*/
 // AcquireStatus::Stop - Finished downloading				/*{{{*/

+ 3 - 1
apt-pkg/acquire.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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
    Acquire - File Acquiration
@@ -199,6 +199,8 @@ class pkgAcquireStatus
    unsigned long TotalBytes;
    unsigned long TotalBytes;
    unsigned long FetchedBytes;
    unsigned long FetchedBytes;
    unsigned long ElapsedTime;
    unsigned long ElapsedTime;
+   unsigned long TotalItems;
+   unsigned long CurrentItems;
    
    
    public:
    public:
 
 

+ 2 - 2
apt-pkg/deb/dpkgpm.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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
    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
 	 /* No Job Control Stop Env is a magic dpkg var that prevents it
 	    from using sigstop */
 	    from using sigstop */
 	 setenv("DPKG_NO_TSTP","yes",1);
 	 setenv("DPKG_NO_TSTP","yes",1);
-	 execvp("dpkg",(char **)Args);
+	 execvp(Args[0],(char **)Args);
 	 cerr << "Could not exec dpkg!" << endl;
 	 cerr << "Could not exec dpkg!" << endl;
 	 exit(100);
 	 exit(100);
       }      
       }      

+ 10 - 3
cmdline/acqprogress.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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 
    Acquire Progress - Command line progress meter 
@@ -136,8 +136,9 @@ void AcqTextStatus::Pulse(pkgAcquire *Owner)
    char *S = Buffer;
    char *S = Buffer;
    
    
    // Put in the percent done
    // 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;
    for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
 	I = Owner->WorkerStep(I))
 	I = Owner->WorkerStep(I))
    {
    {
@@ -151,6 +152,8 @@ void AcqTextStatus::Pulse(pkgAcquire *Owner)
 	 continue;
 	 continue;
       }
       }
 
 
+      Shown = true;
+      
       // Add in the short description
       // Add in the short description
       if (I->CurrentItem->Owner->ID != 0)
       if (I->CurrentItem->Owner->ID != 0)
 	 snprintf(S,End-S," [%x %s",I->CurrentItem->Owner->ID,
 	 snprintf(S,End-S," [%x %s",I->CurrentItem->Owner->ID,
@@ -190,6 +193,10 @@ void AcqTextStatus::Pulse(pkgAcquire *Owner)
       snprintf(S,End-S,"]");
       snprintf(S,End-S,"]");
    }
    }
 
 
+   // Show something..
+   if (Shown == false)
+      snprintf(S,End-S," [Working]");
+      
    // Put in the ETA and cps meter
    // Put in the ETA and cps meter
    if (CurrentCPS != 0)
    if (CurrentCPS != 0)
    {      
    {