diff --git a/openstack-panko.spec b/openstack-panko.spec new file mode 100644 index 0000000000000000000000000000000000000000..f497b2215ba1a485fbd494bd0aa46175db959df3 --- /dev/null +++ b/openstack-panko.spec @@ -0,0 +1,206 @@ +%global pypi_name panko +%global common_desc OpenStack Panko provides API to store events from OpenStack components. + +Name: openstack-panko +Version: 7.1.0 +Release: 1 +Summary: Panko provides Event storage and REST API + +License: ASL 2.0 +URL: http://github.com/openstack/panko +Source0: https://tarballs.openstack.org/%{pypi_name}/%{pypi_name}-%{version}.tar.gz + +Source1: %{pypi_name}-dist.conf +Source2: %{pypi_name}.logrotate +BuildArch: noarch + +BuildRequires: python3-setuptools +BuildRequires: python3-pbr +BuildRequires: python3-devel +BuildRequires: openstack-macros + +%description +HTTP API to store events. + +%package -n python3-%{pypi_name} +Summary: OpenStack panko python libraries + +Requires: python3-debtcollector +Requires: python3-tenacity +Requires: python3-keystonemiddleware +Requires: python3-oslo-config +Requires: python3-oslo-dbsync +Requires: python3-oslo-i18n +Requires: python3-oslo-log +Requires: python3-oslo-middleware +Requires: python3-oslo-policy +Requires: python3-oslo-reports +Requires: python3-oslo-utils +Requires: python3-oslo-serialization +Requires: python3-pecan +Requires: python3-six +Requires: python3-sqlalchemy +Requires: python3-alembic +Requires: python3-stevedore +Requires: python3-webob +Requires: python3-wsme +Requires: python3-dateutil +Requires: python3-pbr + +# Handle python2 exception +%if 3 == 2 +Requires: python-lxml +Requires: python-paste +Requires: python-paste-deploy +Requires: python-sqlalchemy-utils +Requires: PyYAML +%else +Requires: python3-lxml +Requires: python3-paste +Requires: python3-paste-deploy +Requires: python3-sqlalchemy-utils +Requires: python3-PyYAML +%endif + +%description -n python3-%{pypi_name} +%{common_desc} + +This package contains the Panko python library. + + +%package api + +Summary: OpenStack panko api + +Requires: %{name}-common = %{version}-%{release} + + +%description api +%{common_desc} + +This package contains the Panko API service. + +%package common +Summary: Components common to all OpenStack panko services + +# Config file generation +BuildRequires: python3-oslo-config +BuildRequires: python3-oslo-concurrency +BuildRequires: python3-oslo-db +BuildRequires: python3-oslo-log +BuildRequires: python3-oslo-messaging +BuildRequires: python3-oslo-policy +BuildRequires: python3-oslo-reports +BuildRequires: python3-oslo-service +BuildRequires: python3-tenacity +BuildRequires: python3-werkzeug + +Requires: python3-panko = %{version}-%{release} +Requires: openstack-ceilometer-common + + +%description common +%{common_desc} + +%package -n python3-panko-tests +Summary: Panko tests +Requires: python3-panko = %{version}-%{release} + +%description -n python3-%{pypi_name}-tests +This package contains the Panko test files. + +%prep +%setup -q -n %{pypi_name}-%{version} + +find . \( -name .gitignore -o -name .placeholder \) -delete + +find panko -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} + + +sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py + +%py_req_cleanup + + +%build + +# Generate config file +PYTHONPATH=. oslo-config-generator --config-file=etc/panko/panko-config-generator.conf + +%{py3_build} + +# Programmatically update defaults in sample config +# which is installed at /etc/panko/panko.conf +# TODO: Make this more robust +# Note it only edits the first occurrence, so assumes a section ordering in sample +# and also doesn't support multi-valued variables. +while read name eq value; do + test "$name" && test "$value" || continue + sed -i "0,/^# *$name=/{s!^# *$name=.*!#$name=$value!}" etc/panko/panko.conf +done < %{SOURCE1} + + +%install + +%{py3_install} + +mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig/ +mkdir -p %{buildroot}/%{_sysconfdir}/panko/ +mkdir -p %{buildroot}/%{_var}/log/%{name} + +install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/panko/panko-dist.conf +install -p -D -m 640 etc/panko/panko.conf %{buildroot}%{_sysconfdir}/panko/panko.conf +install -p -D -m 640 etc/panko/api_paste.ini %{buildroot}%{_sysconfdir}/panko/api_paste.ini + +#TODO(prad): build the docs at run time, once the we get rid of postgres setup dependency + +# Setup directories +install -d -m 755 %{buildroot}%{_sharedstatedir}/panko +install -d -m 755 %{buildroot}%{_sharedstatedir}/panko/tmp +install -d -m 755 %{buildroot}%{_localstatedir}/log/panko + +# Install logrotate +install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} + +# Remove all of the conf files that are included in the buildroot/usr/etc dir since we installed them above +rm -f %{buildroot}/usr/etc/panko/* + +%pre common +getent group panko >/dev/null || groupadd -r panko +if ! getent passwd panko >/dev/null; then + useradd -r -g panko -G panko,nobody -d %{_sharedstatedir}/panko -s /sbin/nologin -c "OpenStack panko Daemons" panko +fi +# Add ceilometer user to panko group to read panko config +usermod -a -G panko ceilometer +exit 0 + + +%files -n python3-panko +%{python3_sitelib}/panko +%{python3_sitelib}/panko-*.egg-info + +%exclude %{python3_sitelib}/panko/tests + +%files -n python3-panko-tests +%license LICENSE +%{python3_sitelib}/panko/tests + +%files api +%defattr(-,root,root,-) +%{_bindir}/panko-api +%{_bindir}/panko-dbsync +%{_bindir}/panko-expirer + +%files common +%dir %{_sysconfdir}/panko +%attr(-, root, panko) %{_datadir}/panko/panko-dist.conf +%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/panko.conf +%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/panko/api_paste.ini +%config(noreplace) %attr(-, root, panko) %{_sysconfdir}/logrotate.d/%{name} +%dir %attr(0755, panko, root) %{_localstatedir}/log/panko + +%defattr(-, panko, panko, -) +%dir %{_sharedstatedir}/panko +%dir %{_sharedstatedir}/panko/tmp + +%changelog +* Fri Nov 05 2021 wangxiyuan - 7.1.0-1 diff --git a/panko-7.1.0.tar.gz b/panko-7.1.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..631b18526c9f1fd8696af456d6bf46c6f505d3e3 Binary files /dev/null and b/panko-7.1.0.tar.gz differ diff --git a/panko-dist.conf b/panko-dist.conf new file mode 100644 index 0000000000000000000000000000000000000000..c33a2ee55fc647e84be0775a5bcd0bc7925c040b --- /dev/null +++ b/panko-dist.conf @@ -0,0 +1,4 @@ +[DEFAULT] +log_dir = /var/log/panko +use_stderr = False + diff --git a/panko.logrotate b/panko.logrotate new file mode 100644 index 0000000000000000000000000000000000000000..442c80f2998bbe5d581398d125f4bacb4e8f424d --- /dev/null +++ b/panko.logrotate @@ -0,0 +1,9 @@ +compress + +/var/log/panko/*.log { + weekly + rotate 4 + missingok + compress + minsize 100k +}