From d568ed2d3ba5d7d05e4381ee59468a124309f152 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:51:37 +0000 Subject: [PATCH] Item done counters Author: jgg Date: 1998-11-23 07:32:19 GMT Item done counters --- apt-pkg/acquire.cc | 10 +++++++++- apt-pkg/acquire.h | 4 +++- apt-pkg/deb/dpkgpm.cc | 4 ++-- cmdline/acqprogress.cc | 13 ++++++++++--- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 3bd7662fd..f9691df9c 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -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 /*{{{*/ diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index acfbb3ead..8bdcb8bb2 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -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: diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index e437ad7a3..228e45c48 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -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); } diff --git a/cmdline/acqprogress.cc b/cmdline/acqprogress.cc index ccc322084..194d3bb56 100644 --- a/cmdline/acqprogress.cc +++ b/cmdline/acqprogress.cc @@ -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) { -- 2.45.2