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 @@
5 _rpm_installed_packages()
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') )
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
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 ) )
33 - ver=$(rpm --version)
36 - if [[ "$ver" > "4.0.4" ]]; then
39 - if [[ "$ver" > "4.0.99" ]]; then
40 - nosig="--nosignature"
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*" ) )