File openstack-trove.spec of Package openstack-trove-doc

#
# spec file for package openstack-trove
#
# Copyright (c) 2015 SUSE LINUX 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/
#


%define component trove
%define groupname %{component}
%define username %{component}

%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif

Name:           openstack-%{component}
Version:        2014.1.4.dev3
Release:        0
Summary:        Openstack DBaaS (Trove)
License:        Apache-2.0
Group:          System/Management
Url:            https://launchpad.net/trove
Source:         http://tarballs.openstack.org/trove/trove-stable-icehouse.tar.gz
Source1:        %{name}.init
Source2:        %{name}.logrotate
Source3:        %{name}-guestagent.init
# PATCH-FIX-UPSTREAM 0001-Add-support-to-detect-SUSE.patch
# https://review.openstack.org/108394
Patch1:         0001-Add-support-to-detect-SUSE.patch
# PATCH-FIX-UPSTREAM 0002-Add-SUSE-support-in-mysql-datastore.patch
# https://review.openstack.org/108703
Patch2:         0002-Add-SUSE-support-in-mysql-datastore.patch
# PATCH-FIX-UPSTREAM 0003-add-a-NoopPackagerMixin-class.patch
# https://review.openstack.org/108972
Patch3:         0003-add-a-NoopPackagerMixin-class.patch
# PATCH-FIX-UPSTREAM 0004-handle-repeating-mysqld-options-containing-equals.patch
# https://review.openstack.org/109595
Patch4:         0004-handle-repeating-mysqld-options-containing-equals.patch
# PATH-FIX-UPSTREAM 0005-fix-mysql-pid-file-path.patch
Patch5:         0005-fix-mysql-pid-file-path.patch
# PATCH-FIX-UPSTREAM 0006-hostname_require_ipv4-False.patch lp#1343192
Patch6:         0006-hostname_require_ipv4-False.patch
# PATCH-FIX-UPSTREAM 0001-Enable-usage-of-config-drive-for-file-injection.patch
# Backport of https://review.openstack.org/#/c/99797 for Icehouse
Patch7:         0001-Enable-usage-of-config-drive-for-file-injection.patch
%if 0%{?suse_version} > 1230
Source10:       %name.conf
BuildRequires:  systemd
%endif
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-devel
BuildRequires:  python-pbr >= 0.5.21
# Documentation requirements:
BuildRequires:  python-Babel >= 1.3
BuildRequires:  python-Sphinx >= 1.1.2
Requires:       logrotate
Requires:       python >= 2.6.8
Requires:       python-trove = %{version}
%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
Trove is an Incubated OpenStack project providing
Database as a Service for Openstack.

%package -n python-trove
Summary:        Openstack DBaaS (Trove) - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.6.8
Requires:       python-Babel >= 1.3
Requires:       python-Jinja2
Requires:       python-PasteDeploy >= 1.5.0
Requires:       python-Routes >= 1.12.3
Requires:       python-SQLAlchemy >= 0.7.8
Requires:       python-WebOb >= 1.2.3
Requires:       python-cinderclient >= 1.0.6
Requires:       python-designateclient >= 1.0.0
Requires:       python-eventlet >= 0.13.0
Requires:       python-heatclient >= 0.2.3
Requires:       python-httplib2 >= 0.7.5
Requires:       python-iso8601 >= 0.1.9
Requires:       python-jsonschema >= 2.0.0
Requires:       python-keystoneclient >= 0.7.0
Requires:       python-kombu >= 2.4.8
Requires:       python-lxml >= 2.3
Requires:       python-netaddr >= 0.7.6
Requires:       python-novaclient >= 2.17.0
Requires:       python-oslo.config >= 1.2.0
Requires:       python-passlib
Requires:       python-pexpect >= 3.1
Requires:       python-proboscis >= 1.2.5.3
Requires:       python-sqlalchemy-migrate >= 0.8.2
Requires:       python-swiftclient >= 1.6
Requires:       python-troveclient
Requires:       python-wsgi_intercept >= 0.6.1

%description -n python-trove
This package contains the core code of OpenStack Trove.

%package api
Summary:        Openstack DBaaS (Trove) - API
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       %{name}-conductor = %{version}

%description api
This package contains the OpenStack Trove Manager Daemon.

%package conductor
Summary:        Openstack DBaaS (Trove) - Conductor
Group:          System/Management
Requires:       %{name} = %{version}

%description conductor
This package contains the conductor of OpenStack Nova

%package taskmanager
Summary:        Openstack DBaaS (Trove) - Taskmanager
Group:          System/Management
Requires:       %{name} = %{version}

%description taskmanager
This package contains the Database Service TaskManager

%package guestagent
Summary:        Openstack DBaaS (Trove) - GuestAgent
Group:          System/Management
Requires:       %{name} = %{version}
Requires:       python-trove = %{version}

%description guestagent
This package contains the Database Service GuestAgent, The guestagent is
a service that runs within the guest instance, responsible for managing
and performing operations on the Database itself. The Guest Agent
listens for RPC messages through the message bus and performs the
requested operation.

