[packages/bash-completion] - better support for rpm package completion - drop hrmib support (not used by rpm4 anymore) - matchi

adwol adwol at pld-linux.org
Wed Nov 17 00:11:17 CET 2021


commit 95d5ed11b5e2cd314597b4faaee55530a0e345d6
Author: Adam Osuchowski <adwol at pld-linux.org>
Date:   Wed Nov 17 00:05:44 2021 +0100

    - better support for rpm package completion
    - drop hrmib support (not used by rpm4 anymore)
    - matching package versions and releases
    - use simple packages list in /var/log/rpmpkgs if present

 bash-completion-rpm-cache.patch | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/bash-completion-rpm-cache.patch b/bash-completion-rpm-cache.patch
index 9c9d401..965b938 100644
--- a/bash-completion-rpm-cache.patch
+++ b/bash-completion-rpm-cache.patch
@@ -1,22 +1,24 @@
-Support rpm (jbj rpm 4.4.7+) hrmib exports for rpm -qa filter (via %_hrmib_path /var/cache/hrmib)
-
-Not accepted upstream.
-
---
-Signed-off-by: Elan Ruusamäe <glen at delfi.ee>
-
---- bash-completion-2.0/completions/rpm.orig	2012-01-07 23:44:41.000000000 +0100
-+++ bash-completion-2.0/completions/rpm	2012-07-28 07:21:12.033708931 +0200
-@@ -4,6 +4,12 @@
- 
+--- bash-completion-2.11/completions/rpm.orig	2020-07-25 13:49:49.000000000 +0200
++++ bash-completion-2.11/completions/rpm	2021-11-17 00:01:41.257388895 +0100
+@@ -5,17 +5,16 @@
  _rpm_installed_packages()
  {
-+    # if rpm (4.4.7+) is configured to export it's rpmdb to /var/cache/hrmib (%_hrmib_path)
-+    if [ -d /var/cache/hrmib -a -r /var/cache/hrmib ]; then
-+        COMPREPLY=( $( LC_ALL=C command ls -1 /var/cache/hrmib | sed -ne '/^'$cur'/p') )
-+        return
-+    fi
-+
      if [[ -r /var/log/rpmpkgs && \
-         /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then
-         # using RHL 7.2 or later - this is quicker than querying the DB
+-        /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then
+-        # using RHL 7.2 or later - this is quicker than querying the DB
+-        COMPREPLY=($(compgen -W "$(command sed -ne \
+-            's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \
++        /var/log/rpmpkgs -nt /var/lib/rpm/rpmdb.sqlite ]]; then
++        # simple list generated by 'rpm -qa' command
++        COMPREPLY=($(compgen -W "$(command cat -ne \
+             /var/log/rpmpkgs)" -- "$cur"))
+     elif type rpmqpack &>/dev/null; then
+         # SUSE's rpmqpack is faster than rpm -qa
+         COMPREPLY=($(compgen -W '$(rpmqpack)' -- "$cur"))
+     else
+         COMPREPLY=($(${1:-rpm} -qa --nodigest --nosignature \
+-            --queryformat='%{NAME} ' "$cur*" 2>/dev/null))
++            --queryformat='%{NAME}-%{VERSION}-%{RELEASE}\n' 2>/dev/null | while read x ; do [[ "$x" == "$cur"* ]] && echo $x ; done))
+     fi
+ }
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/bash-completion.git/commitdiff/95d5ed11b5e2cd314597b4faaee55530a0e345d6



More information about the pld-cvs-commit mailing list