Discussion:
[PATCH] move bash-completion scripts to /usr/share/ BZ 923001
Zdenek Pavlas
2013-03-20 11:06:08 UTC
Permalink
---
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
Ville Skyttä
2013-03-25 20:40:43 UTC
Permalink
Post by Zdenek Pavlas
-%{_sysconfdir}/bash_completion.d/
+%{compdir)
%{compdir} usually expands to /usr/share/bash-completion/completions so
the above would leave the parent /usr/share/bash-completion dir unowned.
In that scenario using %(dirname %{compdir}) would be a fix.
Zdenek Pavlas
2013-03-27 12:09:13 UTC
Permalink
Post by Ville Skyttä
the above would leave the parent /usr/share/bash-completion dir unowned.
/usr/share/bash-completion is owned by package bash-completion.
Why should yum or createrepo own it, too?
Post by Ville Skyttä
In that scenario using %(dirname %{compdir}) would be a fix.
Ville Skyttä
2013-03-27 19:06:33 UTC
Permalink
Post by Zdenek Pavlas
Post by Ville Skyttä
the above would leave the parent /usr/share/bash-completion dir unowned.
/usr/share/bash-completion is owned by package bash-completion.
Why should yum or createrepo own it, too?
Because they don't have a dependency on bash-completion.

http://fedoraproject.org/wiki/Packaging:Guidelines#File_and_Directory_Ownership
Loading...