Skip to content

Instantly share code, notes, and snippets.

@rtnpro
Created June 21, 2015 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtnpro/20075dd4df631729d898 to your computer and use it in GitHub Desktop.
Save rtnpro/20075dd4df631729d898 to your computer and use it in GitHub Desktop.
Statscache RPM spec file
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?pyver: %global pyver %(%{__python} -c "import sys ; print sys.version[:3]")}
%global modname statscache
Name: statscache
Version: 0.0.1
Release: 1%{?dist}
Summary: A daemon to build and keep fedmsg statistics
Group: Applications/Internet
License: LGPLv2+
URL: http://github.com/fedora-infra/statscache
Source0: https://rtnpro.fedorapeople.org/statscache-0.0.1.tar.gz
BuildArch: noarch
BuildRequires: python-devel
BuildRequires: python-setuptools
# For tests
BuildRequires: python-nose
BuildRequires: python-six
BuildRequires: python-mock
BuildRequires: fedmsg
BuildRequires: python-fedmsg-meta-fedora-infrastructure
BuildRequires: python-sqlalchemy
Requires: fedmsg
Requires: python-fedmsg-meta-fedora-infrastructure
Requires: python-sqlalchemy
%description
Statscache is a plugin to the fedmsg-hub that sits listening in our
infrastructure. When new messages arrive, it will pass them off to `plugins
<https://github.com/fedora-infra/statscache_plugins>`_ that will calculate and
store various statistics. If we want a new kind of statistic to be kept, we
write a new plugin for it. It will come with a tiny flask frontend, much like
datagrepper, that allows you to query for this or that stat in this or that
format (csv, json, maybe html or svg too but that might be overkill). The idea
being that we can then build neater smarter frontends that can render
fedmsg-based activity very quickly.. and perhaps later drill-down into the
*details* kept in datagrepper.
It is kind of like a data mart (http://en.wikipedia.org/wiki/Data_mart).
%package common
Summary: Statscache common library
Group: Applications/Internet
%description common
This package contains the common libraries required by other statscache
components.
%package web
Summary: A REST API server on top of statscache
Group: Applications/Internet
Requires: %{name}-common = %{version}-%{release}
Requires: python-flask
%description web
This package exposes a REST API server to render data generated by statscache.
%package consumer
Summary: Statscache consumer
Group: Applications/Internet
Requires: %{name}-common = %{version}-%{release}
%description consumer
This runs a daemon which keeps listening to fedmsg and dispatches messages
to statscache plugins for storing data in required format.
%prep
%setup -q -n %{modname}-%{version}
%build
%{__python} setup.py build
%check
PYTHONPATH=$(pwd) python setup.py test
%install
%{__python} setup.py install -O1 --skip-build \
--install-data=%{_datadir} --root %{buildroot}
%{__mkdir_p} %{buildroot}%{_sysconfdir}/fedmsg.d/
%{__cp} fedmsg.d/*.py %{buildroot}%{_sysconfdir}/fedmsg.d/.
mkdir -p %{buildroot}%{_datadir}/%{modname}/apache/
install -m 644 apache/%{modname}.wsgi %{buildroot}%{_datadir}/%{modname}/apache/%{modname}.wsgi
install -m 644 apache/%{modname}.conf %{buildroot}%{_datadir}/%{modname}/apache/%{modname}.conf
mkdir -p %{buildroot}%{_sysconfdir}/%{modname}/
install -m 644 apache/%{modname}.cfg %{buildroot}%{_sysconfdir}/%{modname}/%{modname}.cfg
%pre
%{_sbindir}/groupadd -r %{modname} &>/dev/null || :
%{_sbindir}/useradd -r -s /sbin/nologin -d %{_datadir}/%{modname} -M \
-c 'Statscache' -g %{modname} %{modname} &>/dev/null || :
%files common
%doc README.rst COPYING
%{python_sitelib}/%{modname}/__init__.py*
%{python_sitelib}/%{modname}/utils.py*
%{python_sitelib}/%{modname}/schedule.py*
%{python_sitelib}/%{modname}/plugins.py*
%{python_sitelib}/%{modname}-%{version}-py%{pyver}.egg-info/
%dir %{_sysconfdir}/fedmsg.d/
%config(noreplace) %{_sysconfdir}/fedmsg.d/base.py*
%config(noreplace) %{_sysconfdir}/fedmsg.d/endpoints.py*
%config(noreplace) %{_sysconfdir}/fedmsg.d/logging.py*
%config(noreplace) %{_sysconfdir}/fedmsg.d/ssl.py*
%config(noreplace) %{_sysconfdir}/fedmsg.d/statscache.py*
%dir %{_sysconfdir}/%{modname}/
%config(noreplace) %{_sysconfdir}/%{modname}/%{modname}.cfg
%files web
%{python_sitelib}/%{modname}/app.py*
%dir %{_datadir}/%{modname}/apache/
%{_datadir}/%{modname}/apache/%{modname}.wsgi
%{_datadir}/%{modname}/apache/%{modname}.conf
%files consumer
%{python_sitelib}/%{modname}/consumer.py*
%{python_sitelib}/%{modname}/producer.py*
%changelog
* Sat Jun 20 2015 Ratnadeep Debpnath <rtnpro@gmail.com> - 0.0.1-1
- Initial packaging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment