File openstack-aodh.spec of Package openstack-aodh
#
# spec file for package openstack-aodh
#
# 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 aodh
%define groupname %{component}
%define username %{component}
%define version_unconverted 7.0.1.dev5
Name: openstack-%{component}
Version: 7.0.1~dev5
Release: 0
Summary: Alarm engine of the Ceilometer project
License: Apache-2.0
Group: System/Management
Url: https://launchpad.net/aodh
Source: http://tarballs.openstack.org/aodh/aodh-stable-rocky.tar.gz
Source2: %{name}.logrotate
Source3: %{name}-expirer.cron
Source4: %name.conf
# systemd service files
Source10: %{name}-api.service
Source11: %{name}-evaluator.service
Source12: %{name}-notifier.service
Source13: %{name}-listener.service
Source50: README.config
BuildRequires: crudini
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: openstack-suse-sudo
BuildRequires: python-PasteDeploy
BuildRequires: python-PyMySQL
BuildRequires: python-SQLAlchemy
BuildRequires: python-WSME
BuildRequires: python-WebOb
BuildRequires: python-alembic
BuildRequires: python-base
BuildRequires: python-ceilometerclient
BuildRequires: python-cotyledon
BuildRequires: python-croniter
BuildRequires: python-gnocchiclient
BuildRequires: python-jsonschema
BuildRequires: python-keystoneclient
BuildRequires: python-keystonemiddleware
BuildRequires: python-lxml
BuildRequires: python-oslo.config
BuildRequires: python-oslo.db
BuildRequires: python-oslo.i18n
BuildRequires: python-oslo.log
BuildRequires: python-oslo.messaging
BuildRequires: python-oslo.middleware
BuildRequires: python-oslo.policy
BuildRequires: python-oslo.serialization
BuildRequires: python-oslo.utils
BuildRequires: python-pbr
BuildRequires: python-pecan
BuildRequires: python-psycopg2
BuildRequires: python-pymongo
BuildRequires: python-pytz
BuildRequires: python-reno
BuildRequires: python-requests
BuildRequires: python-setuptools
BuildRequires: python-six
BuildRequires: python-sphinxcontrib-httpdomain
BuildRequires: python-sphinxcontrib-pecanwsme
BuildRequires: python-stevedore
BuildRequires: python-tenacity
BuildRequires: python-tooz
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
Requires: logrotate
Requires(pre): pwdutils
Requires: openstack-suse-sudo
Requires: python-%{component} = %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Aodh is the alarm engine of the Ceilometer project.
%package -n python-aodh
Summary: Alarm engine of the Ceilometer project - Python module
Group: Development/Languages/Python
Requires: python-PasteDeploy >= 1.5.0
Requires: python-SQLAlchemy >= 0.9.7
Requires: python-SQLAlchemy-Utils
Requires: python-WSME >= 0.8
Requires: python-WebOb >= 1.2.3
Requires: python-alembic >= 0.7.2
Requires: python-cachetools >= 1.1.6
Requires: python-ceilometerclient >= 1.5.0
Requires: python-cotyledon
Requires: python-croniter >= 0.3.4
Requires: python-debtcollector >= 1.2.0
Requires: python-futures >= 3.0
Requires: python-futurist >= 0.11.0
Requires: python-gnocchiclient >= 3.1.0
Requires: python-jsonschema >= 2.0.0
Requires: python-keystoneauth1 >= 2.1
Requires: python-keystoneclient >= 1.6.0
Requires: python-keystonemiddleware >= 2.2.0
Requires: python-lxml >= 2.3
Requires: python-oslo.config >= 2.6.0
Requires: python-oslo.db >= 4.8.0
Requires: python-oslo.i18n >= 1.5.0
Requires: python-oslo.log >= 1.2.0
Requires: python-oslo.messaging >= 5.2.0
Requires: python-oslo.middleware >= 3.22.0
Requires: python-oslo.policy >= 0.5.0
Requires: python-oslo.serialization >= 1.4.0
Requires: python-oslo.utils >= 3.5.0
Requires: python-pbr >= 2.0.0
Requires: python-pecan >= 0.8.0
Requires: python-psycopg2
Requires: python-pytz >= 2013.6
Requires: python-requests >= 2.5.2
Requires: python-six >= 1.9.0
Requires: python-stevedore >= 1.5.0
Requires: python-tenacity >= 3.2.1
Requires: python-tooz >= 1.28.0
%description -n python-aodh
Aodh is the alarm engine of the Ceilometer project.
This package contains the core Python module of Aodh.
%package api
Summary: Alarm engine of the Ceilometer project - API
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description api
Aodh is the alarm engine of the Ceilometer project.
This package contains the OpenStack Aodh API.
%package evaluator
Summary: Alarm engine of the Ceilometer project - Evaluator
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description evaluator
Aodh is the alarm engine of the Ceilometer project.
This package contains the OpenStack Aodh Evaluator.
%package notifier
Summary: Alarm engine of the Ceilometer project - Notifier
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description notifier
Aodh is the alarm engine of the Ceilometer project.
This package contains the OpenStack Aodh Notifier.
%package listener
Summary: Alarm engine of the Ceilometer project - Listener
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description listener
Aodh is the alarm engine of the Ceilometer project.
This package contains the OpenStack Aodh Listener.
%package expirer
Summary: Alarm engine of the Ceilometer project - Expirer
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description expirer
Aodh is the alarm engine of the Ceilometer project.
This package contains the OpenStack Aodh Expirer.
%package test
Summary: Alarm engine of the Ceilometer project - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python-fixtures >= 1.3.1
Requires: python-gabbi >= 1.30.0
Requires: python-mock >= 1.0
Requires: python-os-testr >= 0.4.1
Requires: python-oslotest >= 2.15.0
Requires: python-pifpaf >= 1.0.1
Requires: python-python-subunit >= 0.0.18
Requires: python-reno >= 0.1.1
Requires: python-testrepository >= 0.0.18
Requires: python-testresources >= 0.2.4
Requires: python-testtools >= 1.4.0
%description test
The Aodh testsuite. It is used to verify the functionality of Aodh.
%prep
%setup -q -n aodh-%{version_unconverted}
%openstack_cleanup_prep
%build
python setup.py build
# python setup.py build_sphinx
%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
### directories
install -d -m 750 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}
install -d -m 700 %{buildroot}%{_rundir}/%{component}
install -D -m 644 %{SOURCE4} %{buildroot}/%_tmpfilesdir/%name.conf
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
### configuration files
PYTHONPATH=. oslo-config-generator --config-file %{_builddir}/%{component}-%{version_unconverted}/build/lib/aodh/cmd/aodh-config-generator.conf --output-file %{_tmppath}/aodh.conf.sample
install -p -D -m 644 %{_tmppath}/aodh.conf.sample %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
# 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 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-evaluator.service
install -p -D -m 444 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-notifier.service
install -p -D -m 444 %{SOURCE13} %{buildroot}%{_unitdir}/%{name}-listener.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-evaluator
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-notifier
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-listener
# WSGI app
install -D -p -m 644 %{buildroot}%{python_sitelib}/%{component}/api/app.wsgi %{buildroot}/srv/www/%{component}-api/app.wsgi
### cron jobs
mkdir -p %{buildroot}%{_sysconfdir}/cron.daily
install -p -m 755 %{SOURCE3} %{buildroot}%{_sysconfdir}/cron.daily
### documentation
# TODO(aplanas): patch to launch postgresql
# install -d %{buildroot}%{_mandir}/man1
# install -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1
### test subpackage
%openstack_test_package_install
%fdupes %{buildroot}%{_localstatedir}/lib/%{name}-test
### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
### set default configuration
%define aodh_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{aodh_conf} DEFAULT log_dir /var/log/aodh
%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 evaluator
%service_add_pre %{name}-evaluator.service
%post evaluator
%service_add_post %{name}-evaluator.service
%preun evaluator
%service_del_preun %{name}-evaluator.service
%postun evaluator
%restart_on_update %{name}-evaluator.service
%service_del_postun %{name}-evaluator.service
%pre notifier
%service_add_pre %{name}-notifier.service
%post notifier
%service_add_post %{name}-notifier.service
%preun notifier
%service_del_preun %{name}-notifier.service
%postun notifier
%restart_on_update %{name}-notifier.service
%service_del_postun %{name}-notifier.service
%pre listener
%service_add_pre %{name}-listener.service
%post listener
%service_add_post %{name}-listener.service
%preun listener
%service_del_preun %{name}-listener.service
%postun listener
%restart_on_update %{name}-listener.service
%service_del_postun %{name}-listener.service
%files
%defattr(-,root,root)
%doc README.rst
%license LICENSE
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%_tmpfilesdir/%name.conf
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/%{component}.conf.d/
%{_sysconfdir}/%{component}/README.config
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
%{_bindir}/%{component}-config-generator
%files -n python-%{component}
%defattr(-,root,root,-)
%license LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
%exclude %{python_sitelib}/%{component}/tests/unit/
%exclude %{python_sitelib}/%{component}/tests/functional/
%files api
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
/srv/www/%{component}-api
%{_bindir}/%{component}-dbsync
%{_bindir}/%{component}-api
%files evaluator
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-evaluator.service
%{_sbindir}/rc%{name}-evaluator
%{_bindir}/%{component}-evaluator
%files notifier
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-notifier.service
%{_sbindir}/rc%{name}-notifier
%{_bindir}/%{component}-notifier
%files listener
%defattr(-,root,root,-)
%license LICENSE
%{_unitdir}/%{name}-listener.service
%{_sbindir}/rc%{name}-listener
%{_bindir}/%{component}-listener
%files expirer
%defattr(-,root,root,-)
%license LICENSE
%{_bindir}/%{component}-expirer
%config(noreplace) %{_sysconfdir}/cron.daily/%{name}-expirer.cron
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%{python_sitelib}/%{component}/tests/unit/
%{python_sitelib}/%{component}/tests/functional/
%changelog