]> TLD Linux GIT Repositories - packages/bash-completion.git/blob - bash-completion-rpm-cache.patch
- merged 2.11 from PLD
[packages/bash-completion.git] / bash-completion-rpm-cache.patch
1 --- bash-completion-2.11/completions/rpm.orig   2020-07-25 13:49:49.000000000 +0200
2 +++ bash-completion-2.11/completions/rpm        2021-11-17 00:01:41.257388895 +0100
3 @@ -5,17 +5,16 @@
4  _rpm_installed_packages()
5  {
6      if [[ -r /var/log/rpmpkgs && \
7 -        /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]]; then
8 -        # using RHL 7.2 or later - this is quicker than querying the DB
9 -        COMPREPLY=($(compgen -W "$(command sed -ne \
10 -            's|^\([^[:space:]]\{1,\}\)-[^[:space:]-]\{1,\}-[^[:space:]-]\{1,\}\.rpm$|\1|p' \
11 +        /var/log/rpmpkgs -nt /var/lib/rpm/rpmdb.sqlite ]]; then
12 +        # simple list generated by 'rpm -qa' command
13 +        COMPREPLY=($(compgen -W "$(command cat -ne \
14              /var/log/rpmpkgs)" -- "$cur"))
15      elif type rpmqpack &>/dev/null; then
16          # SUSE's rpmqpack is faster than rpm -qa
17          COMPREPLY=($(compgen -W '$(rpmqpack)' -- "$cur"))
18      else
19          COMPREPLY=($(${1:-rpm} -qa --nodigest --nosignature \
20 -            --queryformat='%{NAME} ' "$cur*" 2>/dev/null))
21 +            --queryformat='%{NAME}-%{VERSION}-%{RELEASE}\n' 2>/dev/null | while read x ; do [[ "$x" == "$cur"* ]] && echo $x ; done))
22      fi
23  }
24