Blame ara.spec

11cbfda
%if 0%{?fedora}
11cbfda
%global with_python3 1
11cbfda
%endif
11cbfda
%global package_name ara
11cbfda
11cbfda
Name:           %{package_name}
11cbfda
Version:        0.14.0
11cbfda
Release:        1%{?dist}
11cbfda
Summary:        ARA: Ansible Analysis - Record and visualize Ansible Playbook runs
11cbfda
11cbfda
License:        GPLv3
11cbfda
URL:            https://git.openstack.org/cgit/openstack/ara
11cbfda
Source0:        https://pypi.io/packages/source/a/%{package_name}/%{package_name}-%{version}.tar.gz
11cbfda
Source1:        ara-server.service
11cbfda
Source2:        ara.cfg
11cbfda
Source3:        ara.logrotate
11cbfda
BuildArch:      noarch
11cbfda
11cbfda
%{?systemd_requires}
11cbfda
BuildRequires:  systemd
11cbfda
BuildRequires:  git
11cbfda
11cbfda
Requires:       python2-%{package_name} = %{version}-%{release}
11cbfda
Requires:       %{package_name}-common = %{version}-%{release}
11cbfda
11cbfda
%description
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
11cbfda
%if 0%{?with_python3}
11cbfda
%package -n %{package_name}-python3
11cbfda
Summary:        %{summary}
11cbfda
11cbfda
Requires:       python3-%{package_name} = %{version}-%{release}
11cbfda
Requires:       %{package_name}-common = %{version}-%{release}
11cbfda
11cbfda
%description -n %{package_name}-python3
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
%endif
11cbfda
11cbfda
%package -n python2-%{package_name}
11cbfda
Summary:        %{summary}
11cbfda
11cbfda
BuildRequires:  python2-devel
11cbfda
BuildRequires:  python2-pbr
11cbfda
BuildRequires:  python2-setuptools
11cbfda
# Test dependencies for %check
11cbfda
BuildRequires:  ansible >= 2.1.6.0
11cbfda
BuildRequires:  python2-debtcollector
11cbfda
BuildRequires:  python2-decorator
11cbfda
BuildRequires:  python2-flask
11cbfda
BuildRequires:  python2-flask-migrate
11cbfda
BuildRequires:  python2-jinja2 >= 2.9
11cbfda
BuildRequires:  python2-junit_xml
11cbfda
BuildRequires:  python2-lxml
11cbfda
BuildRequires:  python2-oslo-serialization
11cbfda
BuildRequires:  python2-oslo-utils
11cbfda
BuildRequires:  python2-mock
11cbfda
BuildRequires:  python2-pyfakefs
11cbfda
BuildRequires:  python2-pygments
11cbfda
BuildRequires:  python2-pytest
11cbfda
BuildRequires:  python2-sqlalchemy
11cbfda
BuildRequires:  python2-subunit
11cbfda
BuildRequires:  python2-XStatic
11cbfda
BuildRequires:  python2-XStatic-Bootstrap-SCSS
11cbfda
BuildRequires:  python2-XStatic-DataTables
11cbfda
BuildRequires:  python2-XStatic-jQuery
11cbfda
BuildRequires:  python2-XStatic-Patternfly
11cbfda
BuildRequires:  python2-XStatic-Patternfly-Bootstrap-Treeview
11cbfda
BuildRequires:  python-cliff
11cbfda
BuildRequires:  python-flask-script
11cbfda
BuildRequires:  python-frozen-flask
11cbfda
11cbfda
Requires:       ansible >= 2.1.6.0
11cbfda
Requires:       python2-debtcollector
11cbfda
Requires:       python2-decorator
11cbfda
Requires:       python2-flask
11cbfda
Requires:       python2-flask-migrate
11cbfda
Requires:       python2-jinja2 >= 2.9
11cbfda
Requires:       python2-junit_xml
11cbfda
Requires:       python2-oslo-serialization
11cbfda
Requires:       python2-oslo-utils
11cbfda
Requires:       python2-pyfakefs
11cbfda
Requires:       python2-pygments
11cbfda
Requires:       python2-sqlalchemy
11cbfda
Requires:       python2-subunit
11cbfda
Requires:       python2-XStatic
11cbfda
Requires:       python2-XStatic-Bootstrap-SCSS
11cbfda
Requires:       python2-XStatic-DataTables
11cbfda
Requires:       python2-XStatic-jQuery
11cbfda
Requires:       python2-XStatic-Patternfly
11cbfda
Requires:       python2-XStatic-Patternfly-Bootstrap-Treeview
11cbfda
Requires:       python-cliff
11cbfda
Requires:       python-flask-script
11cbfda
Requires:       python-frozen-flask
11cbfda
11cbfda
%{?python_provide:%python_provide python2-%{package_name}}
11cbfda
11cbfda
%description -n python2-%{package_name}
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
11cbfda
%package -n python2-%{package_name}-tests
11cbfda
Summary:        Tests for %{package_name}
11cbfda
11cbfda
Requires:       python2-%{package_name} = %{version}-%{release}
11cbfda
Requires:       python2-lxml
11cbfda
Requires:       python2-mock
11cbfda
Requires:       python-pytest
11cbfda
11cbfda
%description -n python2-%{package_name}-tests
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
11cbfda
This package contains the test files.
11cbfda
11cbfda
%if 0%{?with_python3}
11cbfda
%package -n python3-%{package_name}
11cbfda
Summary:        %{summary}
11cbfda
11cbfda
BuildRequires:  python3-devel
11cbfda
BuildRequires:  python3-pbr
11cbfda
BuildRequires:  python3-setuptools
11cbfda
# Test dependencies for %check
11cbfda
BuildRequires:  ansible-python3 >= 2.1.6.0
11cbfda
BuildRequires:  python3-cliff
11cbfda
BuildRequires:  python3-debtcollector
11cbfda
BuildRequires:  python3-decorator
11cbfda
BuildRequires:  python3-flask
11cbfda
BuildRequires:  python3-flask-migrate
11cbfda
BuildRequires:  python3-flask-script
11cbfda
BuildRequires:  python3-frozen-flask
11cbfda
BuildRequires:  python3-jinja2 >= 2.9
11cbfda
BuildRequires:  python3-junit_xml
11cbfda
BuildRequires:  python3-lxml
11cbfda
BuildRequires:  python3-mock
11cbfda
BuildRequires:  python3-oslo-serialization
11cbfda
BuildRequires:  python3-oslo-utils
11cbfda
BuildRequires:  python3-pyfakefs
11cbfda
BuildRequires:  python3-pygments
11cbfda
BuildRequires:  python3-pytest
11cbfda
BuildRequires:  python3-sqlalchemy
11cbfda
BuildRequires:  python3-subunit
11cbfda
BuildRequires:  python3-XStatic
11cbfda
BuildRequires:  python3-XStatic-Bootstrap-SCSS
11cbfda
BuildRequires:  python3-XStatic-DataTables
11cbfda
BuildRequires:  python3-XStatic-jQuery
11cbfda
BuildRequires:  python3-XStatic-Patternfly
11cbfda
BuildRequires:  python3-XStatic-Patternfly-Bootstrap-Treeview
11cbfda
11cbfda
Requires:       ansible-python3 >= 2.1.6.0
11cbfda
Requires:       python3-cliff
11cbfda
Requires:       python3-debtcollector
11cbfda
Requires:       python3-decorator
11cbfda
Requires:       python3-flask
11cbfda
Requires:       python3-flask-migrate
11cbfda
Requires:       python3-flask-script
11cbfda
Requires:       python3-frozen-flask
11cbfda
Requires:       python3-jinja2 >= 2.9
11cbfda
Requires:       python3-junit_xml
11cbfda
Requires:       python3-oslo-serialization
11cbfda
Requires:       python3-oslo-utils
11cbfda
Requires:       python3-pyfakefs
11cbfda
Requires:       python3-pygments
11cbfda
Requires:       python3-sqlalchemy
11cbfda
Requires:       python3-subunit
11cbfda
Requires:       python3-XStatic
11cbfda
Requires:       python3-XStatic-Bootstrap-SCSS
11cbfda
Requires:       python3-XStatic-DataTables
11cbfda
Requires:       python3-XStatic-jQuery
11cbfda
Requires:       python3-XStatic-Patternfly
11cbfda
Requires:       python3-XStatic-Patternfly-Bootstrap-Treeview
11cbfda
11cbfda
%{?python_provide:%python_provide python3-%{package_name}}
11cbfda
11cbfda
%description -n python3-%{package_name}
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
11cbfda
%package -n python3-%{package_name}-tests
11cbfda
Summary:        Tests for %{package_name}
11cbfda
11cbfda
Requires:       python3-%{package_name} = %{version}-%{release}
11cbfda
Requires:       python3-lxml
11cbfda
Requires:       python3-mock
11cbfda
Requires:       python3-pytest
11cbfda
11cbfda
%description -n python3-%{package_name}-tests
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
11cbfda
This package contains the test files.
11cbfda
%endif
11cbfda
11cbfda
%package common
11cbfda
Summary:        Common files for %{package_name}
11cbfda
11cbfda
Requires(pre): shadow-utils
11cbfda
11cbfda
%description common
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
11cbfda
This package contains the common files.
11cbfda
11cbfda
%package doc
11cbfda
Summary:        Documentation for %{package_name}
11cbfda
11cbfda
BuildRequires:  python-sphinx
11cbfda
BuildRequires:  python-sphinx_rtd_theme
11cbfda
11cbfda
%description doc
11cbfda
ARA: Ansible Run Analysis
11cbfda
11cbfda
ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
11cbfda
understand and troubleshoot. It integrates with Ansible wherever you run it.
11cbfda
11cbfda
This package contains the documentation.
11cbfda
11cbfda
%prep
11cbfda
%autosetup -n %{package_name}-%{version} -S git
11cbfda
11cbfda
%if 0%{?with_python3}
11cbfda
rm -rf %{py3dir}
11cbfda
cp -a . %{py3dir}
11cbfda
%endif
11cbfda
11cbfda
# Let RPM handle the requirements
11cbfda
rm -f {,test-}requirements.txt
11cbfda
11cbfda
%build
11cbfda
%py2_build
11cbfda
%if 0%{?with_python3}
11cbfda
%py3_build
11cbfda
%endif
11cbfda
# Disable warning detection as failures: https://review.openstack.org/#/c/491202/
11cbfda
# sphinx-build -W -b html doc/source doc/build/html
11cbfda
sphinx-build -b html doc/source doc/build/html
11cbfda
11cbfda
%install
11cbfda
%if 0%{?with_python3}
11cbfda
%py3_install
11cbfda
for f in %{buildroot}%{_bindir}/ara*; do
11cbfda
    mv $f $f-%{python3_version}
