diff options
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/cachefilter-patterns.cc | 2 | ||||
-rw-r--r-- | apt-pkg/cachefilter-patterns.h | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc index 4414792cf..aeed31263 100644 --- a/apt-pkg/cachefilter-patterns.cc +++ b/apt-pkg/cachefilter-patterns.cc @@ -214,6 +214,8 @@ std::unique_ptr<APT::CacheFilter::Matcher> PatternParser::aPattern(std::unique_p if (node->matches("?architecture", 1, 1)) return std::make_unique<APT::CacheFilter::PackageArchitectureMatchesSpecification>(aWord(node->arguments[0])); + if (node->matches("?archive", 1, 1)) + return std::make_unique<Patterns::VersionIsArchive>(aWord(node->arguments[0])); if (node->matches("?automatic", 0, 0)) return std::make_unique<Patterns::PackageIsAutomatic>(file); if (node->matches("?broken", 0, 0)) diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h index 46a54cf81..c92a152d6 100644 --- a/apt-pkg/cachefilter-patterns.h +++ b/apt-pkg/cachefilter-patterns.h @@ -260,6 +260,21 @@ struct VersionAnyMatcher : public Matcher } }; +struct VersionIsArchive : public VersionAnyMatcher +{ + BaseRegexMatcher matcher; + VersionIsArchive(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().Archive() && matcher(VF.File().Archive())) + return true; + } + return false; + } +}; + struct VersionIsSourcePackage : public VersionAnyMatcher { BaseRegexMatcher matcher; |