Map(*pMap), Cache(pMap,false), Progress(Prog),
CurrentRlsFile(NULL), CurrentFile(NULL), d(NULL)
{
Map(*pMap), Cache(pMap,false), Progress(Prog),
CurrentRlsFile(NULL), CurrentFile(NULL), d(NULL)
{
- if (Map.RawAllocate(sizeof(pkgCache::Header)) == 0 && _error->PendingError() == true)
+ _error->PushToStack();
+ Map.RawAllocate(sizeof(pkgCache::Header));
+ bool const newError = _error->PendingError();
+ _error->MergeWithStack();
+ if (newError)
// Add a new version
map_pointer_t const verindex = NewVersion(Ver, Version, Pkg.Index(), Hash, *LastVer);
// Add a new version
map_pointer_t const verindex = NewVersion(Ver, Version, Pkg.Index(), Hash, *LastVer);
return _error->Error(_("Error occurred while processing %s (%s%d)"),
Pkg.Name(), "NewVersion", 1);
return _error->Error(_("Error occurred while processing %s (%s%d)"),
Pkg.Name(), "NewVersion", 1);
Dynamic<pkgCache::DescIterator> DynDesc(Desc);
map_pointer_t const descindex = NewDescription(Desc, lang, CurMd5, md5idx);
Dynamic<pkgCache::DescIterator> DynDesc(Desc);
map_pointer_t const descindex = NewDescription(Desc, lang, CurMd5, md5idx);
return _error->Error(_("Error occurred while processing %s (%s%d)"),
Ver.ParentPkg().Name(), "NewDescription", 1);
return _error->Error(_("Error occurred while processing %s (%s%d)"),
Ver.ParentPkg().Name(), "NewDescription", 1);
// We do not add self referencing provides
if (Ver.ParentPkg().Name() == PkgName && (PkgArch == Ver.ParentPkg().Arch() ||
// We do not add self referencing provides
if (Ver.ParentPkg().Name() == PkgName && (PkgArch == Ver.ParentPkg().Arch() ||
- (PkgArch == "all" && strcmp((Cache.StrP + Cache.HeaderP->Architecture), Ver.ParentPkg().Arch()) == 0)))
+ (PkgArch == "all" && strcmp((Cache.StrP + Cache.HeaderP->Architecture), Ver.ParentPkg().Arch()) == 0)) &&
+ (Version.empty() || Version == Ver.VerStr()))
/* This just verifies that each file in the list of index files exists,
has matching attributes with the cache and the cache does not have
any extra files. */
/* This just verifies that each file in the list of index files exists,
has matching attributes with the cache and the cache does not have
any extra files. */
static bool CheckValidity(const string &CacheFile,
pkgSourceList &List,
FileIterator const Start,
FileIterator const End,
MMap **OutMap = 0)
{
static bool CheckValidity(const string &CacheFile,
pkgSourceList &List,
FileIterator const Start,
FileIterator const End,
MMap **OutMap = 0)
{
bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
// No file, certainly invalid
if (CacheFile.empty() == true || FileExists(CacheFile) == false)
bool const Debug = _config->FindB("Debug::pkgCacheGen", false);
// No file, certainly invalid
if (CacheFile.empty() == true || FileExists(CacheFile) == false)
FileFd CacheF(CacheFile,FileFd::ReadOnly);
std::unique_ptr<MMap> Map(new MMap(CacheF,0));
pkgCache Cache(Map.get());
FileFd CacheF(CacheFile,FileFd::ReadOnly);
std::unique_ptr<MMap> Map(new MMap(CacheF,0));
pkgCache Cache(Map.get());
std::string const &FileName)
{
FileFd SCacheF(FileName, FileFd::WriteAtomic);
std::string const &FileName)
{
FileFd SCacheF(FileName, FileFd::WriteAtomic);
{
Map.reset(CreateDynamicMMap(NULL, 0));
FileFd CacheF(FileName, FileFd::ReadOnly);
{
Map.reset(CreateDynamicMMap(NULL, 0));
FileFd CacheF(FileName, FileFd::ReadOnly);
- if ((alloc == 0 && _error->PendingError())
- || CacheF.Read((unsigned char *)Map->Data() + alloc,
- CacheF.Size()) == false)
+ bool const newError = _error->PendingError();
+ _error->MergeWithStack();
+ if (alloc == 0 && newError)
+ return false;
+ if (CacheF.Read((unsigned char *)Map->Data() + alloc, CacheF.Size()) == false)
-// ---------------------------------------------------------------------
-/* */
+class APT_HIDDEN ScopedErrorMerge {
+public:
+ ScopedErrorMerge() { _error->PushToStack(); }
+ ~ScopedErrorMerge() { _error->MergeWithStack(); }
+};
APT_DEPRECATED bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
{ return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); }
bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap)
APT_DEPRECATED bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap)
{ return pkgCacheGenerator::MakeOnlyStatusCache(&Progress, OutMap); }
bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap)
std::unique_ptr<DynamicMMap> Map(CreateDynamicMMap(NULL, 0));
map_filesize_t CurrentSize = 0;
map_filesize_t TotalSize = 0;
std::unique_ptr<DynamicMMap> Map(CreateDynamicMMap(NULL, 0));
map_filesize_t CurrentSize = 0;
map_filesize_t TotalSize = 0;
// Build the status cache
if (Progress != NULL)
Progress->OverallProgress(0,1,1,_("Reading package lists"));
// Build the status cache
if (Progress != NULL)
Progress->OverallProgress(0,1,1,_("Reading package lists"));