diff options
| author | Julian Andres Klode <jak@debian.org> | 2021-10-18 13:36:20 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2021-10-18 13:36:20 +0000 |
| commit | f6b08c78dcdda1734710a5ef01553f53ceb5c52e (patch) | |
| tree | b424e0113908194e71b602a277a13e6b136df61a /apt-pkg/cachefilter-patterns.h | |
| parent | edf4b2169405e7ca6e21f408229e5fc4bbd4f4ed (diff) | |
| parent | cdfae5a9624e7283d372fce261efd018841d21cb (diff) | |
Merge branch 'bug-989558' into 'main'
add pattern to select packages by priority (closes: #989558)
See merge request apt-team/apt!185
Diffstat (limited to 'apt-pkg/cachefilter-patterns.h')
| -rw-r--r-- | apt-pkg/cachefilter-patterns.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h index e0c48dd12..d55cb6335 100644 --- a/apt-pkg/cachefilter-patterns.h +++ b/apt-pkg/cachefilter-patterns.h @@ -417,6 +417,22 @@ struct APT_HIDDEN VersionIsVersion : public VersionAnyMatcher return matcher(Ver.VerStr()); } }; + +struct APT_HIDDEN VersionIsPriority : public VersionAnyMatcher +{ + std::string name; + explicit VersionIsPriority(std::string name) : name(name) {} + bool operator()(pkgCache::VerIterator const &Ver) override + { + std::string Mapping[] = {"", "required","important","standard", + "optional","extra"}; + if (Ver->Priority > 0 && Ver->Priority < APT_ARRAY_SIZE(Mapping)) { + return name == Mapping[Ver->Priority]; + } + return false; + } +}; + } // namespace Patterns } // namespace Internal } // namespace APT |
