Browse Source

More progress updates
Author: jgg
Date: 1998-08-26 04:52:23 GMT
More progress updates

Arch Librarian 22 years ago
parent
commit
8ce4327bc0

+ 13 - 1
apt-pkg/contrib/fileutl.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: fileutl.cc,v 1.6 1998/07/19 04:42:12 jgg Exp $
+// $Id: fileutl.cc,v 1.7 1998/08/26 04:52:26 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    File Utilities
    File Utilities
@@ -107,6 +107,18 @@ string SafeGetCWD()
    return S;
    return S;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// flNotDir - Strip the directory from the filename			/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string flNotDir(string File)
+{
+   string::size_type Res = File.rfind('/');
+   if (Res == string::npos)
+      return File;
+   Res++;
+   return string(File,Res,Res - File.length());
+}
+									/*}}}*/
 
 
 // FileFd::FileFd - Open a file						/*{{{*/
 // FileFd::FileFd - Open a file						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------

+ 4 - 1
apt-pkg/contrib/fileutl.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: fileutl.h,v 1.4 1998/07/19 04:42:13 jgg Exp $
+// $Id: fileutl.h,v 1.5 1998/08/26 04:52:27 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    File Utilities
    File Utilities
@@ -64,4 +64,7 @@ int GetLock(string File,bool Errors = true);
 bool FileExists(string File);
 bool FileExists(string File);
 string SafeGetCWD();
 string SafeGetCWD();
 
 
+// File string manipulators
+string flNotDir(string File);
+
 #endif
 #endif

+ 11 - 1
apt-pkg/contrib/progress.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: progress.cc,v 1.5 1998/08/23 03:52:22 jgg Exp $
+// $Id: progress.cc,v 1.6 1998/08/26 04:52:28 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    OpProgress - Operation Progress
    OpProgress - Operation Progress
@@ -60,6 +60,16 @@ void OpProgress::SubProgress(unsigned long SubTotal,string Op)
    Update();
    Update();
 }
 }
 									/*}}}*/
 									/*}}}*/
+// OpProgress::SubProgress - Set the sub progress state			/*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void OpProgress::SubProgress(unsigned long SubTotal)
+{
+   this->SubTotal = SubTotal;
+   Percent = Current*100.0/Total;
+   Update();
+}
+									/*}}}*/
 // OpProgress::CheckChange - See if the display should be updated	/*{{{*/
 // OpProgress::CheckChange - See if the display should be updated	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Progress calls are made so frequently that if every one resulted in 
 /* Progress calls are made so frequently that if every one resulted in 

+ 2 - 1
apt-pkg/contrib/progress.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: progress.h,v 1.2 1998/08/23 03:52:23 jgg Exp $
+// $Id: progress.h,v 1.3 1998/08/26 04:52:29 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    OpProgress - Operation Progress
    OpProgress - Operation Progress
@@ -56,6 +56,7 @@ class OpProgress
    public:
    public:
    
    
    void Progress(unsigned long Current);
    void Progress(unsigned long Current);
+   void SubProgress(unsigned long SubTotal);
    void SubProgress(unsigned long SubTotal,string Op);
    void SubProgress(unsigned long SubTotal,string Op);
    void OverallProgress(unsigned long Current,unsigned long Total,
    void OverallProgress(unsigned long Current,unsigned long Total,
 			unsigned long Size,string Op);
 			unsigned long Size,string Op);

+ 14 - 7
apt-pkg/pkgcachegen.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: pkgcachegen.cc,v 1.13 1998/07/26 04:49:31 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.14 1998/08/26 04:52:23 jgg Exp $
 /* ######################################################################
 /* ######################################################################
    
    
    Package Cache Generator - Generator for the cache structure.
    Package Cache Generator - Generator for the cache structure.
@@ -78,7 +78,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List)
       if (NewPackage(Pkg,PackageName) == false)
       if (NewPackage(Pkg,PackageName) == false)
 	 return _error->Error("Error occured while processing %s (NewPackage)",PackageName.c_str());
 	 return _error->Error("Error occured while processing %s (NewPackage)",PackageName.c_str());
       Progress.Progress(List.Offset());
       Progress.Progress(List.Offset());
-      
+
       /* Get a pointer to the version structure. We know the list is sorted
       /* Get a pointer to the version structure. We know the list is sorted
          so we use that fact in the search. Insertion of new versions is
          so we use that fact in the search. Insertion of new versions is
 	 done with correct sorting */
 	 done with correct sorting */
@@ -327,7 +327,7 @@ bool pkgCacheGenerator::SelectFile(string File,unsigned long Flags)
    if (CurrentFile->FileName == 0)
    if (CurrentFile->FileName == 0)
       return false;
       return false;
    
    
