File openstack-designate.spec of Package openstack-designate

#
# spec file for package openstack-designate
#
# 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 http://bugs.opensuse.org/
#


%define component designate
%define groupname %{component}
%define username %{component}

%define version_unconverted 5.0.3.dev6

Name:           openstack-%{component}
Version:        5.0.3~dev6
Release:        0
Summary:        OpenStack DNS Service (Designate)
License:        Apache-2.0
Group:          Development/Languages/Python
Url:            https://github.com/stackforge/designate
Source:         http://tarballs.openstack.org/designate/designate-stable-pike.tar.gz
Source4:        %name.logrotate
Source5:        %name.conf
Source6:        designate-sudoers
Source10:       %name-api.service
Source11:       %name-sink.service
Source12:       %name-central.service
Source13:       %name-agent.service
Source14:       %name-producer.service
Source15:       %name-worker.service
Source16:       %name-mdns.service
Source17:       %name-pool-manager.service
Source50:       README.config
BuildRequires:  crudini
BuildRequires:  openstack-suse-macros
BuildRequires:  openstack-suse-sudo
BuildRequires:  python-devel
BuildRequires:  python-openstackdocstheme
BuildRequires:  python-pbr
BuildRequires:  python-setuptools
BuildRequires:  python-sphinxcontrib-httpdomain
BuildRequires:  systemd
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
Requires:       logrotate
Requires:       openstack-suse-sudo
Requires:       python-designate = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires(pre):  pwdutils
BuildArch:      noarch
Provides:       openstack-designate-mdns = %{version}
Provides:       openstack-designate-pool-manager = %{version}

%description
Designate is an OpenStack inspired DNSaaS.

%package -n python-designate
Summary:        OpenStack DNS Service (Designate) - Python module
Group:          Development/Languages/Python
Requires:       python >= 2.6.8
Requires:       python-Babel >= 2.3.4
Requires:       python-Flask >= 0.10
Requires:       python-Jinja2 >= 2.8
Requires:       python-Paste
Requires:       python-PasteDeploy >= 1.5.0
Requires:       python-SQLAlchemy >= 1.0.10
Requires:       python-WebOb >= 1.7.1
Requires:       python-Werkzeug >= 0.7
Requires:       python-debtcollector >= 1.2.0
Requires:       python-designateclient >= 1.5.0
Requires:       python-dnspython >= 1.14.0
Requires:       python-eventlet >= 0.18.2
Requires:       python-greenlet >= 0.3.2
Requires:       python-jsonschema >= 2.0.0
Requires:       python-keystoneauth1 >= 3.1.0
Requires:       python-keystonemiddleware >= 4.12.0
Requires:       python-netaddr >= 0.7.13
Requires:       python-neutronclient >= 6.3.0
Requires:       python-os-win >= 2.0.0
Requires:       python-oslo.concurrency >= 3.8.0
Requires:       python-oslo.config >= 4.0.0
Requires:       python-oslo.context >= 2.14.0
Requires:       python-oslo.db >= 4.24.0
Requires:       python-oslo.i18n >= 2.1.0
Requires:       python-oslo.log >= 3.22.0
Requires:       python-oslo.messaging >= 5.24.2
Requires:       python-oslo.middleware >= 3.27.0
Requires:       python-oslo.policy >= 1.23.0
Requires:       python-oslo.reports >= 0.6.0
Requires:       python-oslo.rootwrap >= 5.0.0
Requires:       python-oslo.serialization >= 1.10.0
Requires:       python-oslo.service >= 1.10.0
Requires:       python-oslo.utils >= 3.20.0
Requires:       python-pbr >= 2.0.0
Requires:       python-pecan >= 1.0.0
Requires:       python-python-memcached >= 1.56
Requires:       python-requests >= 2.14.2
Requires:       python-six >= 1.9.0
Requires:       python-sqlalchemy-migrate >= 0.11.0
Requires:       python-stevedore >= 1.20.0
Requires:       python-suds-jurko >= 0.6
Requires:       python-tenacity >= 3.2.1
Requires:       python-tooz >= 1.47.0

%description -n python-designate
Designate is an OpenStack inspired DNSaaS.

This package contains the core Python module of OpenStack Designate.


%package api
Summary:        OpenStack DNS (Designate) - API
Group:          System/Management
Requires:       %{name} = %{version}

%description api
This package contains the OpenStack DNS API.

%package central
Summary:        OpenStack DNS (Designate) - Central
Group:          System/Management
Requires:       %{name} = %{version}

%description central
This package contains the OpenStack DNS Central.

%package sink
Summary:        OpenStack DNS (Designate) - Sink
Group:          System/Management
Requires:       %{name} = %{version}

%description sink
This package contains the OpenStack DNS Sink.

%package agent
Summary:        OpenStack DNS (Designate) - Agent
Group:          System/Management
Requires:       %{name} = %{version}

%description agent
This package contains the OpenStack DNS agent.

%package producer
Summary:        OpenStack DNS (Designate) - Producer
Group:          System/Management
Requires:       %{name} = %{version}

%description producer
This package contains the OpenStack DNS producer.

%package worker
Summary:        OpenStack DNS (Designate) - Worker
Group:          System/Management
Requires:       %{name} = %{version}

%description worker
This package contains the OpenStack DNS worker.

