From 422e68f569f374f697b84332f7e68c6fe5f7389f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 13 Feb 2024 12:29:28 +0100 Subject: Add a new ?phasing pattern This selects all packages that are being kept back due to phasing on your system. --- apt-pkg/cachefilter-patterns.cc | 2 ++ apt-pkg/cachefilter-patterns.h | 10 ++++++++++ doc/apt-patterns.7.xml | 3 +++ test/integration/test-phased-updates-upgrade | 5 +++++ 4 files changed, 20 insertions(+) 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 PatternParser::aPattern(std::unique_p return std::make_unique(); if (node->matches("?origin", 1, 1)) return std::make_unique(aWord(node->arguments[0])); + if (node->matches("?phasing", 0, 0)) + return std::make_unique(file); if (node->matches("?section", 1, 1)) return std::make_unique(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 @@ ?obsolete~o Selects packages that no longer exist in repositories. + ?phasing + Selects packages that will be kept back in upgrades due to phasing. + ?upgradable~U Selects packages that can be upgraded (have a newer candidate). 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... -- cgit v1.2.3-70-g09d2