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/indexfile.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'apt-pkg/indexfile.cc') diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc index 1176903f4..a6da06029 100644 --- a/apt-pkg/indexfile.cc +++ b/apt-pkg/indexfile.cc @@ -324,7 +324,9 @@ pkgCacheListParser * pkgDebianIndexFile::CreateListParser(FileFd &Pkg) bool pkgDebianIndexFile::Merge(pkgCacheGenerator &Gen,OpProgress * const Prog) { std::string const PackageFile = IndexFileName(); + const IndexTarget *Target = nullptr; FileFd Pkg; + if (OpenListFile(Pkg, PackageFile) == false) return false; _error->PushToStack(); @@ -339,7 +341,10 @@ bool pkgDebianIndexFile::Merge(pkgCacheGenerator &Gen,OpProgress * const Prog) if (Prog != NULL) Prog->SubProgress(0, GetProgressDescription()); - if (Gen.SelectFile(PackageFile, *this, GetArchitecture(), GetComponent(), GetIndexFlags()) == false) + if (auto tmp = dynamic_cast(this)) + Target = &tmp->Target; + + if (Gen.SelectFile(PackageFile, *this, GetArchitecture(), GetComponent(), Target, GetIndexFlags()) == false) return _error->Error("Problem with SelectFile %s",PackageFile.c_str()); // Store the IMS information -- cgit v1.2.3-70-g09d2