summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-02-13 12:29:28 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2024-02-13 14:28:06 +0100
commit422e68f569f374f697b84332f7e68c6fe5f7389f (patch)
tree994ce575bfbc628afbfe16625dec77cf6248a481
parenta8352c2859a6f84b36fa5cd0af89231cb656b1ce (diff)
Add a new ?phasing pattern
This selects all packages that are being kept back due to phasing on your system.
-rw-r--r--apt-pkg/cachefilter-patterns.cc2
-rw-r--r--apt-pkg/cachefilter-patterns.h10
-rw-r--r--doc/apt-patterns.7.xml3
-rwxr-xr-xtest/integration/test-phased-updates-upgrade5
4 files changed, 20 insertions, 0 deletions
diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc
index faf5735b8..6ef34c953 100644
--- a/apt-pkg/cachefilter-patterns.cc
+++ b/apt-pkg/cachefilter-patterns.cc
@@ -498,6 +498,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("?phasing", 0, 0))
+ 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("?source-package", 1, 1))
diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h
index 2d48a1cc9..5fc00377f 100644
--- a/apt-pkg/cachefilter-patterns.h
+++ b/apt-pkg/cachefilter-patterns.h
@@ -243,6 +243,16 @@ struct APT_HIDDEN PackageIsObsolete : public PackageMatcher
}
};
+struct APT_HIDDEN PackageIsPhasing : public PackageMatcher
+{
+ pkgCacheFile *Cache;
+ explicit PackageIsPhasing(pkgCacheFile *Cache) : Cache(Cache) {}
+ bool operator()(pkgCache::PkgIterator const &pkg) override
+ {
+ return (*Cache)->PhasingApplied(pkg);
+ }
+};
+
struct APT_HIDDEN PackageIsUpgradable : public PackageMatcher
{
pkgCacheFile *Cache;
diff --git a/doc/apt-patterns.7.xml b/doc/apt-patterns.7.xml
index 6b3f91e96..e69854e6d 100644
--- a/doc/apt-patterns.7.xml
+++ b/doc/apt-patterns.7.xml
@@ -116,6 +116,9 @@
<varlistentry><term><code>?obsolete</code></term><term><code>~o</code></term>
<listitem><para>Selects packages that no longer exist in repositories.</para></listitem>
</varlistentry>
+ <varlistentry><term><code>?phasing</code></term>
+ <listitem><para>Selects packages that will be kept back in upgrades due to phasing.</para></listitem>
+ </varlistentry>
<varlistentry><term><code>?upgradable</code></term><term><code>~U</code></term>
<listitem><para>Selects packages that can be upgraded (have a newer candidate).</para></listitem>
</varlistentry>
diff --git a/test/integration/test-phased-updates-upgrade b/test/integration/test-phased-updates-upgrade
index 2f5327f05..518e39fed 100755
--- a/test/integration/test-phased-updates-upgrade
+++ b/test/integration/test-phased-updates-upgrade
@@ -67,6 +67,11 @@ Conf depends-phased-new (3 unstable-updates [all])
Conf phased-security (3 unstable-updates [all])
Conf phased-security-same (3 unstable-security, unstable-updates [all])" aptget dist-upgrade -s -q
+testsuccessequal "Listing...
+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'
+
for always in APT::Get::Always-Include-Phased-Updates Update-Manager::Always-Include-Phased-Updates; do
testsuccessequal "Reading package lists...
Building dependency tree...