From 93416f3227685c390c7ab579981efde526134181 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 29 Jan 2025 19:01:06 +0100 Subject: Add 'Include'/'Exclude' options to limit packages used from a repository 'Include' allows limiting a repository to a allowlist of packages, 'Exclude' allows removing packages from a repository. Implementation wise this is not the nicest as it goes via the IndexTarget options, so we first parse our option value into a vector, then we turn the vector into a string, and then vectorize it again. That said, we support both "," and " " as separators due to the construction (we split by "," then we join using " "). Gbp-Dch: full --- apt-pkg/pkgcachegen.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg/pkgcachegen.h') diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index b67b37559..c481e1b96 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -35,6 +35,7 @@ class FileFd; class pkgSourceList; +class IndexTarget; class OpProgress; class pkgIndexFile; class pkgCacheListParser; @@ -114,6 +115,8 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ pkgCache::ReleaseFile *CurrentRlsFile; std::string PkgFileName; pkgCache::PackageFile *CurrentFile; + std::unordered_set include; + std::unordered_set exclude; bool NewGroup(pkgCache::GrpIterator &Grp, std::string_view Name); bool NewPackage(pkgCache::PkgIterator &Pkg, std::string_view Name, std::string_view Arch); @@ -137,7 +140,7 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ inline map_stringitem_t StoreString(enum StringType const type, std::string_view S) {return StoreString(type, S.data(),S.length());}; void DropProgress() {Progress = 0;}; - bool SelectFile(const std::string &File,pkgIndexFile const &Index, std::string const &Architecture, std::string const &Component, unsigned long Flags = 0); + bool SelectFile(const std::string &File, pkgIndexFile const &Index, std::string const &Architecture, std::string const &Component, const IndexTarget *target, unsigned long Flags = 0); bool SelectReleaseFile(const std::string &File, const std::string &Site, unsigned long Flags = 0); bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0); inline pkgCache &GetCache() {return Cache;}; -- cgit v1.2.3-70-g09d2