From 53d18fe48618c9864de021cc5862685faac7c752 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 14 Dec 2020 14:28:35 +0100 Subject: patterns: Add dependency patterns ?depends, ?conflicts, etc. These match the target package, not target versions which is slightly unfortunate but might make sense. Maybe we should add a version that matches Versions instead. --- apt-pkg/cachefilter-patterns.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'apt-pkg/cachefilter-patterns.h') diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h index d64bc4ccf..048c7041f 100644 --- a/apt-pkg/cachefilter-patterns.h +++ b/apt-pkg/cachefilter-patterns.h @@ -295,6 +295,28 @@ struct APT_HIDDEN VersionIsAllVersions : public Matcher } }; +struct APT_HIDDEN VersionDepends : public VersionAnyMatcher +{ + std::unique_ptr base; + pkgCache::Dep::DepType type; + VersionDepends(std::unique_ptr base, pkgCache::Dep::DepType type = pkgCache::Dep::Depends) : base(std::move(base)), type(type) {} + bool operator()(pkgCache::GrpIterator const &) override { return false; } + bool operator()(pkgCache::VerIterator const &Ver) override + { + for (auto D = Ver.DependsList(); not D.end(); D++) + { + if (D.IsImplicit()) + continue; + if (D->Type != type) + continue; + if ((*base)(D.TargetPkg())) + return true; + } + + return false; + } +}; + struct APT_HIDDEN VersionIsAnyVersion : public VersionAnyMatcher { std::unique_ptr base; -- cgit v1.2.3-70-g09d2