11cbfda
    ln -s %{_bindir}/$(basename $f)-%{python3_version} $f-3
11cbfda
done
11cbfda
%endif
11cbfda
11cbfda
%py2_install
11cbfda
for f in %{buildroot}%{_bindir}/{ara,ara-manage,ara-wsgi}; do
11cbfda
    mv $f $f-%{python2_version}
11cbfda
    ln -s %{_bindir}/$(basename $f)-%{python2_version} $f
11cbfda
    ln -s %{_bindir}/$(basename $f)-%{python2_version} $f-2
11cbfda
done
11cbfda
11cbfda
# Setup directories
11cbfda
install -d -m 755 %{buildroot}%{_sysconfdir}/%{package_name}
11cbfda
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{package_name}
11cbfda
install -d -m 755 %{buildroot}%{_localstatedir}/log/%{package_name}
11cbfda
11cbfda
# Setup systemd unit file
11cbfda
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{package_name}-server.service
11cbfda
11cbfda
# Setup default config
11cbfda
install -p -D -m 640 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{package_name}/%{package_name}.cfg
11cbfda
11cbfda
# Setup logrotate
11cbfda
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{package_name}
11cbfda
11cbfda
%check
11cbfda
%{__python2} -m py.test -v
11cbfda
%{__python3} -m pytest -v
11cbfda
11cbfda
%pre common
11cbfda
getent group %{package_name} >/dev/null || groupadd -r %{package_name}
11cbfda
getent passwd %{package_name} >/dev/null || \
11cbfda
    useradd -r -g %{package_name} -d %{_sharedstatedir}/%{package_name} \
