summaryrefslogtreecommitdiff
path: root/apt-pkg/cachefilter-patterns.h
diff options
context:
space:
mode:
authorJohannes Schauer Marin Rodrigues <josch@mister-muffin.de>2021-09-07 20:30:21 +0200
committerJohannes Schauer Marin Rodrigues <josch@mister-muffin.de>2021-10-04 23:39:04 +0200
commitcdfae5a9624e7283d372fce261efd018841d21cb (patch)
tree1a57b62b77f732b818888e88e99b379b421656f1 /apt-pkg/cachefilter-patterns.h
parentf3885ecec2d8ef1a35495d6c6b979d25d3da6d5c (diff)
add pattern to select packages by priority (closes: #989558)
Diffstat (limited to 'apt-pkg/cachefilter-patterns.h')
-rw-r--r--apt-pkg/cachefilter-patterns.h16
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