%package test
Summary:        OpenStack DNS (Designate) - Testsuite
Group:          Development/Languages/Python
Requires:       %{name} = %{version}
Requires:       python-WebTest >= 2.0
Requires:       python-designateclient >= 1.5.0
Requires:       python-fixtures >= 3.0.0
Requires:       python-mock >= 2.0
Requires:       python-oslotest >= 1.10.0
Requires:       python-python-subunit >= 0.0.18
Requires:       python-requests-mock >= 1.1
Requires:       python-testrepository >= 0.0.18
Requires:       python-testscenarios >= 0.4
Requires:       python-testtools >= 1.4.0

%description test
The OpenStack Designate testsuite. It is used to verify the
functionality of OpenStack Designate.

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

%build
python setup.py build

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

### directories
install -d -m 700 %{buildroot}%{_rundir}/%{component}
install -D -m 644 %{SOURCE5} %{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 %{buildroot}%{_sysconfdir}
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
mv %{buildroot}/usr/%{_sysconfdir}/designate/* %{buildroot}%{_sysconfdir}/designate/.
for f in %{buildroot}%{_sysconfdir}/designate/*.sample ; do mv $f ${f/.sample} ; done
install -p -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/

### systemd unit files
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-sink.service
install -p -D -m 444 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-central.service
install -p -D -m 444 %{SOURCE13} %{buildroot}%{_unitdir}/%{name}-agent.service
install -p -D -m 444 %{SOURCE14} %{buildroot}%{_unitdir}/%{name}-producer.service
install -p -D -m 444 %{SOURCE15} %{buildroot}%{_unitdir}/%{name}-worker.service
install -p -D -m 444 %{SOURCE16} %{buildroot}%{_unitdir}/%{name}-mdns.service
install -p -D -m 444 %{SOURCE17} %{buildroot}%{_unitdir}/%{name}-pool-manager.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-sink
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-central
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-agent
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-producer
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-worker
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-mdns
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-pool-manager

### sudoers configuration for designate-rootwrap:
install -D -m 440 %{SOURCE6} %{buildroot}%{_sysconfdir}/sudoers.d/openstack-designate

### test subpackage
%openstack_test_package_install

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

%pre
%openstack_pre_user_group_create %{username} %{groupname}
%service_add_pre %{name}-mdns.service
%service_add_pre %{name}-pool-manager.service

%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%service_add_post %{name}-mdns.service
%service_add_post %{name}-pool-manager.service

%preun
%service_del_preun %{name}-mdns.service
%service_del_preun %{name}-pool-manager.service

%postun
%restart_on_update %{name}-mdns.service
%restart_on_update %{name}-pool-manager.service
%service_del_postun %{name}-mdns.service
%service_del_postun %{name}-pool-manager.service

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

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

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

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

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

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

%preun central
%service_del_postun %{name}-central.service

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

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

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

%preun sink
%service_del_postun %{name}-sink.service

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

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

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

%preun agent
%service_del_postun %{name}-agent.service

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

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

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

%preun producer
%service_del_postun %{name}-producer.service

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

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

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

%preun worker
%service_del_postun %{name}-worker.service

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

%files
%defattr(-,root,root)
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%_tmpfilesdir/%name.conf
%dir %attr(0750, root, %{groupname}) %{_sysconfdir}/%{component}
%dir %attr(0750, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/
%{_sysconfdir}/%{component}/README.config
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
%config %{_sysconfdir}/%{component}/api-paste.ini
%config %{_sysconfdir}/%{component}/policy.json
%config %{_sysconfdir}/%{component}/rootwrap.conf
%config %{_sysconfdir}/%{component}/rootwrap.d
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config %{_sysconfdir}/sudoers.d/openstack-designate
%{_unitdir}/%{name}-mdns.service
%{_unitdir}/%{name}-pool-manager.service
%{_sbindir}/rc%{name}-mdns
%{_sbindir}/rc%{name}-pool-manager
%{_bindir}/designate-rootwrap
%{_bindir}/designate-manage
%{_bindir}/designate-mdns
%{_bindir}/designate-pool-manager
%{_bindir}/designate-zone-manager

%files api
%defattr(-,root,root)
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/designate-api

%files central
%defattr(-,root,root)
%{_unitdir}/%{name}-central.service
%{_sbindir}/rc%{name}-central
%{_bindir}/designate-central

%files sink
%defattr(-,root,root)
%{_unitdir}/%{name}-sink.service
%{_sbindir}/rc%{name}-sink
%{_bindir}/designate-sink

%files agent
%defattr(-,root,root)
%{_unitdir}/%{name}-agent.service
%{_sbindir}/rc%{name}-agent
%{_bindir}/designate-agent

%files producer
%defattr(-,root,root)
%{_unitdir}/%{name}-producer.service
%{_sbindir}/rc%{name}-producer
%{_bindir}/designate-producer

%files worker
%defattr(-,root,root)
%{_unitdir}/%{name}-worker.service
%{_sbindir}/rc%{name}-worker
%{_bindir}/designate-worker

%files -n python-designate
%defattr(-,root,root,-)
%license LICENSE
%{python_sitelib}

%files test
%defattr(-,root,root)
%{_localstatedir}/lib/openstack-%{component}-test

%changelog
openSUSE Build Service is sponsored by