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