summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debindexfile.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-06-12 02:08:53 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-06-12 16:33:37 +0200
commitb07aeb1a6e24825e534167a737043441e871de9f (patch)
treeb47b5bced3f6352e2cdd6cfa550e351e8cd6ebab /apt-pkg/deb/debindexfile.cc
parent8881b11eacd735148d087c8c0f53827cb537b582 (diff)
store Release files data in the Cache
We used to read the Release file for each Packages file and store the data in the PackageFile struct even through potentially many Packages (and Translation-*) files could use the same data. The point of the exercise isn't the duplicated data through. Having the Release files as first-class citizens in the Cache allows us to properly track their state as well as allows us to use the information also for files which aren't in the cache, but where we know to which Release file they belong (Sources are an example for this). This modifies the pkgCache structs, especially the PackagesFile struct which depending on how libapt users access the data in these structs can mean huge breakage or no visible change. As a single data point: aptitude seems to be fine with this. Even if there is breakage it is trivial to fix in a backportable way while avoiding breakage for everyone would be a huge pain for us. Note that not all PackageFile structs have a corresponding ReleaseFile. In particular the dpkg/status file as well as *.deb files have not. As these have only a Archive property need, the Component property takes over this duty and the ReleaseFile remains zero. This is also the reason why it isn't needed nor particularily recommended to change from PackagesFile to ReleaseFile blindly. Sticking with the earlier is usually the better option.
Diffstat (limited to 'apt-pkg/deb/debindexfile.cc')
-rw-r--r--apt-pkg/deb/debindexfile.cc42
1 files changed, 10 insertions, 32 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index 7aad65c0e..3a79cbc58 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -128,7 +128,7 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
if (Dist.empty())
Dist = "/";
::URI Tmp(URI);
- if (Gen.SelectFile(PackageFile,Tmp.Host,*this) == false)
+ if (Gen.SelectFile(PackageFile, *this, Target.Option(IndexTarget::COMPONENT)) == false)
return _error->Error("Problem with SelectFile %s",PackageFile.c_str());
// Store the IMS information
@@ -136,31 +136,10 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(File);
File->Size = Pkg.FileSize();
File->mtime = Pkg.ModificationTime();
-
+
if (Gen.MergeList(Parser) == false)
return _error->Error("Problem with MergeList %s",PackageFile.c_str());
- // Check the release file
- string ReleaseFile = debReleaseIndex(URI,Dist).MetaIndexFile("InRelease");
- bool releaseExists = false;
- if (FileExists(ReleaseFile) == true)
- releaseExists = true;
- else
- ReleaseFile = debReleaseIndex(URI,Dist).MetaIndexFile("Release");
-
- if (releaseExists == true || FileExists(ReleaseFile) == true)
- {
- FileFd Rel;
- // Beware: The 'Release' file might be clearsigned in case the
- // signature for an 'InRelease' file couldn't be checked
- if (OpenMaybeClearSignedFile(ReleaseFile, Rel) == false)
- return false;
-
- if (_error->PendingError() == true)
- return false;
- Parser.LoadReleaseInfo(File, Rel, Target.Option(IndexTarget::COMPONENT));
- }
-
return true;
}
/*}}}*/
@@ -221,17 +200,17 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
debTranslationsParser TransParser(&Trans);
if (_error->PendingError() == true)
return false;
-
+
if (Prog != NULL)
Prog->SubProgress(0, Target.Description);
- if (Gen.SelectFile(TranslationFile,string(),*this) == false)
+ if (Gen.SelectFile(TranslationFile, *this, Target.Option(IndexTarget::COMPONENT), pkgCache::Flag::NotSource) == false)
return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
// Store the IMS information
pkgCache::PkgFileIterator TransFile = Gen.GetCurFile();
TransFile->Size = Trans.FileSize();
TransFile->mtime = Trans.ModificationTime();
-
+
if (Gen.MergeList(TransParser) == false)
return _error->Error("Problem with MergeList %s",TranslationFile.c_str());
}
@@ -305,18 +284,17 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
if (Prog != NULL)
Prog->SubProgress(0,File);
- if (Gen.SelectFile(File,string(),*this,pkgCache::Flag::NotSource) == false)
+ if (Gen.SelectFile(File, *this, "now", pkgCache::Flag::NotSource) == false)
return _error->Error("Problem with SelectFile %s",File.c_str());
// Store the IMS information
pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
+ pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(CFile);
CFile->Size = Pkg.FileSize();
CFile->mtime = Pkg.ModificationTime();
- map_stringitem_t const storage = Gen.StoreString(pkgCacheGenerator::MIXED, "now");
- CFile->Archive = storage;
-
+
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());
return true;
}
/*}}}*/
@@ -431,7 +409,7 @@ bool debDebPkgFileIndex::Merge(pkgCacheGenerator& Gen, OpProgress* Prog) const
// and give it to the list parser
debDebFileParser Parser(DebControl, DebFile);
- if(Gen.SelectFile(DebFile, "local", *this, pkgCache::Flag::LocalSource) == false)
+ if(Gen.SelectFile(DebFile, *this, "now", pkgCache::Flag::LocalSource) == false)
return _error->Error("Problem with SelectFile %s", DebFile.c_str());
pkgCache::PkgFileIterator File = Gen.GetCurFile();