File openstack-keystone.spec of Package openstack-keystone
#
# spec file for package openstack-keystone
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2011 B1 Systems GmbH, Vohburg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# options to forcefully build with/without vcs
%bcond_with from_vcs
%bcond_with no_from_vcs
%if %{with from_vcs}
%define BUILD_FROM_VCS 1
%endif
%if %{with no_from_vcs}
%define BUILD_FROM_VCS 0
%endif
# disable doc build on 12.1+ because of sphinx segfault
%if 0%{?suse_version} >= 1210
%global with_doc 0
%else
%global with_doc 1
%endif
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
# fix broken macro in older distros
%{!?_initddir: %global _initddir %{_initrddir}}
%if 0%{?BUILD_FROM_VCS}
%define vcs_summary_warn -- Git Snapshot
%else
%define vcs_summary_warn %null
%endif
%define shortname keystone
# for special number in current tarball source version
%define rversion 2011.3-0-g61148fb
Name: openstack-keystone
Version: 2011.3.1
%if 0%{?BUILD_FROM_VCS}
%define _version git-master
%else
%define _version %{rversion}
%endif
Release: 1.0
License: Apache-2.0
Summary: OpenStack Identity Service %{name} %{vcs_summary_warn}
Url: http://github.com/rackspace/keystone
Group: Development/Languages/Python
%if 0%{?BUILD_FROM_VCS}
%define srcname keystone
%else
%define srcname openstack-keystone
%endif
Source0: %{srcname}-%{_version}.tar.gz
Source1: %{name}.init
Patch0: %{name}.patch
Patch2: openstack-keystone-auth-access.diff
BuildRequires: fdupes
%if 0%{?suse_version}
BuildRequires: python-devel
BuildRequires: python-distribute
%endif
%if 0%{?fedora}
BuildRequires: python2-devel
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: python-keystone = %{version}
%if 0%{?suse_version} > 1110
Requires(pre): pwdutils
%else
Requires(pre): shadow-utils
%endif
%if 0%{?fedora}
Requires(pre): shadow-utils
%endif
%define sharedstatedir %{_localstatedir}/lib
%description
Keystone is a proposed independent authentication service for OpenStack.
This initial proof of concept aims to address the current use cases in Swift and Nova which are:
REST-based, token auth for Swift
many-to-many relationship between identity and tenant for Nova.
# ----- python-keystone
%package -n python-keystone
Summary: OpenStack python-keystone %{vcs_summary_warn}
Group: Development/Languages/Python
Requires: python-eventlet
Requires: python-httplib2
Requires: python-passlib
Requires: python-lxml
Requires: python-ldap
Requires: python-memcached
Requires: python-routes
Requires: python-sqlalchemy
Requires: python-webob
%if 0%{?suse_version}
Requires: curl
Requires: python-boto
Requires: python-Paste
Requires: python-pastedeploy
Requires: python-PasteScript
Requires: python-pysqlite
%endif
%if 0%{?fedora}
Requires: python-paste
Requires: python-paste-deploy
Requires: python-paste-script
Requires: python-sqlite2
%endif
%description -n python-keystone
This package contains the python files for keystone for OpenStack.
# ----- doc
%if 0%{?with_doc}
%package doc
Summary: Documentation for %{name} %{vcs_summary_warn}
Group: Documentation/HTML
%if 0%{?suse_version}
BuildRequires: python-Sphinx
%endif
%if 0%{?fedora}
BuildRequires: python-sphinx >= 1.0
%endif
%description doc
Keystone is a proposed independent authentication service for OpenStack.
This initial proof of concept aims to address the current use cases in Swift and Nova which are:
REST-based, token auth for Swift
many-to-many relationship between identity and tenant for Nova.
This package contains documentation files for %{name}.
%endif
%prep
%if 0%{?BUILD_FROM_VCS}
%setup -q -n keystone-%{_version}
%else
%setup -q -n openstack-keystone-61148fb/
%patch0
%patch2
%endif
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%if 0%{?with_doc}
export PYTHONPATH="$( pwd ):$PYTHONPATH"
pushd doc
sphinx-build -b html source build/html
popd
%endif
# Fix hidden-file-or-dir warning
find %{buildroot} -name "*.placeholder" | xargs rm
%if 0%{?with_doc}
rm -rf doc/build/html/.doctrees doc/build/html/.buildinfo
%endif
install -d -m 0755 %{buildroot}%{_sysconfdir}/keystone
cp etc/* %{buildroot}%{_sysconfdir}/keystone/
install -p -D -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name}
mkdir -p %{buildroot}%{_sbindir}
ln -s ../..%{_initrddir}/%{name} %{buildroot}%{_sbindir}/rc%{name}
install -d -m 755 %{buildroot}%{_localstatedir}/lib/keystone
install -d -m 755 %{buildroot}%{_localstatedir}/log/keystone
# Fix files-duplicate warning
%if 0%{?suse_version}
%fdupes %{buildroot}%{python_sitelib}
%if 0%{?with_doc}
%fdupes -s doc/build/html/
%endif
%endif
%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 Daemon" keystone
exit 0
%post
%fillup_and_insserv %{name}
%restart_on_update %{name}
%preun
%stop_on_removal %{name}
%postun
%insserv_cleanup
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root)
%dir %{_sysconfdir}/keystone
%dir %attr(0755, keystone, root) %{_localstatedir}/lib/keystone
%dir %attr(0755, keystone, root) %{_localstatedir}/log/keystone
%config(noreplace) %{_sysconfdir}/keystone/keystone.conf
%config(noreplace) %{_sysconfdir}/keystone/logging.cnf
%if 0%{?BUILD_FROM_VCS}
%config(noreplace) %{_sysconfdir}/keystone/memcache.conf
%config(noreplace) %{_sysconfdir}/keystone/ssl.conf
%endif
%{_initrddir}/%{name}
%{_sbindir}/rc%{name}
%{_bindir}/keystone
%{_bindir}/keystone-admin
%{_bindir}/keystone-auth
%{_bindir}/keystone-manage
%if 0%{?BUILD_FROM_VCS}
%{_bindir}/keystone-control
%{_bindir}/keystone-import
%endif
%files -n python-keystone
%defattr(-,root,root,-)
%{python_sitelib}
%doc LICENSE
%if 0%{?with_doc}
%files doc
%defattr(-,root,root,-)
%doc LICENSE doc/build/html
%endif
%changelog