Merge "glance: Cleanup/Improve spec"

This commit is contained in:
Zuul 2019-08-22 17:36:33 +00:00 committed by Gerrit Code Review
commit 1b8835f06a
2 changed files with 56 additions and 28 deletions

View File

@ -17,6 +17,7 @@ Source0: {{ source|basename }}
Source1: openstack-glance.logrotate
Source2: openstack-glance.conf
Source3: openstack-glance-api.service
Source4: openstack-glance-registry.service
Source6: openstack-glance.defaultconf
Source7: openstack-glance.README.config
BuildRequires: openstack-macros
@ -164,26 +165,9 @@ This package contains the Glance test files.
%package doc
Summary: Documentation for OpenStack Image Service
Group: Documentation
BuildRequires: {{ py2pkg('Sphinx') }}
BuildRequires: {{ py2pkg('WSME') }}
BuildRequires: {{ py2pkg('cursive') }}
BuildRequires: {{ py2pkg('glance_store') }}
BuildRequires: {{ py2pkg('httplib2') }}
BuildRequires: {{ py2pkg('openstackdocstheme') }}
BuildRequires: {{ py2pkg('oslo.concurrency') }}
BuildRequires: {{ py2pkg('oslo.config') }}
BuildRequires: {{ py2pkg('oslo.context') }}
BuildRequires: {{ py2pkg('oslo.db') }}
BuildRequires: {{ py2pkg('oslo.log') }}
BuildRequires: {{ py2pkg('oslo.messaging') }}
BuildRequires: {{ py2pkg('oslo.middleware') }}
BuildRequires: {{ py2pkg('oslo.policy') }}
BuildRequires: {{ py2pkg('oslo.utils') }}
BuildRequires: {{ py2pkg('osprofiler') }}
BuildRequires: {{ py2pkg('sphinxcontrib-apidoc') }}
BuildRequires: {{ py2pkg('stevedore') }}
BuildRequires: {{ py2pkg('taskflow') }}
BuildRequires: {{ py2pkg('xattr') }}
BuildRequires: {{ py3('Sphinx') }}
BuildRequires: {{ py3('openstackdocstheme') }}
BuildRequires: {{ py3('sphinxcontrib-apidoc') }}
%description doc
The Glance project provides a service where users can upload and discover
@ -217,15 +201,33 @@ OpenStack Swift project.
This package contains the %{name} API server.
%package registry
Summary: OpenStack Image service (Glance) - Registry
Group: Development/Languages/Python
Requires: %{name} = %{epoch}:%{version}-%{release}
%description registry
The Glance project provides a service where users can upload and discover
data assets that are meant to be used with other services. This currently
includes images and metadata definitions.
Glance image services include discovering, registering, and retrieving
virtual machine images. Glance has a RESTful API that allows querying of
VM image metadata as well as retrieval of the actual image.
VM images made available through Glance can be stored in a variety of
locations from simple filesystems to object-storage systems like the
OpenStack Swift project.
This package contains the %{name} registry server.
%prep
%autosetup -n {{ pypi_name }}-{{ upstream_version }}
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}
%py_req_cleanup
%build
%{py3_build}
# build documentation
%if 0%{?with_doc}
PBR_VERSION={{ upstream_version }} sphinx-build -b html doc/source doc/build/html
PBR_VERSION={{ upstream_version }} %sphinx_build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}
%endif
# regenerate the sample config files
@ -239,6 +241,7 @@ done
install -d -m 755 %{buildroot}%{_sysconfdir}/{{ pypi_name }}
install -d -m 755 %{buildroot}%{_sysconfdir}/glance/glance.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/glance/glance-api.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/glance/glance-registry.conf.d/
install -d -m 755 %{buildroot}%{_localstatedir}/lib/{{ pypi_name }}
install -d -m 755 %{buildroot}%{_localstatedir}/lib/{{ pypi_name }}/images
install -d -m 750 %{buildroot}%{_localstatedir}/log/{{ pypi_name }}
@ -257,18 +260,13 @@ rm -rf %{buildroot}%{_sysconfdir}/{{ pypi_name }}/oslo-config-generator
install -D -m 640 %{SOURCE6} %{buildroot}/%{_sysconfdir}/glance/glance.conf.d/010-glance.conf
# systemd
install -p -D -m 444 %{SOURCE3} %{buildroot}%{_unitdir}/openstack-glance-api.service
install -p -D -m 444 %{SOURCE4} %{buildroot}%{_unitdir}/openstack-glance-registry.service
# logrotate
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-glance
# move metadefs
mv %{buildroot}%{_prefix}%{_sysconfdir}/glance/metadefs/* %{buildroot}%{_sysconfdir}/glance/metadefs
# Remove duplicate files under /usr/etc
rm -rf %{buildroot}%{_prefix}%{_sysconfdir}/glance
# remove non-packaged files
rm -rf %{buildroot}%{_sysconfdir}/{{ pypi_name }}/glance-registry-paste.ini
rm -rf %{buildroot}%{_sysconfdir}/{{ pypi_name }}/glance-registry.conf
rm -rf %{buildroot}%{_bindir}/glance-registry
%pre
%openstack_pre_user_group_create glance glance /sbin/nologin
@ -294,21 +292,33 @@ OS_TEST_PATH=./glance/tests/unit PYTHONPATH=. stestr-3 run
%postun api
%systemd_postun_with_restart %{name}-api.service
%post registry
%systemd_post %{name}-registry.service
%preun registry
%systemd_preun %{name}-registry.service
%postun registry
%systemd_postun_with_restart %{name}-registry.service
%files
%license LICENSE
%_tmpfilesdir/glance.conf
%dir %attr(0750, root, glance) %{_sysconfdir}/{{ pypi_name }}
%dir %attr(0750, root, glance) %{_sysconfdir}/glance/glance.conf.d/
%dir %attr(0750, root, glance) %{_sysconfdir}/glance/glance-api.conf.d/
%dir %attr(0750, root, glance) %{_sysconfdir}/glance/glance-registry.conf.d/
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/glance/glance.conf.d/010-glance.conf
%{_sysconfdir}/{{ pypi_name }}/README.config
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/{{ pypi_name }}/glance-api.conf
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/{{ pypi_name }}/glance-registry.conf
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/{{ pypi_name }}/glance-cache.conf
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/{{ pypi_name }}/glance-image-import.conf
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/{{ pypi_name }}/glance-scrubber.conf
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/{{ pypi_name }}/glance-swift.conf
%config(noreplace) %attr(0640, root, glance) %{_sysconfdir}/{{ pypi_name }}/glance-manage.conf
%config %{_sysconfdir}/{{ pypi_name }}/glance-api-paste.ini
%config %{_sysconfdir}/{{ pypi_name }}/glance-registry-paste.ini
%config %{_sysconfdir}/{{ pypi_name }}/policy.json
%config %{_sysconfdir}/{{ pypi_name }}/property-protections-policies.conf.sample
%config %{_sysconfdir}/{{ pypi_name }}/property-protections-roles.conf.sample
@ -352,4 +362,8 @@ OS_TEST_PATH=./glance/tests/unit PYTHONPATH=. stestr-3 run
%{_bindir}/{{ pypi_name }}-api
%{_bindir}/{{ pypi_name }}-wsgi-api
%files registry
%{_unitdir}/openstack-glance-registry.service
%{_bindir}/{{ pypi_name }}-registry
%changelog

View File

@ -0,0 +1,14 @@
[Unit]
Description=OpenStack Image Service registry server
After=syslog.target network.target
[Service]
Type=simple
User=glance
Group=glance
WorkingDirectory=/var/lib/glance
PrivateTmp=yes
ExecStart=/usr/bin/glance-registry
[Install]
WantedBy=multi-user.target