11cbfda
    -s /sbin/nologin -c "User for ARA" %{package_name}
11cbfda
exit 0
11cbfda
11cbfda
%post
11cbfda
%systemd_post %{package_name}-server.service
11cbfda
11cbfda
%preun
11cbfda
%systemd_preun %{package_name}-server.service
11cbfda
11cbfda
%postun
11cbfda
%systemd_postun_with_restart %{package_name}-server.service
11cbfda
11cbfda
%files
11cbfda
%doc README.rst
11cbfda
%license LICENSE
11cbfda
%{_bindir}/ara*
11cbfda
%if 0%{?with_python3}
11cbfda
%exclude %{_bindir}/ara*-3*
11cbfda
%endif
11cbfda
%{_unitdir}/%{package_name}-server.service
11cbfda
11cbfda
%if 0%{?with_python3}
11cbfda
%files -n %{package_name}-python3
11cbfda
%doc README.rst
11cbfda
%license LICENSE
11cbfda
%{_bindir}/ara*-3*
11cbfda
%{_unitdir}/%{package_name}-server.service
11cbfda
%endif
11cbfda
11cbfda
%files -n python2-%{package_name}
11cbfda
%doc README.rst
11cbfda
%license LICENSE
11cbfda
%{python2_sitelib}/%{package_name}
11cbfda
%{python2_sitelib}/%{package_name}-*.egg-info
11cbfda
%exclude %{python2_sitelib}/%{package_name}/tests
11cbfda
11cbfda
%files -n python2-%{package_name}-tests
11cbfda
%doc README.rst
11cbfda
%license LICENSE
11cbfda
%{python2_sitelib}/%{package_name}/tests
11cbfda
11cbfda
%if 0%{?with_python3}
11cbfda
%files -n python3-%{package_name}
11cbfda
%doc README.rst
11cbfda
%license LICENSE
11cbfda
%{python3_sitelib}/%{package_name}
11cbfda
%{python3_sitelib}/%{package_name}-*.egg-info
11cbfda
%exclude %{python3_sitelib}/%{package_name}/tests
11cbfda
11cbfda
%files -n python3-%{package_name}-tests
11cbfda
%doc README.rst
11cbfda
%license LICENSE
11cbfda
%{python3_sitelib}/%{package_name}/tests
11cbfda
%endif
11cbfda
11cbfda
%files common
11cbfda
%doc README.rst
11cbfda
%license LICENSE
11cbfda
%dir %{_sysconfdir}/%{package_name}
11cbfda
%config(noreplace) %attr(0640, root, %{package_name}) %{_sysconfdir}/%{package_name}/%{package_name}.cfg
11cbfda
%config(noreplace) %{_sysconfdir}/logrotate.d/%{package_name}
11cbfda
%dir %attr(0750, %{package_name}, %{package_name}) %{_localstatedir}/log/%{package_name}
11cbfda
%dir %attr(0750, %{package_name}, %{package_name}) %{_sharedstatedir}/%{package_name}
11cbfda
11cbfda
%files doc
11cbfda
%doc README.rst doc/build/html
11cbfda
%license LICENSE
11cbfda
11cbfda
%changelog
11cbfda
* Sat Aug 5 2017 David Moreau Simard <dmsimard@redhat.com> - 0.14.0-1
11cbfda
- First packaged version of ARA