]> git.pld-linux.org Git - packages/bash-completion.git/blob - bash-completion-rpm-cache.patch
- remove rpmpkgs.txt completely
[packages/bash-completion.git] / bash-completion-rpm-cache.patch
1 --- bash-completion/bash_completion~    2009-04-02 18:56:57.000000000 +0300
2 +++ bash-completion/bash_completion     2009-04-02 18:58:54.003383671 +0300
3 @@ -1836,29 +1836,26 @@
4  #
5  _rpm_installed_packages()
6  {
7 -       local ver nodig nosig
8 +       # if rpm (4.4.7+) is configured to export it's rpmdb to /var/cache/hrmib (%_hrmib_path)
9 +       if [ -d /var/cache/hrmib -a -r /var/cache/hrmib ]; then
10 +               COMPREPLY=( $( LC_ALL=C command ls -1 /var/cache/hrmib | sed -ne '/^'$cur'/p') )
11 +               return
12 +       fi
13 +
14 +       # refresh cache if writable
15 +       if [ /var/log/rpmpkgs -ot /var/lib/rpm/Packages -a -w /var/log/rpmpkgs ]; then
16 +               # we grab the output to local variable to prevent possible race
17 +               local tmp=$(rpm -qa --nodigest --nosignature --qf '%{name}-%{version}-%{release}.%{arch}.rpm\n' | LC_ALL=C sort)
18 +               echo "$tmp" > /var/log/rpmpkgs
19 +       fi
20  
21 -       if [ -r /var/log/rpmpkgs -a \
22 -               /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
23 +       if [ -r /var/log/rpmpkgs -a /var/log/rpmpkgs -nt /var/lib/rpm/Packages ]; then
24                 # using RHL 7.2 or later - this is quicker than querying the DB
25                 COMPREPLY=( $( sed -ne \
26 -               's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+.*\.rpm$|\1|p' \
27 -                               /var/log/rpmpkgs ) )
28 +               's|^\('$cur'.*\)\.rpm$|\1|p' \
29 +                               /var/log/rpmpkgs ) )
30         else
31 -               nodig=""
32 -               nosig=""
33 -               ver=$(rpm --version)
34 -               ver=${ver##* }
35 -
36 -               if [[ "$ver" > "4.0.4" ]]; then
37 -                       nodig="--nodigest"
38 -               fi
39 -               if [[ "$ver" > "4.0.99" ]]; then
40 -                       nosig="--nosignature"
41 -               fi
42 -
43 -               COMPREPLY=( $( rpm -qa $nodig $nosig | sed -ne \
44 -               's|^\('$cur'.*\)-[0-9a-zA-Z._]\+-[0-9a-z.@]\+$|\1|p' ) )
45 +               COMPREPLY=( $( rpm -qa --nodigest --nosignature --qf '%{name}-%{version}-%{release}.%{arch}\n' "$cur*" ) )
46         fi
47  }
48  
This page took 0.126852 seconds and 3 git commands to generate.