Files
anvil/conf/templates/packaging/specs/openstack-keystone.spec
Alessio Ababilov 052daddfd7 Build OpenStack packages from custom specs
Maintain spec files for OpenStack packages. Start OpenStack daemons
as native system services under different users. Write configuration
to /etc.

Implements: blueprint different-openstack-users
Implements: blueprint purge-config
Implements: blueprint package-novnc

Change-Id: I454c1e88011c75997d879bf8b90cd87c8db3f123
2013-06-17 19:54:07 -07:00

163 lines
3.8 KiB
RPMSpec

#encoding UTF-8
# Based on spec by:
# * Andrey Brindeyev <abrindeyev@griddynamics.com>
# * Alessio Ababilov <aababilov@griddynamics.com>
%global python_name keystone
%global daemon_prefix openstack-keystone
%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
Name: openstack-keystone
Epoch: 1
Version: $version
Release: 1%{?dist}
Url: http://www.openstack.org
Summary: Openstack Identity Service
License: Apache 2.0
Vendor: Openstack Foundation
Group: Applications/System
Source0: %{python_name}-%{version}.tar.gz
Source1: openstack-keystone-all.init
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
Requires(post): chkconfig
Requires(postun): initscripts
Requires(preun): chkconfig
Requires(pre): shadow-utils
Requires: python-keystone = %{epoch}:%{version}-%{release}
%description
Keystone is a Python implementation of the OpenStack
(http://www.openstack.org) identity service API.
This package contains the Keystone daemon.
%if 0%{?with_doc}
%package doc
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{epoch}:%{version}-%{release}
%description doc
Keystone is a Python implementation of the OpenStack
(http://www.openstack.org) identity service API.
This package contains documentation for Keystone.
%endif
%package -n python-keystone
Summary: Keystone Python libraries
Group: Development/Languages/Python
#for $i in $requires
Requires: ${i}
#end for
%description -n python-keystone
Keystone is a Python implementation of the OpenStack
(http://www.openstack.org) identity service API.
This package contains the Keystone Python library.
#raw
%prep
%setup -q -n %{python_name}-%{version}
%build
python setup.py build
%install
%__rm -rf %{buildroot}
%if 0%{?with_doc}
export PYTHONPATH="$PWD:$PYTHONPATH"
pushd doc
sphinx-build -b html source build/html
popd
# Fix hidden-file-or-dir warnings
rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo
%endif
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
install -d -m 755 %{buildroot}%{_sysconfdir}/keystone
install -m 644 etc/* %{buildroot}%{_sysconfdir}/keystone
install -d -m 755 %{buildroot}%{_sharedstatedir}/keystone
install -d -m 755 %{buildroot}%{_localstatedir}/log/keystone
install -d -m 755 %{buildroot}%{_localstatedir}/run/keystone
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/%{daemon_prefix}-all
%__rm -rf %{buildroot}%{py_sitelib}/{doc,tools}
%clean
%__rm -rf %{buildroot}
%pre
getent group keystone >/dev/null || groupadd -r keystone
getent passwd keystone >/dev/null || \
useradd -r -g keystone -d %{_sharedstatedir}/keystone -s /sbin/nologin \
-c "OpenStack Keystone Daemons" keystone
exit 0
%preun
if [ $1 = 0 ] ; then
/sbin/service %{daemon_prefix}-all stop &>/dev/null
/sbin/chkconfig --del %{daemon_prefix}-all
exit 0
fi
%postun
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/sbin/service %{daemon_prefix}-all condrestart &>/dev/null
exit 0
fi
%files
%defattr(-,root,root,-)
%doc README.rst HACKING.rst LICENSE
%{_usr}/bin/*
%config(noreplace) %{_sysconfdir}/keystone
%dir %attr(0755, keystone, nobody) %{_sharedstatedir}/keystone
%dir %attr(0755, keystone, nobody) %{_localstatedir}/log/keystone
%dir %attr(0755, keystone, nobody) %{_localstatedir}/run/keystone
%{_initrddir}/*
%if 0%{?with_doc}
%files doc
%defattr(-,root,root,-)
%doc doc
%endif
%files -n python-keystone
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/*
%changelog
#endraw