File openstack-keystone.spec of Package openstack-keystone

#
# spec file for package openstack-keystone
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           openstack-keystone
Version:        14.2.1~dev4
Release:        0
Summary:        OpenStack Identity Service
License:        Apache-2.0
Group:          Applications/System
URL:            https://launchpad.net/keystone
Source0:        keystone-stable-rocky.tar.gz
Source1:        openstack-keystone.logrotate
Source2:        openstack-keystone.sysctl
Source3:        openstack-keystone.tmpfiles
Source4:        openstack-keystone.defaultconf
Source5:        openstack-keystone.README.config
BuildRequires:  openstack-macros
BuildRequires:  python3-Flask
BuildRequires:  python3-Flask-RESTful
BuildRequires:  python3-WebTest
BuildRequires:  python3-bcrypt
BuildRequires:  python3-devel
BuildRequires:  python3-fixtures
BuildRequires:  python3-freezegun
BuildRequires:  python3-jsonschema
BuildRequires:  python3-keystonemiddleware
BuildRequires:  python3-ldappool
BuildRequires:  python3-lxml
BuildRequires:  python3-mock
BuildRequires:  python3-oauthlib
BuildRequires:  python3-oslo.cache
BuildRequires:  python3-oslo.config
BuildRequires:  python3-oslo.db
BuildRequires:  python3-oslo.messaging
BuildRequires:  python3-oslo.policy
BuildRequires:  python3-oslotest
BuildRequires:  python3-osprofiler
BuildRequires:  python3-passlib
BuildRequires:  python3-pbr
BuildRequires:  python3-pysaml2
BuildRequires:  python3-requests
BuildRequires:  python3-scrypt
BuildRequires:  python3-sqlparse
BuildRequires:  python3-stestr
BuildRequires:  python3-testresources
BuildRequires:  python3-testscenarios
BuildRequires:  python3-testtools
BuildRequires:  which
Requires:       python3-keystone = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  libxmlsec1-openssl1
Requires(pre):  pwdutils
%endif
%if 0%{?rdo}
BuildRequires:  xmlsec1-openssl
Requires(pre):  shadow-utils
%endif

