File openstack-glance.spec of Package openstack-glance-doc
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
# 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 https://bugs.opensuse.org/
#
%define component glance
%define groupname %{component}
%define username %{component}
%define version_unconverted 17.0.1.dev30
Name: openstack-%{component}
Version: 17.0.1~dev30
Release: 0
Summary: OpenStack Image Service (Glance)
License: Apache-2.0
Group: System/Management
URL: https://launchpad.net/glance
Source0: http://tarballs.openstack.org/glance/glance-stable-rocky.tar.gz
Source2: %{name}.logrotate
Source3: %name.conf
Source4: %name-scrubber.cron
# systemd service files
Source10: %{name}-api.service
Source12: %{name}-registry.service
Source50: README.config
Source99: rpmlintrc
# PATCH-FEATURE-UPSTREAM 0001-Fix-manpage-building-and-remove-glance-cache-manage.patch -- https://review.opendev.org/676882
# PATCH-FEATURE-UPSTREAM 0001-Drop-glance-cache-manage-entrypoint-from-setup.cfg.patch -- https://review.opendev.org/#/c/676888/
Patch1: 0001-Drop-glance-cache-manage-entrypoint-from-setup.cfg.patch
Patch2: 0001-Enforce-image-safety-during-image_conversion.patch
BuildRequires: crudini
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: python-base
BuildRequires: python-setuptools
# Documentation build requirements:
BuildRequires: python-Paste
BuildRequires: python-PasteDeploy
BuildRequires: python-Routes
BuildRequires: python-Sphinx
BuildRequires: python-WSME
BuildRequires: python-WebOb
BuildRequires: python-cursive
BuildRequires: python-debtcollector
BuildRequires: python-eventlet
BuildRequires: python-futurist
BuildRequires: python-glance_store
BuildRequires: python-keystoneclient
BuildRequires: python-keystonemiddleware
BuildRequires: python-openstackdocstheme
BuildRequires: python-oslo.concurrency
BuildRequires: python-oslo.config
BuildRequires: python-oslo.context
BuildRequires: python-oslo.db
BuildRequires: python-oslo.log
BuildRequires: python-oslo.messaging
BuildRequires: python-oslo.middleware
BuildRequires: python-oslo.policy
BuildRequires: python-oslo.utils
BuildRequires: python-oslosphinx
BuildRequires: python-osprofiler
BuildRequires: python-pyOpenSSL
BuildRequires: python-sphinxcontrib-apidoc
BuildRequires: python-stevedore
BuildRequires: python-taskflow
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
Requires: logrotate
Requires: python >= 2.7
Requires: python-glance = %{version}
# needed by support for image conversion (qemu-img)
Requires: qemu-tools
Requires(post): sysconfig
Requires(pre): pwdutils
%if 0%{?suse_version}
Recommends: cron
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
The OpenStack Image Service provides discovery, registration and
delivery services for disk and server images. The ability to copy or
snapshot a server image and immediately store it away is a powerful
capability of the OpenStack cloud operating system. Stored images can
be used as a template to get new servers up and running quickly and
more consistently if you are provisioning multiple servers than
installing a server operating system and individually configuring
additional services. It can also be used to store and catalog an
unlimited number of backups.
The Image Service can store disk and server images in a variety of
back-ends, including OpenStack Object Storage. The Image Service API
provides a standard REST interface for querying information about disk
images and lets clients stream the images to new servers.
%package -n python-glance
Summary: OpenStack Image Service (Glance) - Python module
Group: Development/Languages/Python
Requires: python >= 2.6.8
Requires: python-Paste >= 2.0.2
Requires: python-PasteDeploy >= 1.5.0
Requires: python-PrettyTable >= 0.7.1
Requires: python-Routes >= 2.3.1
Requires: python-SQLAlchemy >= 1.0.10
Requires: python-WSME >= 0.8.0
Requires: python-WebOb >= 1.7.1
Requires: python-alembic >= 0.8.10
Requires: python-cryptography >= 2.1
Requires: python-cursive >= 0.2.1
Requires: python-debtcollector >= 1.2.0
Requires: python-defusedxml >= 0.5.0
Requires: python-eventlet >= 0.18.2
Requires: python-futurist >= 1.2.0
Requires: python-glance_store >= 0.22.0
Requires: python-httplib2 >= 0.9.1
Requires: python-iso8601 >= 0.1.11
Requires: python-jsonschema >= 2.6.0
Requires: python-keystoneauth1 >= 3.4.0
Requires: python-keystoneclient >= 3.8.0
Requires: python-keystonemiddleware >= 4.17.0
Requires: python-monotonic >= 0.6
Requires: python-oslo.concurrency >= 3.26.0
Requires: python-oslo.config >= 5.2.0
Requires: python-oslo.context >= 2.19.2
Requires: python-oslo.db >= 4.27.0
Requires: python-oslo.i18n >= 3.15.3
Requires: python-oslo.log >= 3.36.0
Requires: python-oslo.messaging >= 5.29.0
Requires: python-oslo.middleware >= 3.31.0
Requires: python-oslo.policy >= 1.30.0
Requires: python-oslo.utils >= 3.33.0
Requires: python-osprofiler >= 1.4.0
Requires: python-pbr >= 2.0.0
Requires: python-pyOpenSSL >= 17.1.0
Requires: python-retrying >= 1.2.3
Requires: python-six >= 1.10.0
Requires: python-sqlalchemy-migrate >= 0.11.0
Requires: python-sqlparse >= 0.2.2
Requires: python-stevedore >= 1.20.0
Requires: python-taskflow >= 2.16.0
%description -n python-glance
This package contains the core Python module of OpenStack Glance.
%package api
Summary: OpenStack Image service (Glance) - API
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description api
This package contains the %{name} API server.
%package registry
Summary: OpenStack Image service (Glance) - Registry
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description registry
This package contains the %{name} Registry server.
%package test
Summary: OpenStack Image Service (Glance) - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python-Babel >= 2.3.4
Requires: python-PyMySQL >= 0.7.6
Requires: python-fixtures >= 3.0.0
Requires: python-mock >= 2.0.0
Requires: python-oslotest >= 3.2.0
Requires: python-psutil >= 3.2.2
Requires: python-psycopg2 >= 2.6.2
Requires: python-pysendfile >= 2.0.0
Requires: python-requests >= 2.14.2
Requires: python-sqlalchemy-migrate >= 0.11.0
Requires: python-swiftclient >= 3.2.0
Requires: python-testrepository >= 0.0.18
Requires: python-testresources >= 2.0.0
Requires: python-testscenarios >= 0.4
Requires: python-testtools >= 2.2.0
Requires: python-xattr >= 0.9.2
%description test
The OpenStack Glance testsuite. It is used to verify the functionality
of OpenStack Glance.
%prep
%setup -q -n %{component}-%{version_unconverted}
%patch1 -p1
%patch2 -p1
%openstack_cleanup_prep
# NOTE(tbechtold) without git, openstackdocstheme has warnings which let the doc build fail
sed -i 's/^warning-is-error.*/warning-is-error = 0/g' setup.cfg
crudini --set setup.cfg build_sphinx builder html,man
%build
PBR_VERSION=%{version_unconverted} sphinx-build -b html doc/source doc/build/html
PBR_VERSION=%{version_unconverted} sphinx-build -b man doc/source doc/build/man
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
### directories
install -d -m 755 %{buildroot}%{_localstatedir}/lib/glance
install -d -m 755 %{buildroot}%{_localstatedir}/lib/glance/images
install -d -m 750 %{buildroot}%{_localstatedir}/log/glance
install -d -m 700 %{buildroot}%{_rundir}/%{component}
install -D -m 644 %{SOURCE3} %{buildroot}/%_tmpfilesdir/%name.conf
### configuration files
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
mv %{buildroot}/usr/etc/glance/* %{buildroot}%{_sysconfdir}/%{component}
install -p -D -m 644 etc/rootwrap.conf %{buildroot}%{_sysconfdir}/%{component}/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}-api.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}-registry.conf.d/
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
# regenerate the sample config files
for service in api registry scrubber cache manage; do
PYTHONPATH=. oslo-config-generator --config-file etc/oslo-config-generator/glance-$service.conf
done
cp -pr etc/* %{buildroot}%{_sysconfdir}/glance
for service in api registry scrubber cache manage swift image-import; do
mv %{buildroot}%{_sysconfdir}/glance/glance-$service.conf{.sample,}
done
rm -rf %{buildroot}%{_sysconfdir}/glance/oslo-config-generator
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
rm -rf %{buildroot}/usr/etc/glance/metadefs # FIXME: is this needed? why is it in the wrong place?
# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-registry.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-registry
### documentation
install -d %{buildroot}%{_mandir}/man1
install -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1
### test subpackage
%openstack_test_package_install
%fdupes %{buildroot}%{_localstatedir}/lib/%{name}-test
### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
### set default configuration
%define glance_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{glance_conf} DEFAULT log_dir /var/log/%{component}
crudini --set %{glance_conf} DEFAULT lock_path /var/run/%{component}
crudini --set %{glance_conf} paste_deploy flavor keystone
### authentication cache dir
mkdir -p %{buildroot}%{_localstatedir}/cache/glance/api
mkdir -p %{buildroot}%{_localstatedir}/cache/glance/registry
# Cron jobs
mkdir -p %{buildroot}%{_sysconfdir}/cron.hourly/
install -p -m 755 %{SOURCE4} %{buildroot}%{_sysconfdir}/cron.hourly
%pre
%openstack_pre_user_group_create %{username} %{groupname}
%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%pre api
%service_add_pre %{name}-api.service
%post api
%service_add_post %{name}-api.service
%preun api
%service_del_preun %{name}-api.service
%postun api
%restart_on_update %{name}-api.service
%service_del_postun %{name}-api.service
%pre registry
%service_add_pre %{name}-registry.service
%post registry
%service_add_post %{name}-registry.service
%preun registry
%service_del_preun %{name}-registry.service
%postun registry
%restart_on_update %{name}-registry.service
%service_del_postun %{name}-registry.service
%files
%defattr(-,root,root)
%doc README.rst
%license LICENSE
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/glance
%dir %{_sysconfdir}/%{component}
%dir %attr(0755, %{username}, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/
%dir %attr(0755, %{username}, %{groupname}) %{_sysconfdir}/%{component}/%{component}-api.conf.d/
%dir %attr(0755, %{username}, %{groupname}) %{_sysconfdir}/%{component}/%{component}-registry.conf.d/
%{_sysconfdir}/%{component}/README.config
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/glance/glance-api.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/glance/glance-cache.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/glance/glance-registry.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/glance/glance-scrubber.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/glance/glance-swift.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/glance/glance-image-import.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/glance/glance-manage.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
%config %{_sysconfdir}/glance/rootwrap.conf
%config %{_sysconfdir}/glance/glance-api-paste.ini
%config %{_sysconfdir}/glance/glance-registry-paste.ini
%config %{_sysconfdir}/glance/policy.json
%config %{_sysconfdir}/glance/property-protections-policies.conf.sample
%config %{_sysconfdir}/glance/property-protections-roles.conf.sample
%config %{_sysconfdir}/glance/ovf-metadata.json.sample
%config %{_sysconfdir}/glance/schema-image.json
%dir %config %{_sysconfdir}/glance/metadefs
%{_sysconfdir}/glance/metadefs/README
%config %{_sysconfdir}/glance/metadefs/*.json
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/lib/glance
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/lib/glance/images
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/glance
%_tmpfilesdir/%name.conf
%{_bindir}/glance-cache-cleaner
%{_bindir}/glance-cache-prefetcher
%{_bindir}/glance-cache-pruner
%{_bindir}/glance-control
%{_bindir}/glance-manage
%{_bindir}/glance-replicator
%{_bindir}/glance-scrubber
%{_mandir}/man1/glance-api.1%{?ext_man}
%{_mandir}/man1/glance-cache-cleaner.1%{?ext_man}
%{_mandir}/man1/glance-cache-prefetcher.1%{?ext_man}
%{_mandir}/man1/glance-cache-pruner.1%{?ext_man}
%{_mandir}/man1/glance-control.1%{?ext_man}
%{_mandir}/man1/glance-manage.1%{?ext_man}
%{_mandir}/man1/glance-registry.1%{?ext_man}
%{_mandir}/man1/glance-replicator.1%{?ext_man}
%{_mandir}/man1/glance-scrubber.1%{?ext_man}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/glance
%config(noreplace) %{_sysconfdir}/cron.hourly/%name-scrubber.cron
%files -n python-glance
%defattr(-,root,root,-)
%license LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
# Part of test subpackage
%exclude %{python_sitelib}/%{component}/tests/
%files api
%defattr(-,root,root,-)
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/%{component}-api
%{_bindir}/glance-wsgi-api
%files registry
%defattr(-,root,root,-)
%{_unitdir}/%{name}-registry.service
%{_sbindir}/rc%{name}-registry
%{_bindir}/%{component}-registry
%files test
%defattr(-,root,root)
%{python_sitelib}/%{component}/tests/
%{_localstatedir}/lib/%{name}-test/
%changelog