File openstack-glance.spec of Package openstack-glance
#
# spec file for package openstack-glance
#
# Copyright (c) 2013 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/
#
%define component glance
%define groupname openstack-%{component}
%define username openstack-%{component}
Name: openstack-%{component}
Version: 2013.2
Release: 0
Summary: OpenStack Image Service (Glance)
License: Apache-2.0
Group: System/Management
Url: https://launchpad.net/glance
Source0: glance-2013.2.tar.gz
Source1: openstack-glance.init
Source5: %{name}.logrotate
# PATCH-FIX-OPENSUSE: speilicke@suse.com -- Don't test qpid functionality, we have no packages
Patch2: glance-dont-test-qpid.patch
BuildRequires: crudini
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: python-base
BuildRequires: python-distribute
# Documentation build requirements:
BuildRequires: python-Sphinx
BuildRequires: python-oslo.sphinx
Requires: logrotate
Requires: python >= 2.6.8
Requires: python-glance = %{version}
Requires(post): sysconfig
%if 0%{?suse_version} > 1110
Requires(pre): pwdutils
%else
Requires(pre): shadow-utils
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%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-Babel >= 0.9.6
Requires: python-Paste
Requires: python-PasteDeploy >= 1.5.0
Requires: python-SQLAlchemy >= 0.7.8
Requires: python-WebOb >= 1.2.3
Requires: python-anyjson >= 0.3.3
Requires: python-boto >= 2.4.0
Requires: python-cinderclient >= 1.0.4
Requires: python-eventlet >= 0.13.0
Requires: python-greenlet >= 0.3.2
Requires: python-httplib2
Requires: python-iso8601 >= 0.1.4
Requires: python-jsonschema >= 1.3.0
Requires: python-keystoneclient >= 0.3.0
Requires: python-kombu >= 2.4.8
Requires: python-lxml >= 2.3
Requires: python-oslo.config >= 1.2.0a3
Requires: python-passlib
Requires: python-pbr >= 0.5.21
Requires: python-psutil >= 0.6.1
Requires: python-pyOpenSSL
Requires: python-pycrypto >= 2.6
Requires: python-six
Requires: python-sqlalchemy-migrate >= 0.7.2
Requires: python-swiftclient >= 1.2
Requires: python-wsgiref >= 0.1.2
Requires: python-xattr >= 0.4
%description -n python-glance
This package contains the core Python module of OpenStack Glance.
%package test
Summary: OpenStack Image Service (Glance) - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python-coverage >= 3.6
Requires: python-fixtures >= 0.3.12
Requires: python-flake8 >= 2.0
Requires: python-glanceclient
Requires: python-hacking >= 0.5.6
Requires: python-mock >= 1.0
Requires: python-mox >= 0.5.3
Requires: python-nose
Requires: python-nose-exclude
Requires: python-nosehtmloutput >= 0.0.3
Requires: python-openstack.nose_plugin >= 0.7
Requires: python-pep8 >= 1.4.5
Requires: python-psycopg2
Requires: python-pyflakes >= 0.7.2
Requires: python-pysendfile >= 2.0.0
Requires: python-requests >= 1.1
Requires: python-testtools >= 0.9.32
Requires: python-xattr >= 0.4
%description test
The OpenStack Glance testsuite. It is used to verify the functionality
of OpenStack Glance.
%prep
%setup -q -n glance-2013.2
%patch2 -p1
%openstack_cleanup_prep
sed -i "s|^#!.*||" tools/migrate_image_owners.py # Fix non-executable script warning
# NOTE(saschpe): The following test contains a pesky (commented) race condition
# that I don't see worth fixing, thus drop it:
rm glance/tests/functional/v1/test_multiprocessing.py
%build
python setup.py build
python setup.py build_sphinx -b 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 755 %{buildroot}%{_localstatedir}/log/glance
install -d -m 755 %{buildroot}%{_localstatedir}/run/glance
### configuration files
install -d -m 0755 %{buildroot}%{_sysconfdir}/glance
cp etc/* %{buildroot}%{_sysconfdir}/glance
install -p -D -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
### init scripts
mkdir -p %{buildroot}%{_sbindir}
for i in api registry ; do
tmp=$(mktemp)
cat %{SOURCE1} | sed "s/__NAME__/$i/g" > $tmp
install -D -m 755 $tmp %{buildroot}%{_initddir}/%{name}-$i
ln -s ../..%{_initddir}/%{name}-$i %{buildroot}%{_sbindir}/rc%{name}-$i
done
### 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 (mostly applies to package-only setups and quickstart, i.e. not generally crowbar)
for i in api registry ; do
crudini --set %{buildroot}%{_sysconfdir}/glance/glance-$i.conf DEFAULT verbose True
crudini --set %{buildroot}%{_sysconfdir}/glance/glance-$i.conf paste_deploy flavor keystone
#TODO/FIXME(saschpe): Do we want to use sqlite per default or demand PostgreSQL right away?
crudini --set %{buildroot}%{_sysconfdir}/glance/glance-$i.conf sql connection sqlite:////var/lib/glance/glance.db
done
#NOTE(saschpe): Needed for (at least) ceilometer to colect image counters stats:
crudini --set %{buildroot}%{_sysconfdir}/glance/glance-api.conf DEFAULT notifier_strategy rabbit
### authentication cache dir
mkdir -p %{buildroot}%{_localstatedir}/cache/glance/api
mkdir -p %{buildroot}%{_localstatedir}/cache/glance/registry
%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || useradd -r -g %{groupname} -d %{_localstatedir}/lib/glance -s /sbin/nologin -c "OpenStack Glance Daemons" %{username}
exit 0
%post
%fillup_and_insserv openstack-glance-api openstack-glance-registry
%preun
%stop_on_removal openstack-glance-api openstack-glance-registry
%postun
%restart_on_update openstack-glance-api openstack-glance-registry
%insserv_cleanup
%files
%defattr(-,root,root)
%doc LICENSE README.rst
%dir %{_sysconfdir}/glance
%config(noreplace) %attr(0640, root, %{username}) %{_sysconfdir}/glance/glance-api.conf
%config(noreplace) %attr(0640, root, %{username}) %{_sysconfdir}/glance/glance-cache.conf
%config(noreplace) %attr(0640, root, %{username}) %{_sysconfdir}/glance/glance-registry.conf
%config(noreplace) %attr(0640, root, %{username}) %{_sysconfdir}/glance/glance-scrubber.conf
%config %{_sysconfdir}/glance/glance-api-paste.ini
%config %{_sysconfdir}/glance/glance-registry-paste.ini
%config %{_sysconfdir}/glance/logging.cnf.sample
%config %{_sysconfdir}/glance/policy.json
%config %{_sysconfdir}/glance/property-protections.conf.sample
%config %{_sysconfdir}/glance/schema-image.json
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0755, %{username}, %{username}) %{_localstatedir}/lib/glance
%dir %attr(0755, %{username}, %{username}) %{_localstatedir}/lib/glance/images
%dir %attr(0755, %{username}, %{username}) %{_localstatedir}/log/glance
%ghost %dir %attr(0755, %{username}, root) %{_localstatedir}/run/glance
%{_initddir}/openstack-glance-api
%{_initddir}/openstack-glance-registry
%{_sbindir}/rcopenstack-glance-api
%{_sbindir}/rcopenstack-glance-registry
%{_bindir}/glance-api
%{_bindir}/glance-cache-cleaner
%{_bindir}/glance-cache-manage
%{_bindir}/glance-cache-prefetcher
%{_bindir}/glance-cache-pruner
%{_bindir}/glance-control
%{_bindir}/glance-manage
%{_bindir}/glance-registry
%{_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-manage.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-scrubber.1%{?ext_man}
%dir %attr(0755, %{username}, %{username}) %{_localstatedir}/cache/glance
%files -n python-glance
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
# Part of test subpackage
%exclude %{python_sitelib}/%{component}/tests/
%files test
%defattr(-,root,root)
%{python_sitelib}/%{component}/tests/
%{_localstatedir}/lib/%{name}-test/
%changelog