File openstack-keystone.spec of Package openstack-keystone
#
# spec file for package openstack-keystone
#
# Copyright (c) 2025 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/
#
%global with_doc 1
%if 0%{?rhel} || 0%{?fedora}
%global rdo 1
%endif
Name:           openstack-keystone
Epoch:          0
Version:        26.0.1~dev3
Release:        0
Summary:        OpenStack Identity Service
License:        Apache-2.0
URL:            https://docs.openstack.org/keystone
Source0:        keystone-stable-2024.2.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:  python311-Flask
BuildRequires:  python311-Flask-RESTful
BuildRequires:  python311-WebTest
BuildRequires:  python311-bcrypt
BuildRequires:  python311-fixtures
BuildRequires:  python311-freezegun
BuildRequires:  python311-jsonschema
BuildRequires:  python311-keystonemiddleware
BuildRequires:  python311-ldappool
BuildRequires:  python311-lxml
BuildRequires:  python311-oauthlib
BuildRequires:  python311-oslo.cache
BuildRequires:  python311-oslo.config
BuildRequires:  python311-oslo.db
BuildRequires:  python311-oslo.messaging
BuildRequires:  python311-oslo.policy
BuildRequires:  python311-oslo.upgradecheck
BuildRequires:  python311-oslotest
BuildRequires:  python311-osprofiler
BuildRequires:  python311-passlib
BuildRequires:  python311-pbr
BuildRequires:  python311-pysaml2
BuildRequires:  python311-requests
BuildRequires:  python311-scrypt
BuildRequires:  python311-sqlparse
BuildRequires:  python311-stestr
BuildRequires:  python311-testresources
BuildRequires:  python311-testscenarios
BuildRequires:  python311-testtools
BuildRequires:  which
Requires:       logrotate
Requires:       python3-keystone = %{epoch}:%{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:       python-ldap
Requires:       python3-keystoneclient
Requires:       python311-Babel
Requires:       python311-Flask
Requires:       python311-Flask-RESTful
Requires:       python311-PyJWT
Requires:       python311-SQLAlchemy
Requires:       python311-WebOb
Requires:       python311-bcrypt
Requires:       python311-cryptography
Requires:       python311-dogpile.cache
Requires:       python311-jsonschema
Requires:       python311-keystonemiddleware
Requires:       python311-ldappool
Requires:       python311-msgpack
Requires:       python311-oauthlib
Requires:       python311-oslo.cache
Requires:       python311-oslo.concurrency
Requires:       python311-oslo.config
Requires:       python311-oslo.context
Requires:       python311-oslo.db
Requires:       python311-oslo.i18n
Requires:       python311-oslo.log
Requires:       python311-oslo.messaging
Requires:       python311-oslo.middleware
Requires:       python311-oslo.policy
Requires:       python311-oslo.serialization
Requires:       python311-oslo.upgradecheck
Requires:       python311-oslo.utils
Requires:       python311-osprofiler
Requires:       python311-passlib
Requires:       python311-pbr
Requires:       python311-pycadf
Requires:       python311-pysaml2
Requires:       python311-python-memcached
Requires:       python311-pytz
Requires:       python311-scrypt
Requires:       python311-sqlalchemy-migrate
Requires:       python311-stevedore
%description -n   python3-keystone
Keystone is a Python implementation of the OpenStack
(https://docs.openstack.org/keystone/latest/) identity service API.
This package contains the Keystone Python library.
%package -n python3-keystone-tests
Summary:        Keystone tests
Requires:       openstack-keystone = %{epoch}:%{version}-%{release}
Provides:       python-keystone-tests = %{epoch}:%{version}-%{release}
%description -n python3-keystone-tests
Keystone is a Python implementation of the OpenStack
(https://docs.openstack.org/keystone/latest/) identity service API.
This package contains the Keystone test files.
%if 0%{?with_doc}
%package doc
Summary:        Documentation for OpenStack Identity Service
Group:          Documentation/HTML
BuildRequires:  python311-Sphinx
BuildRequires:  python311-openstackdocstheme
BuildRequires:  python311-sphinx-feature-classification
BuildRequires:  python311-sphinxcontrib-apidoc
BuildRequires:  python311-sphinxcontrib-blockdiag
BuildRequires:  python311-sphinxcontrib-seqdiag
%description doc
OpenStack Keystone documentaion.
.
This package contains the documentation
%endif
%prep
%autosetup -p1 -n keystone-26.0.1.dev3
%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
%build
%{py3_build}
# doc
%if 0%{?with_doc}
PYTHONPATH=. PBR_VERSION=26.0.1.dev3 %sphinx_build -b html doc/source doc/build/html
PYTHONPATH=. PBR_VERSION=26.0.1.dev3 %sphinx_build -b man doc/source doc/build/man
# remove the Sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}
rm -rf doc/build/man/.{doctrees,buildinfo}
%endif
# config file generation
PYTHONPATH=. 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,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.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 %{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/
# man pages
%if 0%{?with_doc}
mkdir -p %{buildroot}%{_mandir}/man1
install -p -D -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1/
%endif
%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 --exclude-regex keystone.tests.unit.test_policy.GeneratePolicyFileTestCase.test_policy_generator_from_command_line
%endif
%if 0%{?rdo}
stestr-3 run --exclude-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
%{_bindir}/keystone-status
%_tmpfilesdir/keystone.conf
%dir %{_datadir}/keystone
%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/
%dir %attr(0750, root, keystone) %{_sysconfdir}/keystone/credential-keys
%{_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/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
%if 0%{?with_doc}
%{_mandir}/man1/keystone-manage.1.gz
%endif
%files -n python3-keystone
%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
%if 0%{?with_doc}
%files doc
%license LICENSE
%doc doc/build/html
%endif
%changelog