// -*- mode: cpp; mode: fold -*-
// 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
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 /*{{{*/
// ---------------------------------------------------------------------
// -*- mode: cpp; mode: fold -*-
// 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
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 /*{{{*/
// ---------------------------------------------------------------------
/* Progress calls are made so frequently that if every one resulted in
// -*- mode: cpp; mode: fold -*-
// 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
public:
void Progress(unsigned long Current);
+ void SubProgress(unsigned long SubTotal);
void SubProgress(unsigned long SubTotal,string Op);
void OverallProgress(unsigned long Current,unsigned long Total,
unsigned long Size,string Op);
// -*- mode: cpp; mode: fold -*-
// 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.
if (NewPackage(Pkg,PackageName) == false)
return _error->Error("Error occured while processing %s (NewPackage)",PackageName.c_str());
Progress.Progress(List.Offset());
-
+
/* 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
done with correct sorting */
if (CurrentFile->FileName == 0)
return false;
- Progress.SubProgress(Buf.st_size,File);
+ Progress.SubProgress(Buf.st_size);
return true;
}
/*}}}*/
FileFd Pkg(File,FileFd::ReadOnly);
debListParser Parser(Pkg);
- Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Generating cache");
+ Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Reading Package Lists");
if (_error->PendingError() == true)
return _error->Error("Problem opening %s",File.c_str());
CurrentSize += Pkg.Size();
-
+
+ Progress.SubProgress(0,"Local Package State - " + flNotDir(File));
if (Gen.SelectFile(File,pkgCache::Flag::NotSource) == false)
return _error->Error("Problem with SelectFile %s",File.c_str());
if (Gen.MergeList(Parser) == false)
return _error->Error("Problem with MergeList %s",File.c_str());
+ Progress.Progress(Pkg.Size());
}
return true;
xstatus files into it. */
bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
{
+ Progress.OverallProgress(0,1,1,"Reading Package Lists");
+
string CacheFile = _config->FindDir("Dir::Cache::pkgcache");
bool SrcOk = pkgSrcCacheCheck(List);
bool PkgOk = pkgPkgCacheCheck(CacheFile);
string File = ListDir + URItoFileName(I->PackagesURI());
FileFd Pkg(File,FileFd::ReadOnly);
debListParser Parser(Pkg);
- Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Generating cache");
+ Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Reading Package Lists");
if (_error->PendingError() == true)
return _error->Error("Problem opening %s",File.c_str());
CurrentSize += Pkg.Size();
+ Progress.SubProgress(0,I->PackagesInfo());
if (Gen.SelectFile(File) == false)
return _error->Error("Problem with SelectFile %s",File.c_str());
}
if (PkgOk == true)
+ {
+ Progress.OverallProgress(1,1,1,"Reading Package Lists");
return true;
+ }
// We use the source cache to generate the package cache
string SCacheFile = _config->FindDir("Dir::Cache::srcpkgcache");
return pkgMergeStatus(Progress,Gen,CurrentSize,TotalSize);
}
/*}}}*/
-