commit:     8ab7c76d18b5cd9a19df36a4b4599e6aace2eef0
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 18 17:11:00 2025 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 18 17:11:00 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=8ab7c76d

pquery: add --live and --non-live filters

Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 data/share/bash-completion/completions/pquery |  1 +
 src/pkgcore/scripts/pquery.py                 | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/data/share/bash-completion/completions/pquery 
b/data/share/bash-completion/completions/pquery
index 83c07a55..39cf1c66 100644
--- a/data/share/bash-completion/completions/pquery
+++ b/data/share/bash-completion/completions/pquery
@@ -32,6 +32,7 @@ _pquery() {
         --all
         --has-use
         --license
+        --live --non-live
         --revdep
         --revdep-pkgs
         --restrict-revdep

diff --git a/src/pkgcore/scripts/pquery.py b/src/pkgcore/scripts/pquery.py
index 6ab6a79f..ea20c2eb 100644
--- a/src/pkgcore/scripts/pquery.py
+++ b/src/pkgcore/scripts/pquery.py
@@ -766,6 +766,23 @@ add_query(
     type=parserestrict.comma_separated_containment("license"),
     help="exact match on a license",
 )
+add_query(
+    "--live",
+    action="append_const",
+    const=packages.PackageRestriction("properties", 
values.ContainmentMatch("live")),
+    type=None,
+    help='match packages which are have PROPERTIES="live"',
+)
+add_query(
+    "--non-live",
+    action="append_const",
+    const=packages.PackageRestriction(
+        "properties", values.ContainmentMatch("live", negate=True)
+    ),
+    type=None,
+    help='match packages which are don\'t have PROPERTIES="live"',
+)
+
 
 query.add_argument(
     "--revdep",

Reply via email to