- }
-
- return true;
-}
- /*}}}*/
-// AddSourcesSize - Add the size of the status files /*{{{*/
-// ---------------------------------------------------------------------
-/* This adds the size of all the status files to the size counter */
-static bool pkgAddSourcesSize(unsigned long &TotalSize)
-{
- // Grab the file names
- string xstatus = _config->FindDir("Dir::State::xstatus");
- string userstatus = _config->FindDir("Dir::State::userstatus");
- string status = _config->FindDir("Dir::State::status");
-
- // Grab the sizes
- struct stat Buf;
- if (stat(xstatus.c_str(),&Buf) == 0)
- TotalSize += Buf.st_size;
- if (stat(userstatus.c_str(),&Buf) == 0)
- TotalSize += Buf.st_size;
- if (stat(status.c_str(),&Buf) != 0)
- return _error->Errno("stat","Couldn't stat the status file %s",status.c_str());
- TotalSize += Buf.st_size;
-
- return true;
-}
- /*}}}*/
-// 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)
-{
- // Grab the file names
- string Status[3];
- Status[0] = _config->FindDir("Dir::State::xstatus");
- Status[1]= _config->FindDir("Dir::State::userstatus");
- Status[2] = _config->FindDir("Dir::State::status");
-
- for (int I = 0; I != 3; I++)
- {
- // Check if the file exists and it is not the primary status file.
- string File = Status[I];
- if (I != 2 && FileExists(File) == false)
- continue;
-
- FileFd Pkg(File,FileFd::ReadOnly);
- debListParser Parser(Pkg);
- 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();