[yum-commits] 2 commits - etc/Makefile etc/yum.bash Makefile yum.spec

zpavlas at osuosl.org zpavlas at osuosl.org
Wed Mar 27 14:42:55 UTC 2013


 Makefile     |    2 +-
 etc/Makefile |    7 +++++--
 etc/yum.bash |    8 ++++++++
 yum.spec     |   10 +++++++++-
 4 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit b6c156626b897591f6b39e8f5432570df78824de
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Mon Mar 11 09:38:50 2013 +0100

    faster bash completion of available packages.  BZ 919852
    
    With "export YUM_CACHEDIR=/var/cache/yum" the shortcut code
    is enabled.  Cached package databases are queried directly
    with no filtering, so more packages might be offered:
    
    1) disabled repositories are used
    2) excludes are not processed
    3) no compatible arch check
    4) no rpmdb check
    
    ..but it's about 5 times faster.

diff --git a/etc/yum.bash b/etc/yum.bash
index d741ff9..b319963 100644
--- a/etc/yum.bash
+++ b/etc/yum.bash
@@ -3,6 +3,14 @@
 _yum_helper()
 {
     local IFS=$'\n'
+    if [[ -n "$YUM_CACHEDIR" && "$1 $2" == "list available" ]]; then
+        for db in $(find "$YUM_CACHEDIR" -name primary_db.sqlite); do
+            COMPREPLY+=( $( sqlite3 "$db" \
+                "SELECT name||'.'||arch FROM packages WHERE name LIKE '$3%'"
+            ) )
+        done
+        return
+    fi
     COMPREPLY+=( $(
         /usr/share/yum-cli/completion-helper.py -d 0 -C "$@" 2>/dev/null ) )
 }
commit f0bd91330b11b41f9b991048e283cb9988b603e9
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Tue Mar 19 09:51:43 2013 +0100

    move bash-completion scripts to /usr/share/  BZ 922992

diff --git a/Makefile b/Makefile
index a1c0c0f..9e1d7af 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ install:
 	done
 	chmod 755 $(DESTDIR)/usr/share/yum-cli/completion-helper.py
 	mv $(DESTDIR)/usr/share/yum-cli/yum-updatesd.py $(DESTDIR)/usr/share/yum-cli/yumupd.py
-	$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/usr/share/yum-cli', 1, '$(PYDIR)', 1)"
+	$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/usr/share/yum-cli', 1, '/usr/share/yum-cli', 1)"
 
 	mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/sbin
 	install -m 755 bin/yum.py $(DESTDIR)/usr/bin/yum
diff --git a/etc/Makefile b/etc/Makefile
index ec5af83..99b5137 100644
--- a/etc/Makefile
+++ b/etc/Makefile
@@ -1,4 +1,6 @@
 YUMETC=$(DESTDIR)/etc/yum
+compdir = $(shell pkg-config --variable=completionsdir bash-completion)
+compdir := $(or $(compdir), "/etc/bash_completion.d")
 
 all:
 	echo "Nothing to do"
@@ -25,6 +27,7 @@ install:
 	mkdir -p $(DESTDIR)/etc/dbus-1/system.d/
 	install -m 755 yum-updatesd-dbus.conf $(DESTDIR)/etc/dbus-1/system.d/yum-updatesd.conf
 	install -m 644 yum-updatesd.conf $(YUMETC)
-	mkdir -p $(DESTDIR)/etc/bash_completion.d
-	install -m 644 yum.bash $(DESTDIR)/etc/bash_completion.d
+	mkdir -p $(DESTDIR)/$(compdir)
+	install -m 644 yum.bash $(DESTDIR)/$(compdir)/yum
+	ln -s yum $(DESTDIR)/$(compdir)/yummain.py
 	install -m 644 yum-cron.conf $(YUMETC)
diff --git a/yum.spec b/yum.spec
index ff672de..294eb96 100644
--- a/yum.spec
+++ b/yum.spec
@@ -26,6 +26,13 @@
 %define yum_pluginslib   /usr/lib/yum-plugins
 %define yum_pluginsshare /usr/share/yum-plugins
 
+# disable broken /usr/lib/rpm/brp-python-bytecompile
+%define __os_install_post %{nil}
+%define compdir %(pkg-config --variable=completionsdir bash-completion)
+%if "%{compdir}" == ""
+%define compdir "/etc/bash_completion.d"
+%endif
+
 Summary: RPM package installer/updater/manager
 Name: yum
 Version: 3.4.3
@@ -47,6 +54,7 @@ BuildRequires: python-sqlite
 BuildRequires: python-urlgrabber >= 3.9.0-8
 BuildRequires: yum-metadata-parser >= 1.1.0
 BuildRequires: pygpgme
+BuildRequires: bash-completion
 # End of CheckRequires
 Conflicts: pirut < 1.1.4
 Requires: python >= 2.4
@@ -321,7 +329,7 @@ exit 0
 %dir %{_sysconfdir}/yum/protected.d
 %dir %{_sysconfdir}/yum/vars
 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
-%{_sysconfdir}/bash_completion.d
+%(dirname %{compdir})
 %dir %{_datadir}/yum-cli
 %{_datadir}/yum-cli/*
 %exclude %{_datadir}/yum-cli/completion-helper.py?


More information about the Yum-commits mailing list