HeaderSz = sizeof(pkgCache::Header);
GroupSz = sizeof(pkgCache::Group);
PackageSz = sizeof(pkgCache::Package);
+ ReleaseFileSz = sizeof(pkgCache::ReleaseFile);
PackageFileSz = sizeof(pkgCache::PackageFile);
VersionSz = sizeof(pkgCache::Version);
DescriptionSz = sizeof(pkgCache::Description);
VersionCount = 0;
DescriptionCount = 0;
DependsCount = 0;
+ ReleaseFileCount = 0;
PackageFileCount = 0;
VerFileCount = 0;
DescFileCount = 0;
MaxDescFileSize = 0;
FileList = 0;
+ RlsFileList = 0;
#if APT_PKG_ABI < 413
APT_IGNORE_DEPRECATED(StringList = 0;)
#endif
if (HeaderSz == Against.HeaderSz &&
GroupSz == Against.GroupSz &&
PackageSz == Against.PackageSz &&
+ ReleaseFileSz == Against.ReleaseFileSz &&
PackageFileSz == Against.PackageFileSz &&
VersionSz == Against.VersionSz &&
DescriptionSz == Against.DescriptionSz &&
// ---------------------------------------------------------------------
/* */
APT_IGNORE_DEPRECATED_PUSH
-pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map)
+pkgCache::pkgCache(MMap *Map, bool DoMap) : Map(*Map), d(NULL)
{
// call getArchitectures() with cached=false to ensure that the
// architectures cache is re-evaulated. this is needed in cases
PkgP = (Package *)Map.Data();
VerFileP = (VerFile *)Map.Data();
DescFileP = (DescFile *)Map.Data();
+ RlsFileP = (ReleaseFile *)Map.Data();
PkgFileP = (PackageFile *)Map.Data();
VerP = (Version *)Map.Data();
DescP = (Description *)Map.Data();
pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
size_t const found = Name.find(':');
if (found == string::npos)
- {
- if (MultiArchCache() == false)
- return SingleArchFindPkg(Name);
- else
- return FindPkg(Name, "native");
- }
+ return FindPkg(Name, "native");
string const Arch = Name.substr(found+1);
/* Beware: This is specialcased to handle pkg:any in dependencies as
these are linked to virtual pkg:any named packages with all archs.
// ---------------------------------------------------------------------
/* Returns 0 on error, pointer to the package otherwise */
pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string const &Arch) {
- if (MultiArchCache() == false && Arch != "none") {
- if (Arch == "native" || Arch == "all" || Arch == "any" ||
- Arch == NativeArch())
- return SingleArchFindPkg(Name);
- else
- return PkgIterator(*this,0);
- }
/* We make a detour via the GrpIterator here as
on a multi-arch environment a group is easier to
find than a package (less entries in the buckets) */
{
VerFileIterator Files = FileList();
for (; Files.end() == false; ++Files)
- if ((Files.File()->Flags & pkgCache::Flag::NotSource) != pkgCache::Flag::NotSource)
+ if (Files.File().Flagged(pkgCache::Flag::NotSource) == false)
return true;
return false;
}
VerFileIterator Files = FileList();
for (; Files.end() == false; ++Files)
// Do not check ButAutomaticUpgrades here as it is kind of automatic…
- if ((Files.File()->Flags & pkgCache::Flag::NotAutomatic) != pkgCache::Flag::NotAutomatic)
+ if (Files.File().Flagged(pkgCache::Flag::NotAutomatic) == false)
return true;
return false;
}
for (pkgCache::VerFileIterator I = this->FileList(); I.end() == false; ++I)
{
// Do not print 'not source' entries'
- pkgCache::PkgFileIterator File = I.File();
- if ((File->Flags & pkgCache::Flag::NotSource) == pkgCache::Flag::NotSource)
+ pkgCache::PkgFileIterator const File = I.File();
+ if (File.Flagged(pkgCache::Flag::NotSource))
continue;
// See if we have already printed this out..
bool Seen = false;
for (pkgCache::VerFileIterator J = this->FileList(); I != J; ++J)
{
- pkgCache::PkgFileIterator File2 = J.File();
- if (File2->Label == 0 || File->Label == 0)
+ pkgCache::PkgFileIterator const File2 = J.File();
+ if (File2.Label() == 0 || File.Label() == 0)
continue;
if (strcmp(File.Label(),File2.Label()) != 0)
continue;
- if (File2->Version == File->Version)
+ if (File2.Version() == File.Version())
{
Seen = true;
break;
}
- if (File2->Version == 0 || File->Version == 0)
+ if (File2.Version() == 0 || File.Version() == 0)
break;
if (strcmp(File.Version(),File2.Version()) == 0)
Seen = true;
else
First = false;
- if (File->Label != 0)
+ if (File.Label() != 0)
Res = Res + File.Label() + ':';
- if (File->Archive != 0)
+ if (File.Archive() != 0)
{
- if (File->Version == 0)
+ if (File.Version() == 0)
Res += File.Archive();
else
Res = Res + File.Version() + '/' + File.Archive();
else
{
// No release file, print the host name that this came from
- if (File->Site == 0 || File.Site()[0] == 0)
+ if (File.Site() == 0 || File.Site()[0] == 0)
Res += "localhost";
else
Res += File.Site();
return "none";
}
/*}}}*/
-// PkgFileIterator::IsOk - Checks if the cache is in sync with the file /*{{{*/
+// RlsFileIterator::IsOk - Checks if the cache is in sync with the file /*{{{*/
// ---------------------------------------------------------------------
/* This stats the file and compares its stats with the ones that were
- stored during generation. Date checks should probably also be
+ stored during generation. Date checks should probably also be
included here. */
-bool pkgCache::PkgFileIterator::IsOk()
+bool pkgCache::RlsFileIterator::IsOk()
{
struct stat Buf;
if (stat(FileName(),&Buf) != 0)
return true;
}
/*}}}*/
-// PkgFileIterator::RelStr - Return the release string /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-string pkgCache::PkgFileIterator::RelStr()
+// RlsFileIterator::RelStr - Return the release string /*{{{*/
+string pkgCache::RlsFileIterator::RelStr()
{
string Res;
if (Version() != 0)
Res = Res + (Res.empty() == true?"n=":",n=") + Codename();
if (Label() != 0)
Res = Res + (Res.empty() == true?"l=":",l=") + Label();
- if (Component() != 0)
- Res = Res + (Res.empty() == true?"c=":",c=") + Component();
+ return Res;
+}
+ /*}}}*/
+// PkgFileIterator::IsOk - Checks if the cache is in sync with the file /*{{{*/
+// ---------------------------------------------------------------------
+/* This stats the file and compares its stats with the ones that were
+ stored during generation. Date checks should probably also be
+ included here. */
+bool pkgCache::PkgFileIterator::IsOk()
+{
+ struct stat Buf;
+ if (stat(FileName(),&Buf) != 0)
+ return false;
+
+ if (Buf.st_size != (signed)S->Size || Buf.st_mtime != S->mtime)
+ return false;
+
+ return true;
+}
+ /*}}}*/
+string pkgCache::PkgFileIterator::RelStr() /*{{{*/
+{
+ std::string Res;
+ if (ReleaseFile() == 0)
+ {
+ if (Component() != 0)
+ Res = Res + (Res.empty() == true?"a=":",a=") + Component();
+ }
+ else
+ {
+ Res = ReleaseFile().RelStr();
+ if (Component() != 0)
+ Res = Res + (Res.empty() == true?"c=":",c=") + Component();
+ }
if (Architecture() != 0)
Res = Res + (Res.empty() == true?"b=":",b=") + Architecture();
return Res;
return false;
}
/*}}}*/
-APT_DEPRECATED APT_PURE const char * pkgCache::PkgIterator::Section() const {/*{{{*/
- if (S->VersionList == 0)
- return 0;
- return VersionList().Section();
-}
- /*}}}*/
+
+pkgCache::~pkgCache() {}