[Rpm-metadata] [PATCH] move bash-completion scripts to /usr/share/ BZ 923001

Zdenek Pavlas zpavlas at redhat.com
Wed Mar 20 11:06:08 UTC 2013


---
 Makefile        | 7 +++++--
 createrepo.spec | 5 ++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 60bb9db..356bb50 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 PKGNAME = createrepo
+ALIASES = mergerepo modifyrepo genpkgmetadata.py mergerepo.py modifyrepo.py
 VERSION=$(shell awk '/Version:/ { print $$2 }' ${PKGNAME}.spec)
 RELEASE=$(shell awk '/Release:/ { print $$2 }' ${PKGNAME}.spec)
 CVSTAG=createrepo-$(subst .,_,$(VERSION)-$(RELEASE))
@@ -26,6 +27,7 @@ docdir =
 includedir = ${prefix}/include
 oldincludedir = /usr/include
 mandir = ${prefix}/share/man
+compdir = $(shell pkg-config --variable=completionsdir bash-completion)
 
 pkgdatadir = $(datadir)/$(PKGNAME)
 pkglibdir = $(libdir)/$(PKGNAME)
@@ -33,7 +35,7 @@ pkgincludedir = $(includedir)/$(PKGNAME)
 top_builddir = 
 
 # all dirs
-DIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(sysconfdir)/bash_completion.d \
+DIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(compdir) \
 	$(DESTDIR)$(pkgdatadir) $(DESTDIR)$(mandir)
 
 
@@ -65,7 +67,8 @@ check:
 
 install: all installdirs
 	$(INSTALL_MODULES) $(srcdir)/$(MODULES) $(DESTDIR)$(pkgdatadir)
-	$(INSTALL_DATA) $(PKGNAME).bash $(DESTDIR)$(sysconfdir)/bash_completion.d
+	$(INSTALL_DATA) $(PKGNAME).bash $(DESTDIR)$(compdir)/$(PKGNAME)
+	(cd $(DESTDIR)$(compdir); for n in $(ALIASES); do ln -s $(PKGNAME) $$n; done)
 	for subdir in $(SUBDIRS) ; do \
 	  $(MAKE) -C $$subdir install VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
 	done
diff --git a/createrepo.spec b/createrepo.spec
index eea7092..46992c0 100644
--- a/createrepo.spec
+++ b/createrepo.spec
@@ -1,4 +1,7 @@
 %{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
+# disable broken /usr/lib/rpm/brp-python-bytecompile
+%define __os_install_post %{nil}
+%define compdir %(pkg-config --variable=completionsdir bash-completion)
 
 Summary: Creates a common metadata repository
 Name: createrepo
@@ -32,7 +35,7 @@ make DESTDIR=$RPM_BUILD_ROOT sysconfdir=%{_sysconfdir} install
 %defattr(-, root, root)
 %dir %{_datadir}/%{name}
 %doc ChangeLog README COPYING COPYING.lib
-%{_sysconfdir}/bash_completion.d/
+%{compdir)
 %{_datadir}/%{name}/*
 %{_bindir}/%{name}
 %{_bindir}/modifyrepo
-- 
1.7.11.7



More information about the Rpm-metadata mailing list