summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-02-13 12:33:51 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-02-13 14:28:06 +0100
commit82f4cfc971ef6a2e56b34227d9e0b1a594dc2265 (patch)
treeb2e8512a807105627ff7f5dea117ee6e92247adf
parent422e68f569f374f697b84332f7e68c6fe5f7389f (diff)
Add the ?security pattern
-rw-r--r--apt-pkg/cachefilter-patterns.cc2
-rw-r--r--apt-pkg/cachefilter-patterns.h9
-rw-r--r--doc/apt-patterns.7.xml3
-rwxr-xr-xtest/integration/test-phased-updates-upgrade4
4 files changed, 18 insertions, 0 deletions
diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc
index 6ef34c953..7e6d84ff6 100644
--- a/apt-pkg/cachefilter-patterns.cc
+++ b/apt-pkg/cachefilter-patterns.cc
@@ -502,6 +502,8 @@ std::unique_ptr<APT::CacheFilter::Matcher> PatternParser::aPattern(std::unique_p
return std::make_unique<Patterns::PackageIsPhasing>(file);
if (node->matches("?section", 1, 1))
return std::make_unique<Patterns::VersionIsSection>(aWord(node->arguments[0]));
+ if (node->matches("?security", 0, 0))
+ return std::make_unique<Patterns::VersionIsSecurity>();
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 5fc00377f..fa4605253 100644
--- a/apt-pkg/cachefilter-patterns.h
+++ b/apt-pkg/cachefilter-patterns.h
@@ -415,6 +415,15 @@ struct APT_HIDDEN VersionIsSection : public VersionAnyMatcher
}
};
+struct APT_HIDDEN VersionIsSecurity : public VersionAnyMatcher
+{
+ VersionIsSecurity() {}
+ bool operator()(pkgCache::VerIterator const &Ver) override
+ {
+ return Ver.IsSecurityUpdate();
+ }
+};
+
struct APT_HIDDEN VersionIsSourcePackage : public VersionAnyMatcher
{
BaseRegexMatcher matcher;
diff --git a/doc/apt-patterns.7.xml b/doc/apt-patterns.7.xml
index e69854e6d..e87fef23d 100644
--- a/doc/apt-patterns.7.xml
+++ b/doc/apt-patterns.7.xml
@@ -162,6 +162,9 @@
<varlistentry><term><code>?priority(NAME)</code></term><term><code>~pNAME</code></term>
<listitem><para>Selects versions where the Priority string equals the given name.</para></listitem>
</varlistentry>
+ <varlistentry><term><code>?security</code></term>
+ <listitem><para>Selects packages that are a security update or succeed a security update.</para></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/test/integration/test-phased-updates-upgrade b/test/integration/test-phased-updates-upgrade
index 518e39fed..3bee1dc86 100755
--- a/test/integration/test-phased-updates-upgrade
+++ b/test/integration/test-phased-updates-upgrade
@@ -72,6 +72,10 @@ phased-dep/unstable-updates 3 all [upgradable from: 1]
phased-depends-ready-dep/unstable-updates 3 all [upgradable from: 1]
phased/unstable-updates 3 all [upgradable from: 1]" apt list '?phasing'
+testsuccessequal "Listing...
+phased-security-same/unstable-security,unstable-updates 3 all [upgradable from: 1]
+phased-security/unstable-updates 3 all [upgradable from: 1]" apt list '?security'
+
for always in APT::Get::Always-Include-Phased-Updates Update-Manager::Always-Include-Phased-Updates; do
testsuccessequal "Reading package lists...
Building dependency tree...