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

#
# spec file for package openstack-trove
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


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

%define version_unconverted 10.0.1.dev3

Name:           openstack-%{component}
Version:        10.0.1~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-rocky.tar.gz
Source2:        %{name}.logrotate
Source4:        %name.conf
# PATCH-FIX-UPSTREAM 0002-Add-ZypperPackagerMixin-to-guestagent.patch -- https://review.openstack.org/#/c/366165
Patch2:         0002-Add-ZypperPackagerMixin-to-guestagent.patch
# systemd service files
Source20:       openstack-trove-api.service
Source21:       openstack-trove-conductor.service
Source22:       openstack-trove-taskmanager.service
Source23:       openstack-trove-guestagent.service
Source50:       README.config
BuildRequires:  crudini
BuildRequires:  fdupes
BuildRequires:  openstack-suse-macros
BuildRequires:  python-Sphinx >= 1.1.2
BuildRequires:  python-devel
BuildRequires:  python-pbr >= 0.5.21
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
Requires:       logrotate
Requires:       python >= 2.7
Requires:       python-trove = %{version}
Requires(pre):  pwdutils
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%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 >= 2.3.4
Requires:       python-Jinja2 >= 2.10
Requires:       python-PasteDeploy >= 1.5.0
Requires:       python-Routes >= 2.3.1
Requires:       python-SQLAlchemy >= 1.0.10
Requires:       python-WebOb >= 1.7.1
Requires:       python-cinderclient >= 3.3.0
Requires:       python-designateclient >= 2.7.0
Requires:       python-enum34 >= 1.0.4
Requires:       python-eventlet >= 0.18.2
Requires:       python-heatclient >= 1.10.0
Requires:       python-httplib2 >= 0.9.1
Requires:       python-iso8601 >= 0.1.11
Requires:       python-jsonschema >= 2.6.0
Requires:       python-keystoneclient >= 3.8.0
Requires:       python-keystonemiddleware >= 4.17.0
Requires:       python-lxml >= 3.4.1
Requires:       python-netaddr >= 0.7.18
Requires:       python-netifaces >= 0.10.4
Requires:       python-neutronclient >= 6.7.0
Requires:       python-novaclient >= 9.1.0
Requires:       python-oslo.concurrency >= 3.26.0
Requires:       python-oslo.config >= 5.2.0
Requires:       python-oslo.context >= 2.19.2
Requires:       python-oslo.db >= 4.27.0
Requires:       python-oslo.i18n >= 3.15.3
Requires:       python-oslo.log >= 3.36.0
Requires:       python-oslo.messaging >= 5.29.0
Requires:       python-oslo.middleware >= 3.31.0
Requires:       python-oslo.serialization >= 2.18.0
Requires:       python-oslo.service >= 1.24.0
Requires:       python-oslo.utils >= 3.33.0
Requires:       python-osprofiler >= 1.4.0
Requires:       python-passlib >= 1.7.0
Requires:       python-pexpect >= 3.1
Requires:       python-proboscis >= 1.2.5.3
Requires:       python-six >= 1.10.0
Requires:       python-sqlalchemy-migrate >= 0.11.0
Requires:       python-stevedore >= 1.20.0
Requires:       python-swiftclient >= 3.2.0
Requires:       python-troveclient >= 2.2.0
Requires:       python-xmltodict >= 0.10.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}

%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}
Requires:       python-WebTest >= 2.0.27
Requires:       python-mock >= 2.0.0
Requires:       python-mox3 >= 0.20.0
Requires:       python-nose >= 1.3.7
Requires:       python-nosexcover >= 1.0.10
Requires:       python-openstack.nose_plugin >= 0.7
Requires:       python-os-testr >= 1.0.0
Requires:       python-pycrypto >= 2.6
Requires:       python-testrepository >= 0.0.18
Requires:       python-testtools >= 2.2.0
Requires:       python-wsgi_intercept >= 0.6.1

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

%prep
%setup -q -n %{component}-%{version_unconverted}
%patch2 -p1
%openstack_cleanup_prep

%build
python setup.py build
#python setup.py build_sphinx -b man

%install
python setup.py install --prefix=%{_prefix} --install-data=/ --root=%{buildroot}

### directories
install -d -m 700 %{buildroot}%{_rundir}/%{component}
install -d -m 0755 %{buildroot}/%_tmpfilesdir
install -D -m 644 %{SOURCE4} %{buildroot}/%_tmpfilesdir/%name.conf
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}

### configuration files
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}-api.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}-conductor.conf.d/
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}-taskmanager.conf.d/
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
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

### set default configuration
%define trove_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{trove_conf} DEFAULT log_dir %{_localstatedir}/log/%{component}

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

### Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE20} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE21} %{buildroot}%{_unitdir}/%{name}-conductor.service
install -p -D -m 444 %{SOURCE22} %{buildroot}%{_unitdir}/%{name}-taskmanager.service
install -p -D -m 444 %{SOURCE23} %{buildroot}%{_unitdir}/%{name}-guestagent.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-conductor
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-taskmanager
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-guestagent

### 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
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf

%pre api
%service_add_pre %{name}-api.service

%post api
%service_add_post %{name}-api.service

%preun api
%service_del_preun %{name}-api.service

%postun api
%restart_on_update %{name}-api.service
%service_del_postun %{name}-api.service

%pre conductor
%service_add_pre %{name}-conductor.service

%post conductor
%service_add_post %{name}-conductor.service

%preun conductor
%service_del_preun %{name}-conductor.service

%postun conductor
%restart_on_update %{name}-conductor.service
%service_del_postun %{name}-conductor.service

%pre taskmanager
%service_add_pre %{name}-taskmanager.service

%post taskmanager
%service_add_post %{name}-taskmanager.service

%preun taskmanager
%service_del_preun %{name}-taskmanager.service

%postun taskmanager
%restart_on_update %{name}-taskmanager.service
%service_del_postun %{name}-taskmanager.service

%pre guestagent
%service_add_pre %{name}-guestagent.service

%post guestagent
%service_add_post %{name}-guestagent.service

%preun guestagent
%service_del_preun %{name}-guestagent.service

%postun guestagent
%restart_on_update %{name}-guestagent.service
%service_del_postun %{name}-guestagent.service

%files
%defattr(-,root,root)
%doc LICENSE README.rst
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%dir %attr(0750, %{username}, %{username}) %{_localstatedir}/cache/%{component}
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/%{component}.conf.d/
%dir %{_sysconfdir}/%{component}/%{component}-api.conf.d/
%dir %{_sysconfdir}/%{component}/%{component}-conductor.conf.d/
%dir %{_sysconfdir}/%{component}/%{component}-taskmanager.conf.d/
%{_sysconfdir}/%{component}/README.config
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_bindir}/trove-mgmt-taskmanager
%{_bindir}/trove-manage
%{_sysconfdir}/%{component}/*.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
%dir %_tmpfilesdir
%_tmpfilesdir/%name.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
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/trove-api

%files conductor
%defattr(-,root,root,-)
%doc LICENSE
%{_unitdir}/%{name}-conductor.service
%{_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
%{_unitdir}/%{name}-taskmanager.service
%{_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
%{_unitdir}/%{name}-guestagent.service
%{_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