From 02b0afd5098534eff34a8fa1d44454c7a3e1ff09 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 21 Aug 2019 22:53:25 +0200 Subject: patterns: Add ?origin --- apt-pkg/cachefilter-patterns.cc | 2 ++ apt-pkg/cachefilter-patterns.h | 15 +++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc index aeed31263..2ba89e5d4 100644 --- a/apt-pkg/cachefilter-patterns.cc +++ b/apt-pkg/cachefilter-patterns.cc @@ -238,6 +238,8 @@ std::unique_ptr PatternParser::aPattern(std::unique_p return std::make_unique(aPattern(node->arguments[0]).release()); if (node->matches("?obsolete", 0, 0)) return std::make_unique(); + if (node->matches("?origin", 1, 1)) + return std::make_unique(aWord(node->arguments[0])); if (node->matches("?source-package", 1, 1)) return std::make_unique(aWord(node->arguments[0])); if (node->matches("?source-version", 1, 1)) diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h index c92a152d6..3d1735442 100644 --- a/apt-pkg/cachefilter-patterns.h +++ b/apt-pkg/cachefilter-patterns.h @@ -275,6 +275,21 @@ struct VersionIsArchive : public VersionAnyMatcher } }; +struct VersionIsOrigin : public VersionAnyMatcher +{ + BaseRegexMatcher matcher; + VersionIsOrigin(std::string const &pattern) : matcher(pattern) {} + bool operator()(pkgCache::VerIterator const &Ver) override + { + for (auto VF = Ver.FileList(); not VF.end(); VF++) + { + if (VF.File().Origin() && matcher(VF.File().Origin())) + return true; + } + return false; + } +}; + struct VersionIsSourcePackage : public VersionAnyMatcher { BaseRegexMatcher matcher; -- cgit v1.2.3-70-g09d2