/* ######################################################################
Package Cache Generator - Generator for the cache structure.
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
// ---------------------------------------------------------------------
/* We set the diry flag and make sure that is written to the disk */
pkgCacheGenerator::pkgCacheGenerator(DynamicMMap &Map,OpProgress &Prog) :
// ---------------------------------------------------------------------
/* We set the diry flag and make sure that is written to the disk */
pkgCacheGenerator::pkgCacheGenerator(DynamicMMap &Map,OpProgress &Prog) :
// ---------------------------------------------------------------------
/* This provides the generation of the entries in the cache. Each loop
goes through a single package record from the underlying parse engine. */
// ---------------------------------------------------------------------
/* This provides the generation of the entries in the cache. Each loop
goes through a single package record from the underlying parse engine. */
if (NewPackage(Pkg,PackageName) == false)
return _error->Error("Error occured while processing %s (NewPackage)",PackageName.c_str());
Counter++;
if (NewPackage(Pkg,PackageName) == false)
return _error->Error("Error occured while processing %s (NewPackage)",PackageName.c_str());
Counter++;
/* 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
/* 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
{
if (List.UsePackage(Pkg,Ver) == false)
return _error->Error("Error occured while processing %s (UsePackage2)",PackageName.c_str());
{
if (List.UsePackage(Pkg,Ver) == false)
return _error->Error("Error occured while processing %s (UsePackage2)",PackageName.c_str());
if (NewFileVer(Ver,List) == false)
return _error->Error("Error occured while processing %s (NewFileVer1)",PackageName.c_str());
if (NewFileVer(Ver,List) == false)
return _error->Error("Error occured while processing %s (NewFileVer1)",PackageName.c_str());
if (NewFileVer(Ver,List) == false)
return _error->Error("Error occured while processing %s (NewVersion2)",PackageName.c_str());
if (NewFileVer(Ver,List) == false)
return _error->Error("Error occured while processing %s (NewVersion2)",PackageName.c_str());
// Search for an insertion point
pkgCache::StringItem *I = Cache.StringItemP + Cache.HeaderP->StringList;
int Res = 1;
// Search for an insertion point
pkgCache::StringItem *I = Cache.StringItemP + Cache.HeaderP->StringList;
int Res = 1;
for (; I != Cache.StringItemP; Last = &I->NextItem,
I = Cache.StringItemP + I->NextItem)
{
for (; I != Cache.StringItemP; Last = &I->NextItem,
I = Cache.StringItemP + I->NextItem)
{
// ---------------------------------------------------------------------
/* This adds the size of all the status files to the size counter */
// ---------------------------------------------------------------------
/* This adds the size of all the status files to the size counter */
// MergeStatus - Add the status files to the cache /*{{{*/
// ---------------------------------------------------------------------
/* This adds the status files to the map */
// MergeStatus - Add the status files to the cache /*{{{*/
// ---------------------------------------------------------------------
/* This adds the status files to the map */
-static bool pkgMergeStatus(OpProgress &Progress,pkgCacheGenerator &Gen,
- unsigned long &CurrentSize,unsigned long TotalSize)
+bool pkgMergeStatus(OpProgress &Progress,pkgCacheGenerator &Gen,
+ unsigned long &CurrentSize,unsigned long TotalSize)
xstatus files into it. */
bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
{
xstatus files into it. */
bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress)
{
Progress.OverallProgress(0,1,1,"Reading Package Lists");
string CacheFile = _config->FindFile("Dir::Cache::pkgcache");
Progress.OverallProgress(0,1,1,"Reading Package Lists");
string CacheFile = _config->FindFile("Dir::Cache::pkgcache");
string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
FileFd SCacheF(SCacheFile,FileFd::WriteEmpty);
FileFd CacheF(CacheFile,FileFd::WriteEmpty);
string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
FileFd SCacheF(SCacheFile,FileFd::WriteEmpty);
FileFd CacheF(CacheFile,FileFd::WriteEmpty);
FileFd SCacheF(SCacheFile,FileFd::ReadOnly);
FileFd CacheF(CacheFile,FileFd::WriteEmpty);
FileFd SCacheF(SCacheFile,FileFd::ReadOnly);
FileFd CacheF(CacheFile,FileFd::WriteEmpty);
creates a memory block and puts the cache in there. */
MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
{
creates a memory block and puts the cache in there. */
MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
{
/* If the cache file is writeable this is just a wrapper for
MakeStatusCache */
string CacheFile = _config->FindFile("Dir::Cache::pkgcache");
/* If the cache file is writeable this is just a wrapper for
MakeStatusCache */
string CacheFile = _config->FindFile("Dir::Cache::pkgcache");
// We use the source cache to generate the package cache
string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
FileFd SCacheF(SCacheFile,FileFd::ReadOnly);
// We use the source cache to generate the package cache
string SCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
FileFd SCacheF(SCacheFile,FileFd::ReadOnly);