diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-12-27 17:04:33 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-12-27 17:04:33 +0100 |
commit | a628ca5256b4a2f3ae300697b17adf150b6e17b0 (patch) | |
tree | f9eac83a81436461fd9e1f8e7ea273a11553d6dc /apt-pkg/deb | |
parent | 2837a71877c0f5c1aca8f70e30130018bc53acac (diff) |
allow repositories to forbid arch:all for specific index targets
Debian has a Packages file for arch:all already, but the arch:any files
contain arch:all packages as well, so downloading it would be a total
waste of resources. Getting this solved is on the list of things to do,
but it is also the hardest part – for index targets like Contents the
situation is much easier and less server/client implementations are
involved so we might not want to stall them.
A repository can now declare via:
No-Support-for-Architecture-all: Packages
that even if an arch:all Packages exists, it shouldn't be downloaded, so
that support for Contents files can be added now.
See also 1dd20368486820efb6ef4476ad739e967174bec4 for the implementation
of downloading arch:all index targets, which this is limiting.
The field uses the name of the target from the apt configuration for
simplicity and is negative by design as this field is intended to be
supported/needed only for a "short" time (one or two Debian releases).
While this commit theoretically supports any target, its expected to
only see "Packages" as a value in reality.
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 13 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index c8026aedf..46a9f9c97 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -50,6 +50,7 @@ class APT_HIDDEN debReleaseIndexPrivate /*{{{*/ time_t ValidUntilMax; std::vector<std::string> Architectures; + std::vector<std::string> NoSupportForAll; debReleaseIndexPrivate() : CheckValidUntil(metaIndex::TRI_UNSET), ValidUntilMin(0), ValidUntilMax(0) {} }; @@ -346,6 +347,11 @@ bool debReleaseIndex::Load(std::string const &Filename, std::string * const Erro if (archs.empty() == false) d->Architectures = VectorizeString(archs, ' '); } + { + std::string const targets = Section.FindS("No-Support-for-Architecture-all"); + if (targets.empty() == false) + d->NoSupportForAll = VectorizeString(targets, ' '); + } bool FoundHashSum = false; bool FoundStrongHashSum = false; @@ -624,6 +630,13 @@ bool debReleaseIndex::IsArchitectureSupported(std::string const &arch) const/*{{ return std::find(d->Architectures.begin(), d->Architectures.end(), arch) != d->Architectures.end(); } /*}}}*/ +bool debReleaseIndex::IsArchitectureAllSupportedFor(IndexTarget const &target) const/*{{{*/ +{ + if (d->NoSupportForAll.empty()) + return true; + return std::find(d->NoSupportForAll.begin(), d->NoSupportForAll.end(), target.Option(IndexTarget::CREATED_BY)) == d->NoSupportForAll.end(); +} + /*}}}*/ std::vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles() /*{{{*/ { if (Indexes != NULL) diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index 538f13f33..2bb9ed693 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -59,6 +59,7 @@ class APT_HIDDEN debReleaseIndex : public metaIndex virtual bool IsTrusted() const APT_OVERRIDE; bool IsArchitectureSupported(std::string const &arch) const; + bool IsArchitectureAllSupportedFor(IndexTarget const &target) const; void AddComponent(std::string const &sourcesEntry, bool const isSrc, std::string const &Name, |