diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2019-11-26 12:01:42 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2019-11-26 12:01:42 +0100 |
commit | a93b4443c18ee211691f7b336b161fea7d1df699 (patch) | |
tree | edfa02e104ff9f55948de510f2caf6f7f1665bfe /apt-pkg | |
parent | 96f795bce665a1907b885bd2d57d6ab22b0a4199 (diff) |
patterns: Add ?section
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/cachefilter-patterns.cc | 2 | ||||
-rw-r--r-- | apt-pkg/cachefilter-patterns.h | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc index 8214c388a..a9f76ff1d 100644 --- a/apt-pkg/cachefilter-patterns.cc +++ b/apt-pkg/cachefilter-patterns.cc @@ -244,6 +244,8 @@ std::unique_ptr<APT::CacheFilter::Matcher> PatternParser::aPattern(std::unique_p return std::make_unique<Patterns::PackageIsObsolete>(); if (node->matches("?origin", 1, 1)) return std::make_unique<Patterns::VersionIsOrigin>(aWord(node->arguments[0])); + if (node->matches("?section", 1, 1)) + return std::make_unique<Patterns::VersionIsSection>(aWord(node->arguments[0])); if (node->matches("?source-package", 1, 1)) return std::make_unique<Patterns::VersionIsSourcePackage>(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 8c5561c82..bd8ce7e7e 100644 --- a/apt-pkg/cachefilter-patterns.h +++ b/apt-pkg/cachefilter-patterns.h @@ -320,6 +320,16 @@ struct VersionIsOrigin : public VersionAnyMatcher } }; +struct VersionIsSection : public VersionAnyMatcher +{ + BaseRegexMatcher matcher; + VersionIsSection(std::string const &pattern) : matcher(pattern) {} + bool operator()(pkgCache::VerIterator const &Ver) override + { + return matcher(Ver.Section()); + } +}; + struct VersionIsSourcePackage : public VersionAnyMatcher { BaseRegexMatcher matcher; |