File openstack-swift.spec of Package openstack-swift
#
# spec file for package openstack-swift
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, 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/
#
%global with_doc 1
%define component swift
%define groupname openstack-%{component}
%define username openstack-%{component}
Name: openstack-%{component}
Version: 1.4.8+git.1332408124.4a6fead
Release: 0
Summary: OpenStack Storage (Swift)
License: Apache-2.0
Group: Development/Languages/Python
Url: http://launchpad.net/swift
Source0: %{component}-%{version}.tar.gz
Source1: %{name}-functions
Source2: %{name}-account.init
Source3: %{name}-account-auditor.init
Source4: %{name}-account-reaper.init
Source5: %{name}-account-replicator.init
Source6: %{name}-container.init
Source7: %{name}-container-auditor.init
Source8: %{name}-container-replicator.init
Source9: %{name}-container-updater.init
Source10: %{name}-container-sync.init
Source11: %{name}-object.init
Source12: %{name}-object-replicator.init
Source13: %{name}-object-expirer.init
Source14: %{name}-object-updater.init
Source15: %{name}-object-auditor.init
Source16: %{name}-proxy.init
Source20: %{name}-create-man-stubs.py
Source21: test-configs.tar.bz2
Patch1: test_swift.patch
Patch2: test_runners.patch
Patch3: rsync_object_replication.patch
Patch4: dir-traversals-checks.patch
# PATCH-FIX-UPSTREAM swift-memcache-no-pickle.patch bnc#779215 CVE-2012-4406 vuntz@suse.com -- do not use pickle serialization for memcache, but JSON
Patch5: swift-memcache-no-pickle.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: python-Paste
BuildRequires: python-PasteDeploy
BuildRequires: python-coverage
BuildRequires: python-devel
BuildRequires: python-distribute
Requires: python >= 2.6.8
Requires: python-PasteScript
Requires: python-configobj
Requires: python-eventlet >= 0.9.8
Requires: python-greenlet >= 0.3.1
Requires: python-netifaces
Requires: python-simplejson
Requires: python-swift = %{version}
Requires: python-webob >= 0.9.8
Requires: python-xattr
Requires: rsync
Requires(post): %insserv_prereq
%if 0%{?suse_version} > 1110
Requires(pre): pwdutils
%else
Requires(pre): shadow-utils
%endif
%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
OpenStack Object Storage (swift) aggregates commodity servers to work
together in clusters for reliable, redundant, and large-scale storage
of static objects. Objects are written to multiple hardware devices in
the data center, with the OpenStack software responsible for ensuring
data replication and integrity across the cluster. Storage clusters can
scale horizontally by adding new nodes, which are automatically
configured. Should a node fail, OpenStack works to replicate its
content from other active nodes. Because OpenStack uses software logic
to ensure data replication and distribution across different devices,
inexpensive commodity hard drives and servers can be used in lieu of
more expensive equipment.
%package -n python-swift
Summary: OpenStack Storage (Swift) - Python module
Group: Development/Languages/Python
Requires: python >= 2.6.8
%description -n python-swift
This package contains the core Python module of OpenStack Swift.
%package account
Summary: OpenStack Storage (Swift) - Account Server
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: sqlite3 >= 3.6.23
%description account
OpenStack Object Storage (swift) aggregates commodity servers to work
together in clusters for reliable, redundant, and large-scale storage
of static objects.
This package contains the openstack-swift account server.
%package container
Summary: OpenStack Storage (Swift) - Container Server
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: sqlite3 >= 3.6.23
%description container
OpenStack Object Storage (swift) aggregates commodity servers to work
together in clusters for reliable, redundant, and large-scale storage
of static objects.
This package contains the openstack-swift container server.
%package object
Summary: OpenStack Storage (Swift) - Object Server
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: sqlite3 >= 3.6.23
%description object
OpenStack Object Storage (swift) aggregates commodity servers to work
together in clusters for reliable, redundant, and large-scale storage
of static objects.
This package contains the openstack-swift object server.
%package proxy
Summary: OpenStack Storage (Swift) - Proxy Server
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: memcached
%description proxy
OpenStack Object Storage (swift) aggregates commodity servers to work
together in clusters for reliable, redundant, and large-scale storage
of static objects.
This package contains the openstack-swift proxy server.
%if 0%{?with_doc}
%package doc
Summary: OpenStack Storage (Swift) - Documentation
Group: Documentation/Other
BuildRequires: python-Sphinx
BuildRequires: python-eventlet
BuildRequires: python-netifaces
BuildRequires: python-simplejson
BuildRequires: python-webob
BuildRequires: python-xattr
BuildRequires: python-xml
%description doc
OpenStack Object Storage (swift) aggregates commodity servers to work
together in clusters for reliable, redundant, and large-scale storage
of static objects.
This package contains documentation files for openstack-swift.
%endif
%package test
Summary: OpenStack Storage (Swift) - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python-nose
%description test
The OpenStack Swift testsuite. It is used to verify the functionality
of OpenStack Swift.
%prep
%setup -q -n %{component}-%{version}
# Fix wrong-file-end-of-line-encoding warning
dos2unix LICENSE
tar xvf %{SOURCE21}
# Fix a failing unittest https://bugs.launchpad.net/swift/+bug/984042
# patch is in master, but won't get backported because swift
%patch1 -p1
# Fix return values of test runners so that they return their true exit status.
# Upstreamed, but only accepted in folsom:
# https://review.openstack.org/#/q/I0c2b0d6b17f560a889cd2f22ab98a68361f6d738,n,z
%patch2 -p1
# fix object replication on older rsync versions when using ipv4
# upstreamed, only for folsom
# https://review.openstack.org/#/c/7190/
%patch3 -p1
# add checks to avoid directory traversals, for additional security
# upstreamed, only for folsom
# https://review.openstack.org/#/c/8798/
%patch4 -p1
%patch5 -p1
# disable intersphinx as it tries to fetch documentation via http which is not allowed during build
sed -i -e "s/,\? \?'sphinx.ext.intersphinx'//" doc/source/conf.py
%build
python setup.py build
# Build docs
%if 0%{?with_doc}
export PYTHONPATH="$( pwd ):$PYTHONPATH"
pushd doc
sphinx-build -b html source build/html
popd
rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo
%endif
# Build man stubs
python %{SOURCE20} --mandir=./man
%install
python setup.py install -O1 --skip-build --root %{buildroot} --prefix %{_prefix}
# Init helper functions
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_datadir}/%{name}/functions
# Init scripts
install -p -D -m 755 %{SOURCE2} %{buildroot}%{_initddir}/%{name}-account
install -p -D -m 755 %{SOURCE3} %{buildroot}%{_initddir}/%{name}-account-auditor
install -p -D -m 755 %{SOURCE4} %{buildroot}%{_initddir}/%{name}-account-reaper
install -p -D -m 755 %{SOURCE5} %{buildroot}%{_initddir}/%{name}-account-replicator
install -p -D -m 755 %{SOURCE6} %{buildroot}%{_initddir}/%{name}-container
install -p -D -m 755 %{SOURCE7} %{buildroot}%{_initddir}/%{name}-container-auditor
install -p -D -m 755 %{SOURCE8} %{buildroot}%{_initddir}/%{name}-container-replicator
install -p -D -m 755 %{SOURCE9} %{buildroot}%{_initddir}/%{name}-container-updater
install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initddir}/%{name}-container-sync
# workaround https://bugzilla.novell.com/show_bug.cgi?id=772585
for m in auditor replicator server updater sync ; do
ln -s swift-container-$m %{buildroot}%{_bindir}/swift-cont-$m
done
# end of workaround
install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initddir}/%{name}-object
install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initddir}/%{name}-object-replicator
install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initddir}/%{name}-object-expirer
install -p -D -m 755 %{SOURCE14} %{buildroot}%{_initddir}/%{name}-object-updater
install -p -D -m 755 %{SOURCE15} %{buildroot}%{_initddir}/%{name}-object-auditor
install -p -D -m 755 %{SOURCE16} %{buildroot}%{_initddir}/%{name}-proxy
# symlinks for init scripts
mkdir -p %{buildroot}%{_sbindir}
for server in account account-auditor account-reaper account-replicator container container-auditor container-replicator container-updater container-sync object object-replicator object-expirer object-updater object-auditor proxy; do
ln -s ../..%{_initddir}/%{name}-$server %{buildroot}%{_sbindir}/rc%{name}-$server
done
# Install man stubs
for name in $( ls ./man ); do
mkdir -p "%{buildroot}%{_mandir}/$name"
cp "./man/$name/"*.gz "%{buildroot}%{_mandir}/$name"
done
# Remove tests
rm -fr %{buildroot}/%{python_sitelib}/test
# Misc other
install -d -m 755 %{buildroot}%{_sysconfdir}/swift
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/account-server
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/container-server
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/object-server
install -d -m 755 %{buildroot}%{_sysconfdir}/swift/proxy-server
# /var/run is not allowed in 11.3 or later because of tmpfs support
%if 0%{?suse_version} < 1130
# Install pid directory
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/account-server
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/container-server
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/object-server
install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/proxy-server
%endif
%fdupes %{buildroot}%{python_sitelib}/swift
# test sub-package
install -d -m 755 %{buildroot}%{_localstatedir}/lib/openstack-swift-test
cp .unittests %{buildroot}%{_localstatedir}/lib/openstack-swift-test/unittests
cp .functests %{buildroot}%{_localstatedir}/lib/openstack-swift-test/functests
cp .probetests %{buildroot}%{_localstatedir}/lib/openstack-swift-test/probetests
cp -r test %{buildroot}%{_localstatedir}/lib/openstack-swift-test/
ln -s %{python_sitelib}/swift %{buildroot}%{_localstatedir}/lib/openstack-swift-test/
cp -r test-configs/* %{buildroot}/
mv test/functional/sample.conf %{buildroot}%{_sysconfdir}/swift/func_test.conf
mv %{buildroot}%{_bindir}/swift{,.old}
%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || \
useradd -r -g %{groupname} -d %{_localstatedir}/lib/swift -s /sbin/nologin \
-c "OpenStack Swift Daemons" %{username}
exit 0
%post account
%fillup_and_insserv -f openstack-swift-account
%preun account
%stop_on_removal openstack-swift-account
%postun account
%restart_on_update openstack-swift-account
%insserv_cleanup
%post container
%fillup_and_insserv -f openstack-swift-container
%preun container
%stop_on_removal openstack-swift-container
%postun container
%restart_on_update openstack-swift-container
%insserv_cleanup
%post object
%fillup_and_insserv -f openstack-swift-object
%preun object
%stop_on_removal openstack-swift-object
%postun object
%restart_on_update openstack-swift-object
%insserv_cleanup
%post proxy
%fillup_and_insserv -f openstack-swift-proxy
%preun proxy
%stop_on_removal openstack-swift-proxy
%postun proxy
%restart_on_update openstack-swift-proxy
%insserv_cleanup
%files
%defattr(-,root,root,-)
%doc README
%dir %{_datadir}/%{name}/functions
%if 0%{?suse_version} < 1130
%dir %attr(0755, %{username}, root) %{_localstatedir}/run/swift
%endif
%dir %{_sysconfdir}/swift
%dir %{_datadir}/openstack-swift
%{_bindir}/swift.old
%{_bindir}/swift-account-audit
%{_bindir}/swift-bench
%{_bindir}/swift-dispersion-populate
%{_bindir}/swift-dispersion-report
%{_bindir}/swift-drive-audit
%{_bindir}/swift-form-signature
%{_bindir}/swift-get-nodes
%{_bindir}/swift-init
%{_bindir}/swift-oldies
%{_bindir}/swift-orphans
%{_bindir}/swift-recon
%{_bindir}/swift-recon-cron
%{_bindir}/swift-ring-builder
%{_bindir}/swift-temp-url
%{_mandir}/man8/st.8.gz
%{_mandir}/man8/swift-account-audit.8.gz
%{_mandir}/man8/swift-drive-audit.8.gz
%{_mandir}/man8/swift-get-nodes.8.gz
%{_mandir}/man8/swift-init.8.gz
%{_mandir}/man8/swift-ring-builder.8.gz
%{_mandir}/man8/swift-stats-populate.8.gz
%{_mandir}/man8/swift-stats-report.8.gz
%files -n python-swift
%defattr(-,root,root,-)
%doc AUTHORS LICENSE
%{python_sitelib}/swift
%{python_sitelib}/swift-1.*.egg-info
%files account
%defattr(-,root,root,-)
%doc etc/account-server.conf-sample
%{_initddir}/%{name}-account*
%{_sbindir}/rc%{name}-account*
%if 0%{?suse_version} < 1130
%dir %attr(0755, %{username}, root) %{_localstatedir}/run/swift/account-server
%endif
%dir %{_sysconfdir}/swift/account-server
%{_bindir}/swift-account-auditor
%{_bindir}/swift-account-reaper
%{_bindir}/swift-account-replicator
%{_bindir}/swift-account-server
# TODO: check if this is the correct subpackage
#{_bindir}/swift-account-stats-logger
# ENDTODO
%{_mandir}/man8/swift-account-auditor.8.gz
%{_mandir}/man8/swift-account-reaper.8.gz
%{_mandir}/man8/swift-account-replicator.8.gz
%{_mandir}/man8/swift-account-server.8.gz
%files container
%defattr(-,root,root,-)
%doc etc/container-server.conf-sample
%{_initddir}/%{name}-container*
%{_sbindir}/rc%{name}-container*
%if 0%{?suse_version} < 1130
%dir %attr(0755, %{username}, root) %{_localstatedir}/run/swift/container-server
%endif
%dir %{_sysconfdir}/swift/container-server
%{_bindir}/swift-container-auditor
%{_bindir}/swift-container-server
%{_bindir}/swift-container-replicator
%{_bindir}/swift-container-updater
%{_bindir}/swift-container-sync
%{_bindir}/swift-cont-*
%{_mandir}/man8/swift-container-auditor.8.gz
%{_mandir}/man8/swift-container-server.8.gz
%{_mandir}/man8/swift-container-replicator.8.gz
%{_mandir}/man8/swift-container-updater.8.gz
%files object
%defattr(-,root,root,-)
%doc etc/account-server.conf-sample etc/rsyncd.conf-sample
%{_initddir}/%{name}-object*
%{_sbindir}/rc%{name}-object*
%if 0%{?suse_version} < 1130
%dir %attr(0755, %{username}, root) %{_localstatedir}/run/swift/object-server
%endif
%dir %{_sysconfdir}/swift/object-server
%{_bindir}/swift-object-auditor
%{_bindir}/swift-object-expirer
%{_bindir}/swift-object-info
%{_bindir}/swift-object-replicator
%{_bindir}/swift-object-server
%{_bindir}/swift-object-updater
%{_mandir}/man8/swift-object-auditor.8.gz
%{_mandir}/man8/swift-object-info.8.gz
%{_mandir}/man8/swift-object-replicator.8.gz
%{_mandir}/man8/swift-object-server.8.gz
%{_mandir}/man8/swift-object-updater.8.gz
%files proxy
%defattr(-,root,root,-)
%doc etc/proxy-server.conf-sample
%{_initddir}/%{name}-proxy
%{_sbindir}/rc%{name}-proxy
%if 0%{?suse_version} < 1130
%dir %attr(0755, %{username}, root) %{_localstatedir}/run/swift/proxy-server
%endif
%dir %{_sysconfdir}/swift/proxy-server
%{_bindir}/swift-proxy-server
%{_mandir}/man8/swift-proxy-server.8.gz
%if 0%{?with_doc}
%files doc
%defattr(-,root,root,-)
%doc LICENSE doc/build/html
%endif
%files test
%defattr(-,root,root)
%dir %{_localstatedir}/lib/openstack-swift-test
%{_localstatedir}/lib/openstack-swift-test/*
%{_sysconfdir}/swift/func_test.conf
%{_sysconfdir}/swift/container-server/*
%{_sysconfdir}/swift/object-server/*
%{_sysconfdir}/swift/account-server/*
%{_sysconfdir}/swift/proxy-server.conf
%{_sysconfdir}/swift/swift.conf
%{_bindir}/remakerings
%{_bindir}/resetswift
%changelog