%package test
Summary:        Openstack Trove - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
%if 0%{?suse_version} <= 1110
Requires:       python-discover
%endif
Requires:       python-WebTest >= 2.0
Requires:       python-flake8 >= 2.0
Requires:       python-mock >= 1.0
Requires:       python-mox >= 0.5.3
Requires:       python-nose
Requires:       python-nosexcover
Requires:       python-openstack.nose_plugin >= 0.7
Requires:       python-pep8 >= 1.4.5
Requires:       python-pyflakes >= 0.7.2
Requires:       python-testrepository >= 0.0.18
Requires:       python-testtools >= 0.9.34

%description test
This package contains testsuite files for %{name}.

%prep
%setup -q -n %{component}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%openstack_cleanup_prep

%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 700 %{buildroot}%{_rundir}/%{component}
%if 0%{?suse_version} > 1230
install -D -m 644 %{SOURCE10} %{buildroot}/%_tmpfilesdir/%name.conf
%endif
install -d -m 755 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}

### configuration files
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
install -p -D -m 600 etc/trove/trove.conf.sample %{buildroot}%{_sysconfdir}/trove/trove.conf
install -p -D -m 600 etc/trove/trove-guestagent.conf.sample %{buildroot}%{_sysconfdir}/trove/trove-guestagent.conf
install -p -D -m 600 etc/trove/trove-taskmanager.conf.sample %{buildroot}%{_sysconfdir}/trove/trove-taskmanager.conf
install -p -m 644 etc/trove/*.ini %{buildroot}%{_sysconfdir}/%{component}/
install -d %{buildroot}%{_sysconfdir}/%{component}/conf.d

for i in etc/%{component}/%{component}*conf.sample; do
    install -p -D -m 0644 $i %{buildroot}/${i%%.sample}
done

### bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}

### init scripts
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_initddir}
for i in api conductor taskmanager ; do
    install -m 755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}-$i
    sed -i -e "s/__NAME__/$i/g" %{buildroot}%{_initddir}/%{name}-$i
    if [ "$i" != "api" ];
    then
        sed -i -e "s/trove.conf/trove-$i.conf/g" %{buildroot}%{_initddir}/%{name}-$i
    fi
    ln -s ../..%{_initddir}/%{name}-$i %{buildroot}%{_sbindir}/rc%{name}-$i
done
install -m 755 %{SOURCE3} %{buildroot}%{_initddir}/%{name}-guestagent
ln -s ../..%{_initddir}/%{name}-guestagent %{buildroot}%{_sbindir}/rc%{name}-guestagent

### documentation
#install -d %{buildroot}%{_mandir}/man1
#install -m 644 build/sphinx/man/*.1 %{buildroot}%{_mandir}/man1

### test subpackage
%openstack_test_package_install
%fdupes %{buildroot}%{_localstatedir}/lib/%{name}-test

### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}

%pre
%openstack_pre_user_group_create %{username} %{groupname}

%post api
%{fillup_and_insserv -f %{name}-api}

%preun api
%stop_on_removal %{name}-api

%postun api
%restart_on_update %{name}-api
%insserv_cleanup

%post conductor
%{fillup_and_insserv -f %{name}-conductor}

%preun conductor
%stop_on_removal %{name}-conductor

%postun conductor
%restart_on_update %{name}-conductor
%insserv_cleanup

%post taskmanager
%{fillup_and_insserv -f %{name}-taskmanager}

%preun taskmanager
%stop_on_removal %{name}-taskmanager

%postun taskmanager
%restart_on_update %{name}-taskmanager
%insserv_cleanup

%post guestagent
%{fillup_and_insserv -f %{name}-guestagent}

%preun guestagent
%stop_on_removal %{name}-guestagent

%postun guestagent
%restart_on_update %{name}-guestagent
%insserv_cleanup

%files
%defattr(-,root,root)
%doc LICENSE README.rst
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%dir %attr(0750, %{username}, %{username}) %{_localstatedir}/cache/%{component}
%if 0%{?suse_version} > 1230
%_tmpfilesdir/%name.conf
%else
%dir %attr(0700, %{username}, %{groupname}) %{_rundir}/%{component}
%endif
%dir %{_sysconfdir}/%{component}
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_bindir}/trove-mgmt-taskmanager
%{_sysconfdir}/%{component}/*.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf

%files -n python-%{component}
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info

%files api
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-api
%{_sbindir}/rc%{name}-api
%{_bindir}/trove-api
%{_bindir}/trove-manage

%files conductor
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-conductor
%{_sbindir}/rc%{name}-conductor
%{_bindir}/trove-conductor
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}-conductor.conf

%files taskmanager
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-taskmanager
%{_sbindir}/rc%{name}-taskmanager
%{_bindir}/%{component}-taskmanager
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}-taskmanager.conf

%files guestagent
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-guestagent
%{_sbindir}/rc%{name}-guestagent
%{_bindir}/%{component}-guestagent
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}-guestagent.conf

%files test
%defattr(-,root,root)
%{_bindir}/trove-fake-mode
%{_localstatedir}/lib/%{name}-test/

%changelog
openSUSE Build Service is sponsored by