%description
Keystone is a Python implementation of the OpenStack
(http://www.openstack.org) identity service API.
.
This package contains the keystone python libraries.

%package -n     python3-keystone
Summary:        Keystone Python libraries
Group:          Applications/System
Requires:       python3-Babel
Requires:       python3-Flask
Requires:       python3-Flask-RESTful
Requires:       python3-Paste
Requires:       python3-PasteDeploy
Requires:       python3-PyMySQL
Requires:       python3-Routes
Requires:       python3-SQLAlchemy
Requires:       python3-WebOb
Requires:       python3-bcrypt
Requires:       python3-cryptography
Requires:       python3-dogpile.cache
Requires:       python3-jsonschema
Requires:       python3-keystoneclient
Requires:       python3-keystonemiddleware
Requires:       python3-ldappool
Requires:       python3-msgpack
Requires:       python3-oauthlib
Requires:       python3-oslo.cache
Requires:       python3-oslo.concurrency
Requires:       python3-oslo.config
Requires:       python3-oslo.context
Requires:       python3-oslo.db
Requires:       python3-oslo.i18n
Requires:       python3-oslo.log
Requires:       python3-oslo.messaging
Requires:       python3-oslo.middleware
Requires:       python3-oslo.policy
Requires:       python3-oslo.serialization
Requires:       python3-oslo.utils
Requires:       python3-osprofiler
Requires:       python3-passlib
Requires:       python3-pbr
Requires:       python3-pycadf
Requires:       python3-pysaml2
Requires:       python3-python-memcached
Requires:       python3-six
Requires:       python3-sqlalchemy-migrate
Requires:       python3-stevedore
%if 0%{?suse_version}
Requires:       python3-pyldap
%endif
%if 0%{?rdo}
Requires:       python-ldap
%endif

%description -n   python3-keystone
Keystone is a Python implementation of the OpenStack
(https://docs.openstack.org/developer/keystone/) identity service API.
This package contains the Keystone Python library.

%package -n python3-keystone-tests
Summary:        Keystone tests
Group:          Applications/System
Requires:       openstack-keystone = %{version}-%{release}
Provides:       python-keystone-tests = %{version}-%{release}

%description -n python3-keystone-tests
Keystone is a Python implementation of the OpenStack
(https://docs.openstack.org/developer/keystone/) identity service API.

This package contains the Keystone test files.

%package doc
Summary:        Documentation for OpenStack Identity Service
Group:          Documentation/HTML
BuildRequires:  python-PasteDeploy
BuildRequires:  python-Routes
BuildRequires:  python-Sphinx
BuildRequires:  python-cryptography
BuildRequires:  python-dogpile.cache
BuildRequires:  python-jsonschema
BuildRequires:  python-keystonemiddleware
BuildRequires:  python-ldappool
BuildRequires:  python-msgpack
BuildRequires:  python-oauthlib
BuildRequires:  python-openstackdocstheme
BuildRequires:  python-oslo.concurrency
BuildRequires:  python-oslo.db
BuildRequires:  python-oslo.i18n
BuildRequires:  python-oslo.log
BuildRequires:  python-oslo.messaging
BuildRequires:  python-oslo.middleware
BuildRequires:  python-oslo.policy
BuildRequires:  python-osprofiler
BuildRequires:  python-passlib
BuildRequires:  python-pysaml2
BuildRequires:  python-python-memcached
BuildRequires:  python-sphinxcontrib-apidoc

%description doc
OpenStack Keystone documentaion.
.
This package contains the documentation

%prep
%autosetup -p1 -n keystone-14.2.1.dev4
%py_req_cleanup
%if 0%{?rdo}
find . \( -name .gitignore -o -name .placeholder \) -delete
find keystone -name \*.py -exec sed -i '/\/usr\/bin\/env python/d' {} \;
# adjust paths to WSGI scripts
sed -i 's#/local/bin#/bin#' httpd/wsgi-keystone.conf
sed -i 's#apache2#httpd#' httpd/wsgi-keystone.conf
%endif
sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg

%build
%{py3_build}
PYTHONPATH=. PBR_VERSION=14.2.1.dev4 sphinx-build -b html doc/source doc/build/html
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
# config file generation
oslo-config-generator --config-file config-generator/keystone.conf \
--output-file etc/keystone.conf.sample
# policy file generation
oslopolicy-sample-generator --config-file config-generator/keystone-policy-generator.conf --output-file etc/keystone.policy.yaml

%install
%{py3_install}
install -d -m 755 %{buildroot}%{_sysconfdir}/keystone
install -d -m 755 %{buildroot}%{_sysconfdir}/sysctl.d
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log}/keystone
install -d -m 750 %{buildroot}%{_localstatedir}/cache/keystone
install -d -m 755 %{buildroot}%{_sysconfdir}/keystone/keystone.conf.d/
# default dir for fernet tokens
install -d -m 750 %{buildroot}%{_sysconfdir}/keystone/credential-keys/
install -D -m 644 %{SOURCE3} %{buildroot}/%{_tmpfilesdir}/keystone.conf
install -p -D -m 640 etc/keystone.conf.sample %{buildroot}%{_sysconfdir}/keystone/keystone.conf
install -D -m 640 %{SOURCE4} %{buildroot}/%{_sysconfdir}/keystone/keystone.conf.d/010-keystone.conf
install -D -m 440 %{SOURCE5} %{buildroot}/%{_sysconfdir}/keystone/README.config
install -p -D -m 640 etc/logging.conf.sample %{buildroot}%{_sysconfdir}/keystone/logging.conf
install -p -D -m 640 etc/keystone-paste.ini %{buildroot}%{_sysconfdir}/keystone/keystone-paste.ini
install -p -D -m 640 etc/keystone.policy.yaml %{buildroot}%{_sysconfdir}/keystone/keystone.policy.yaml
install -p -D -m 640 etc/default_catalog.templates %{buildroot}%{_sysconfdir}/keystone/default_catalog.templates
install -p -D -m 640 etc/sso_callback_template.html %{buildroot}%{_sysconfdir}/keystone/sso_callback_template.html
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-keystone
install -p -D -m 644 etc/policy.v3cloudsample.json %{buildroot}%{_datadir}/keystone/policy.v3cloudsample.json
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysctl.d/openstack-keystone.conf
# remove wrongly installed tree
rm -rv  %{buildroot}/%{_prefix}%{_sysconfdir}/
# Install sample data script.
install -p -D -m 755 tools/sample_data.sh %{buildroot}%{_datadir}/keystone/sample_data.sh
# Install apache configuration files
install -p -D -m 644 httpd/wsgi-keystone.conf  %{buildroot}%{_datadir}/keystone/

%pre
%openstack_pre_user_group_create keystone keystone /sbin/nologin
exit 0

%check
# don't want to depend on hacking for package building
rm keystone/tests/unit/test_hacking_checks.py
%if 0%{?suse_version}
PYTHON=python3 stestr run --black-regex keystone.tests.unit.test_policy.GeneratePolicyFileTestCase.test_policy_generator_from_command_line
%endif
%if 0%{?rdo}
stestr-3 run --black-regex keystone.tests.unit.test_policy.GeneratePolicyFileTestCase.test_policy_generator_from_command_line
%endif

%post
%tmpfiles_create %{_tmpfilesdir}/keystone.conf
%sysctl_apply openstack-keystone.conf

%files
%license LICENSE
%doc README.rst
%{_bindir}/keystone-wsgi-admin
%{_bindir}/keystone-wsgi-public
%{_bindir}/keystone-manage
%_tmpfilesdir/keystone.conf
%dir %{_datadir}/keystone
%attr(0644, root, keystone) %{_datadir}/keystone/policy.v3cloudsample.json
%attr(0755, root, root) %{_datadir}/keystone/sample_data.sh
%attr(0644, root, keystone) %{_datadir}/keystone/wsgi-keystone.conf
%dir %attr(0750, root, keystone) %{_sysconfdir}/keystone/
%dir %attr(0750, root, keystone) %{_sysconfdir}/keystone/keystone.conf.d/
%{_sysconfdir}/keystone/README.config
%config(noreplace) %attr(0640, root, keystone) %{_sysconfdir}/keystone/keystone.conf
%config(noreplace) %attr(0640, root, keystone) %{_sysconfdir}/keystone/keystone.conf.d/010-keystone.conf
%config(noreplace) %attr(0640, root, keystone) %{_sysconfdir}/keystone/keystone-paste.ini
%config(noreplace) %attr(0640, root, keystone) %{_sysconfdir}/keystone/logging.conf
%config(noreplace) %attr(0640, root, keystone) %{_sysconfdir}/keystone/default_catalog.templates
%config(noreplace) %attr(0640, keystone, keystone) %{_sysconfdir}/keystone/keystone.policy.yaml
%config(noreplace) %attr(0640, keystone, keystone) %{_sysconfdir}/keystone/sso_callback_template.html
%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-keystone
%dir %attr(0750, keystone, keystone) %{_localstatedir}/lib/keystone
%dir %attr(0750, keystone, keystone) %{_localstatedir}/log/keystone
%dir %attr(0750, keystone, keystone) %{_localstatedir}/cache/keystone
%{_sysconfdir}/sysctl.d/openstack-keystone.conf

%files -n python3-keystone
%defattr(-,root,root,-)
%doc README.rst
%license LICENSE
%{python3_sitelib}/keystone*
%{python3_sitelib}/keystone-*.egg-info
%exclude %{python3_sitelib}/keystone/tests

%files -n python3-keystone-tests
%license LICENSE
%{python3_sitelib}/keystone/tests

%files doc
%license LICENSE
%doc doc/build/html

%changelog
openSUSE Build Service is sponsored by