cloudkitty/contrib/cloudkitty.spec.in
Aaron-DH a98d3b99e4 Load wsgi app(api) with paste.deploy
More scalable to add a filter

Change-Id: Ib5d3bd16d2bfbafc5a0aa5ef3b8db780e3b97520
2016-01-02 13:42:13 +08:00

186 lines
5.1 KiB
RPMSpec

%global release_name juno
%global full_release cloudkitty-%{version}
Name: cloudkitty
Summary: OpenStack Rating (cloudkitty)
Version: @VERSION@
Release: 1%{?dist}
License: ASL 2.0
Group: System Environment/Base
URL: http://github.com/openstack/cloudkitty
Source0: %{full_release}.tar.gz
BuildArch: noarch
BuildRequires: git
BuildRequires: python-ceilometerclient
BuildRequires: python-keystoneclient
BuildRequires: python-stevedore
BuildRequires: python-oslo-messaging
BuildRequires: python-setuptools
BuildRequires: python-sphinx
BuildRequires: python-oslo-config
BuildRequires: python-oslo-sphinx
BuildRequires: python-oslo-i18n
BuildRequires: python-oslo-db
BuildRequires: python-oslo-utils
BuildRequires: python-pbr
BuildRequires: python-pecan
BuildRequires: python-paste-deploy
BuildRequires: python-six
BuildRequires: python-sqlalchemy
BuildRequires: python-werkzeug
BuildRequires: python-wsme
BuildRequires: systemd-units
Requires: %{name}-common = %{version}-%{release}
Requires: %{name}-api = %{version}-%{release}
Requires: %{name}-processor = %{version}-%{release}
%prep
%setup -q -n %{full_release}
# make doc build compatible with python-oslo-sphinx RPM
sed -i 's/oslosphinx/oslo_sphinx/' doc/source/conf.py
# Remove the requirements file so that pbr hooks don't add it
# to distutils requires_dist config
rm -rf {test-,}requirements.txt tools/{pip,test}-requires
%build
%{__python} setup.py build
%install
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
mkdir -p %{buildroot}/var/log/cloudkitty/
mkdir -p %{buildroot}/var/run/cloudkitty/
install -p -D -m 644 contrib/cloudkitty.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/cloudkitty
# install systemd unit files
install -p -D -m 644 contrib/init/cloudkitty-api.service %{buildroot}%{_unitdir}/cloudkitty-api.service
install -p -D -m 644 contrib/init/cloudkitty-processor.service %{buildroot}%{_unitdir}/cloudkitty-processor.service
mkdir -p %{buildroot}/var/lib/cloudkitty/
mkdir -p %{buildroot}/etc/cloudkitty/
# we need to package sphinxcontrib-pecanwsme for this to work
#export PYTHONPATH="$( pwd ):$PYTHONPATH"
#pushd doc
#sphinx-build -b html -d build/doctrees source build/html
#popd
install -p -D -m 640 etc/cloudkitty/cloudkitty.conf.sample %{buildroot}/%{_sysconfdir}/cloudkitty/cloudkitty.conf
install -p -D -m 640 etc/cloudkitty/policy.json %{buildroot}/%{_sysconfdir}/cloudkitty/policy.json
install -p -D -m 640 etc/cloudkitty/api_paste.ini %{buildroot}/%{_sysconfdir}/cloudkitty/api_paste.ini
%description
OpenStack Rating-as-a-Service
%package common
Summary: CloudKitty common
Group: System Environment/Base
Requires: python-ceilometerclient
Requires: python-keystoneclient
Requires: python-stevedore
Requires: python-oslo-messaging
Requires: python-setuptools
Requires: python-oslo-config
Requires: python-oslo-i18n
Requires: python-oslo-db
Requires: python-oslo-utils
Requires: python-pecan
Requires: python-paste-deploy
Requires: python-six
Requires: python-sqlalchemy
Requires: python-werkzeug
Requires: python-wsme
Requires(pre): shadow-utils
%description common
Components common to all CloudKitty services
%files common
%doc LICENSE
%{_bindir}/cloudkitty-dbsync
%{_bindir}/cloudkitty-storage-init
%{_bindir}/cloudkitty-writer
%{python_sitelib}/cloudkitty*
%dir %attr(0755,cloudkitty,root) %{_localstatedir}/log/cloudkitty
%dir %attr(0755,cloudkitty,root) %{_localstatedir}/run/cloudkitty
%dir %attr(0755,cloudkitty,root) %{_sharedstatedir}/cloudkitty
%dir %attr(0755,cloudkitty,root) %{_sysconfdir}/cloudkitty
%config(noreplace) %{_sysconfdir}/logrotate.d/cloudkitty
%config(noreplace) %attr(-, root, cloudkitty) %{_sysconfdir}/cloudkitty/cloudkitty.conf
%config(noreplace) %attr(-, root, cloudkitty) %{_sysconfdir}/cloudkitty/policy.json
%config(noreplace) %attr(-, root, cloudkitty) %{_sysconfdir}/cloudkitty/api_paste.ini
%pre common
getent group cloudkitty >/dev/null || groupadd -r cloudkitty
getent passwd cloudkitty >/dev/null || \
useradd -r -g cloudkitty -d %{_sharedstatedir}/cloudkitty -s /sbin/nologin \
-c "CloudKitty Daemons" cloudkitty
exit 0
%package api
Summary: The CloudKitty API
Group: System Environment/Base
Requires: %{name}-common = %{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description api
CloudKitty API
%files api
%doc README.rst LICENSE
%{_bindir}/cloudkitty-api
%{_unitdir}/cloudkitty-api.service
%post api
%systemd_post cloudkitty-api.service
%preun api
%systemd_preun cloudkitty-api.service
%postun api
%systemd_postun_with_restart cloudkitty-api.service
%package processor
Summary: The CloudKitty processor
Group: System Environment/Base
Requires: %{name}-common = %{version}-%{release}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description processor
CloudKitty processor
%files processor
%doc README.rst LICENSE
%{_bindir}/cloudkitty-processor
%{_unitdir}/cloudkitty-processor.service
%post processor
%systemd_post cloudkitty-processor.service
%preun processor
%systemd_preun cloudkitty-processor.service
%postun processor
%systemd_postun_with_restart cloudkitty-processor.service
%changelog
* Thu Nov 13 2014 Gauvain Pocentek <gauvain.pocentek@objectif-libre.com> - @VERSION@
- Initial release