-   Progress.SubProgress(Buf.st_size,File);
+   Progress.SubProgress(Buf.st_size);
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -519,16 +519,18 @@ static bool pkgMergeStatus(OpProgress &Progress,pkgCacheGenerator &Gen,
 	 
 	 
       FileFd Pkg(File,FileFd::ReadOnly);
       FileFd Pkg(File,FileFd::ReadOnly);
       debListParser Parser(Pkg);
       debListParser Parser(Pkg);
-      Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Generating cache");
+      Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Reading Package Lists");
       if (_error->PendingError() == true)
       if (_error->PendingError() == true)
 	 return _error->Error("Problem opening %s",File.c_str());
 	 return _error->Error("Problem opening %s",File.c_str());
       CurrentSize += Pkg.Size();
       CurrentSize += Pkg.Size();
-      
+
+      Progress.SubProgress(0,"Local Package State - " + flNotDir(File));
       if (Gen.SelectFile(File,pkgCache::Flag::NotSource) == false)
       if (Gen.SelectFile(File,pkgCache::Flag::NotSource) == false)
 	 return _error->Error("Problem with SelectFile %s",File.c_str());
 	 return _error->Error("Problem with SelectFile %s",File.c_str());
       
       
       if (Gen.MergeList(Parser) == false)
       if (Gen.MergeList(Parser) == false)
 	 return _error->Error("Problem with MergeList %s",File.c_str());
 	 return _error->Error("Problem with MergeList %s",File.c_str());
+      Progress.Progress(Pkg.Size());
    }
    }
    
    
    return true;
    return true;
@@ -540,6 +542,8 @@ static bool pkgMergeStatus(OpProgress &Progress,pkgCacheGenerator &Gen,
    xstatus files into it. */
    xstatus files into it. */
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
 {
 {
+   Progress.OverallProgress(0,1,1,"Reading Package Lists");
+   
    string CacheFile = _config->FindDir("Dir::Cache::pkgcache");
    string CacheFile = _config->FindDir("Dir::Cache::pkgcache");
    bool SrcOk = pkgSrcCacheCheck(List);
    bool SrcOk = pkgSrcCacheCheck(List);
    bool PkgOk = pkgPkgCacheCheck(CacheFile);
    bool PkgOk = pkgPkgCacheCheck(CacheFile);
@@ -579,11 +583,12 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
 	 string File = ListDir + URItoFileName(I->PackagesURI());
 	 string File = ListDir + URItoFileName(I->PackagesURI());
 	 FileFd Pkg(File,FileFd::ReadOnly);
 	 FileFd Pkg(File,FileFd::ReadOnly);
 	 debListParser Parser(Pkg);
 	 debListParser Parser(Pkg);
-	 Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Generating cache");
+	 Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Reading Package Lists");
 	 if (_error->PendingError() == true)
 	 if (_error->PendingError() == true)
 	    return _error->Error("Problem opening %s",File.c_str());
 	    return _error->Error("Problem opening %s",File.c_str());
 	 CurrentSize += Pkg.Size();
 	 CurrentSize += Pkg.Size();
 
 
+	 Progress.SubProgress(0,I->PackagesInfo());
 	 if (Gen.SelectFile(File) == false)
 	 if (Gen.SelectFile(File) == false)
 	    return _error->Error("Problem with SelectFile %s",File.c_str());
 	    return _error->Error("Problem with SelectFile %s",File.c_str());
 	 
 	 
@@ -602,7 +607,10 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
    }
    }
 
 
    if (PkgOk == true)
    if (PkgOk == true)
+   {
+      Progress.OverallProgress(1,1,1,"Reading Package Lists");      
       return true;
       return true;
+   }
    
    
    // We use the source cache to generate the package cache
    // We use the source cache to generate the package cache
    string SCacheFile = _config->FindDir("Dir::Cache::srcpkgcache");
    string SCacheFile = _config->FindDir("Dir::Cache::srcpkgcache");
@@ -629,4 +637,3 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
    return pkgMergeStatus(Progress,Gen,CurrentSize,TotalSize);
    return pkgMergeStatus(Progress,Gen,CurrentSize,TotalSize);
 }
 }
 									/*}}}*/
 									/*}}}*/
-

+ 2 - 2
apt-pkg/tagfile.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: tagfile.h,v 1.8 1998/07/19 21:24:17 jgg Exp $
+// $Id: tagfile.h,v 1.9 1998/08/26 04:52:24 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Fast scanner for RFC-822 type header information
    Fast scanner for RFC-822 type header information
@@ -65,7 +65,7 @@ class pkgTagFile
    bool Step(pkgTagSection &Section);
    bool Step(pkgTagSection &Section);
    inline unsigned long Offset() {return iOffset;};
    inline unsigned long Offset() {return iOffset;};
    bool Jump(pkgTagSection &Tag,unsigned long Offset);
    bool Jump(pkgTagSection &Tag,unsigned long Offset);
-      
+   
    pkgTagFile(FileFd &F,unsigned long Size = 32*1024);
    pkgTagFile(FileFd &F,unsigned long Size = 32*1024);
 };
 };