File openstack-swift.spec of Package openstack-swift
# spec file for package openstack-swift
#
# Copyright (c) 2012 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/
#
# options to forcefully build with/without vcs
%bcond_with from_vcs
%bcond_with no_from_vcs
%if %{with from_vcs}
%define BUILD_FROM_VCS 1
%endif
%if %{with no_from_vcs}
%define BUILD_FROM_VCS 0
%endif
%global with_doc 1
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%if 0%{?BUILD_FROM_VCS}
%define vcs_summary_warn -- Git Snapshot
%else
%define vcs_summary_warn %null
%endif
Name: openstack-swift
Version: 1.4.3
%if 0%{?BUILD_FROM_VCS}
%define _version git-master
%else
%define _version %{version}
%endif
Release: 0
License: Apache-2.0
Summary: OpenStack Object Storage (swift) %{vcs_summary_warn}
Url: http://launchpad.net/swift
Group: Development/Languages/Python
Source0: swift-%{_version}.tar.gz
Source1: %{name}-functions
Source2: %{name}-create-man-stubs.py
Source30: %{name}-account.init
Source31: %{name}-account-auditor.init
Source32: %{name}-account-reaper.init
Source33: %{name}-account-replicator.init
Source34: %{name}-account-server.init
Source40: %{name}-container.init
Source41: %{name}-container-auditor.init
Source42: %{name}-container-replicator.init
Source43: %{name}-container-server.init
Source44: %{name}-container-updater.init
Source50: %{name}-object.init
Source51: %{name}-object-auditor.init
Source52: %{name}-object-replicator.init
Source53: %{name}-object-server.init
Source54: %{name}-object-stats-logger.init
Source55: %{name}-object-updater.init
Source60: %{name}-proxy.init
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: python-Paste
BuildRequires: python-devel
BuildRequires: python-distribute
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-webob >= 0.9.8
Requires: python-xattr
Requires: rsync
%py_requires
Requires(post): %insserv_prereq
%if 0%{?suse_version} > 1110
Requires(pre): pwdutils
%else
Requires(pre): shadow-utils
%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 account
Summary: A swift account server %{vcs_summary_warn}
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: sqlite3 >= 3.6.23
%py_requires
%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 %{name} account server.
%package container
Summary: A swift container server %{vcs_summary_warn}
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: sqlite3 >= 3.6.23
%py_requires
%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 %{name} container server.
%package object
Summary: A swift object server %{vcs_summary_warn}
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: sqlite3 >= 3.6.23
%py_requires
%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 %{name} object server.
%package proxy
Summary: A swift proxy server %{vcs_summary_warn}
Group: Productivity/Clustering/Computing
Requires: %{name} = %{version}
Requires: memcached
%py_requires
%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 %{name} proxy server.
%if 0%{?with_doc}
%package doc
Summary: Documentation for %{name} %{vcs_summary_warn}
Group: Documentation/Other
BuildRequires: python-Sphinx
BuildRequires: python-eventlet
BuildRequires: python-netaddr
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 %{name}.
%endif
%prep
%setup -q -n swift-%{_version}
# Fix wrong-file-end-of-line-encoding warning
dos2unix LICENSE
%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 %{SOURCE2} --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 %{SOURCE30} %{buildroot}%{_initrddir}/%{name}-account
install -p -D -m 755 %{SOURCE40} %{buildroot}%{_initrddir}/%{name}-container
install -p -D -m 755 %{SOURCE50} %{buildroot}%{_initrddir}/%{name}-object
install -p -D -m 755 %{SOURCE60} %{buildroot}%{_initrddir}/%{name}-proxy
# symlinks for init scripts
mkdir -p %{buildroot}%{_sbindir}
ln -s ../..%{_initrddir}/%{name}-account %{buildroot}%{_sbindir}/rc%{name}-account
ln -s ../..%{_initrddir}/%{name}-container %{buildroot}%{_sbindir}/rc%{name}-container
ln -s ../..%{_initrddir}/%{name}-object %{buildroot}%{_sbindir}/rc%{name}-object
ln -s ../..%{_initrddir}/%{name}-proxy %{buildroot}%{_sbindir}/rc%{name}-proxy
# 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
%clean
rm -rf %{buildroot}
%pre
getent group swift >/dev/null || groupadd -r swift
getent passwd swift >/dev/null || \
useradd -r -g swift -d %{_sharedstatedir}/swift -s /sbin/nologin \
-c "OpenStack Swift Daemons" swift
exit 0
%post account
%fillup_and_insserv -f -y openstack-swift-account
%restart_on_update openstack-swift-account
%preun account
%stop_on_removal openstack-swift-account
%postun account
%insserv_cleanup
%post container
%fillup_and_insserv -f -y openstack-swift-container
%restart_on_update openstack-swift-container
%preun container
%stop_on_removal openstack-swift-container
%postun container
%insserv_cleanup
%post object
%fillup_and_insserv -f -y openstack-swift-object
%restart_on_update openstack-swift-object
%preun object
%stop_on_removal openstack-swift-object
%postun object
%insserv_cleanup
%post proxy
%fillup_and_insserv -f -y openstack-swift-proxy
%restart_on_update openstack-swift-proxy
%preun proxy
%stop_on_removal openstack-swift-proxy
%postun proxy
%insserv_cleanup
%files
%defattr(-,root,root,-)
%doc AUTHORS LICENSE README
%dir %{_datadir}/%{name}/functions
%if 0%{?suse_version} < 1130
%dir %attr(0755, swift, root) %{_localstatedir}/run/swift
%endif
%dir %{_sysconfdir}/swift
%dir %{python_sitelib}/swift
%dir %{_datadir}/openstack-swift
%{_bindir}/swift
%{_bindir}/swift-account-audit
%{_bindir}/swift-drive-audit
%{_bindir}/swift-get-nodes
%{_bindir}/swift-init
%{_bindir}/swift-ring-builder
%{_bindir}/swift-stats-populate
%{_bindir}/swift-stats-report
%{_bindir}/swift-dispersion-populate
%{_bindir}/swift-dispersion-report
%{_bindir}/swift-bench
%{_bindir}/swift-recon
%{_bindir}/swift-recon-cron
%{_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
%{python_sitelib}/swift/*.py*
%{python_sitelib}/swift/common
# TODO: check if this is the correct subpackage
#{python_sitelib}/swift/stats
# ENDTODO
%{python_sitelib}/swift-1.*.egg-info
%files account
%defattr(-,root,root,-)
%doc etc/account-server.conf-sample
%{_initrddir}/%{name}-account
%{_sbindir}/rc%{name}-account
%if 0%{?suse_version} < 1130
%dir %attr(0755, swift, 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
%{python_sitelib}/swift/account
%files container
%defattr(-,root,root,-)
%doc etc/container-server.conf-sample
%{_initrddir}/%{name}-container
%{_sbindir}/rc%{name}-container
%if 0%{?suse_version} < 1130
%dir %attr(0755, swift, 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
%{_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
%{python_sitelib}/swift/container
%files object
%defattr(-,root,root,-)
%doc etc/account-server.conf-sample etc/rsyncd.conf-sample
%{_initrddir}/%{name}-object
%{_sbindir}/rc%{name}-object
%if 0%{?suse_version} < 1130
%dir %attr(0755, swift, root) %{_localstatedir}/run/swift/object-server
%endif
%dir %{_sysconfdir}/swift/object-server
%{_bindir}/swift-object-auditor
%if 0%{?BUILD_FROM_VCS}
%{_bindir}/swift-object-expirer
%endif
%{_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
%{python_sitelib}/swift/obj
%files proxy
%defattr(-,root,root,-)
%doc etc/proxy-server.conf-sample
%{_initrddir}/%{name}-proxy
%{_sbindir}/rc%{name}-proxy
%if 0%{?suse_version} < 1130
%dir %attr(0755, swift, root) %{_localstatedir}/run/swift/proxy-server
%endif
%dir %{_sysconfdir}/swift/proxy-server
%{_bindir}/swift-proxy-server
%{_mandir}/man8/swift-proxy-server.8.gz
%{python_sitelib}/swift/proxy
%if 0%{?with_doc}
%files doc
%defattr(-,root,root,-)
%doc LICENSE doc/build/html
%endif
%changelog