From 6325206b1656203521509ff6ccbff209baa09a88 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Sat, 22 Mar 2014 05:10:28 -0700 Subject: [PATCH] packaging: fix up spec file for non-python files Correct the installation of the binary, logrotate conf, and init script. Stop using INSTALLED_FILES. Instead explicitly list files and glob the python package, as recommended by Fedora's python packaging guide. Signed-off-by: Josh Durgin --- MANIFEST.in | 5 +++++ radosgw-agent.spec | 20 ++++++++++++++------ scripts/radosgw-agent | 21 +++++++++++++++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 MANIFEST.in create mode 100644 scripts/radosgw-agent diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..03f1191 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,5 @@ +include LICENSE +include scripts/radosgw-agent +include init-radosgw-agent +include logrotate.conf +prune radosgw_agent/tests diff --git a/radosgw-agent.spec b/radosgw-agent.spec index 8485525..0dddbdc 100644 --- a/radosgw-agent.spec +++ b/radosgw-agent.spec @@ -30,18 +30,26 @@ UNKNOWN %build python setup.py build -install -D init-radosgw-agent $RPM_BUILD_ROOT%{_initrddir}/radosgw-agent %install -python setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES +python setup.py install --single-version-externally-managed -O1 --root=$RPM_BUILD_ROOT +install -m 0755 -D scripts/radosgw-agent $RPM_BUILD_ROOT%{_bindir}/radosgw-agent install -m 0644 -D logrotate.conf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/radosgw-agent +install -m 0755 -D init-radosgw-agent $RPM_BUILD_ROOT%{_initrddir}/radosgw-agent +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/ceph/radosgw-agent +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/ceph/radosgw-agent +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/ceph/radosgw-agent %clean rm -rf $RPM_BUILD_ROOT -%files -f INSTALLED_FILES +%files %defattr(-,root,root) -%dir %{_sysconfdir}/ceph/radosgw-agent/ -%dir %{_localstatedir}/log/ceph/radosgw-agent/ -%dir %{_localstatedir}/run/ceph/radosgw-agent/ +%doc LICENSE +%dir %{_sysconfdir}/ceph/radosgw-agent +%dir %{_localstatedir}/log/ceph/radosgw-agent +%dir %{_localstatedir}/run/ceph/radosgw-agent %config(noreplace) %{_sysconfdir}/logrotate.d/radosgw-agent +%{_bindir}/radosgw-agent +%{_initrddir}/radosgw-agent +%{python_sitelib}/radosgw_agent*/ diff --git a/scripts/radosgw-agent b/scripts/radosgw-agent new file mode 100644 index 0000000..e59d143 --- /dev/null +++ b/scripts/radosgw-agent @@ -0,0 +1,21 @@ +#!/usr/bin/env python +import os +import platform +import sys +""" +radosgw-agent - admin tool for ceph +""" + +if os.path.exists('/usr/share/pyshared/radosgw_agent'): + sys.path.insert(0,'/usr/share/pyshared/radosgw_agent') +elif os.path.exists('/usr/share/radosgw-agent'): + sys.path.insert(0,'/usr/share/radosgw-agent') +elif os.path.exists('/usr/share/pyshared/radosgw-agent'): + sys.path.insert(0,'/usr/share/pyshared/radosgw-agent') +elif os.path.exists('/usr/lib/python2.6/site-packages/radosgw_agent'): + sys.path.insert(0,'/usr/lib/python2.6/site-packages/radosgw_agent') + +from radosgw_agent.cli import main + +if __name__ == '__main__': + sys.exit(main()) -- 2.47.3