Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif
%global package_name ara

Name:           %{package_name}
Version:        0.14.6
Release:        2%{?dist}
Summary:        ARA: Ansible Analysis - Record and visualize Ansible Playbook runs

License:        GPLv3
URL:            https://git.openstack.org/cgit/openstack/ara
Source0:        https://pypi.io/packages/source/a/%{package_name}/%{package_name}-%{version}.tar.gz
Source1:        ara-server.service
Source2:        ara.cfg
Source3:        ara.logrotate
BuildArch:      noarch

%{?systemd_requires}
BuildRequires:  systemd
BuildRequires:  git

Requires:       python2-%{package_name} = %{version}-%{release}
Requires:       %{package_name}-common = %{version}-%{release}

%description
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.

%if 0%{?with_python3}
%package -n %{package_name}-python3
Summary:        %{summary}

Requires:       python3-%{package_name} = %{version}-%{release}
Requires:       %{package_name}-common = %{version}-%{release}

%description -n %{package_name}-python3
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.
%endif

%package -n python2-%{package_name}
Summary:        %{summary}

BuildRequires:  python2-devel
BuildRequires:  python2-pbr
BuildRequires:  python2-setuptools
# Test dependencies for check macro
BuildRequires:  ansible >= 2.2.0.0
BuildRequires:  python2-debtcollector
BuildRequires:  python2-decorator
BuildRequires:  python2-flask >= 0.11
BuildRequires:  python2-flask-migrate
BuildRequires:  python2-jinja2 >= 2.9
BuildRequires:  python2-junit_xml
BuildRequires:  python2-lxml
BuildRequires:  python2-oslo-serialization
BuildRequires:  python2-oslo-utils
BuildRequires:  python2-mock
BuildRequires:  python2-pyfakefs
BuildRequires:  python2-pygments >= 1.6
BuildRequires:  python2-pytest
BuildRequires:  python2-sqlalchemy
BuildRequires:  python2-subunit
BuildRequires:  python2-XStatic
BuildRequires:  python2-XStatic-Bootstrap-SCSS
BuildRequires:  python2-XStatic-DataTables
BuildRequires:  python2-XStatic-jQuery
BuildRequires:  python2-XStatic-Patternfly
BuildRequires:  python2-XStatic-Patternfly-Bootstrap-Treeview
BuildRequires:  python-cliff
BuildRequires:  python-flask-script
BuildRequires:  python-frozen-flask

Requires:       ansible >= 2.2.2.0
Requires:       python2-debtcollector
Requires:       python2-decorator
Requires:       python2-flask >= 0.11
Requires:       python2-flask-migrate
Requires:       python2-jinja2 >= 2.9
Requires:       python2-junit_xml
Requires:       python2-oslo-serialization
Requires:       python2-oslo-utils
Requires:       python2-pyfakefs
Requires:       python2-pygments >= 1.6
Requires:       python2-sqlalchemy
Requires:       python2-subunit
Requires:       python2-XStatic
Requires:       python2-XStatic-Bootstrap-SCSS
Requires:       python2-XStatic-DataTables
Requires:       python2-XStatic-jQuery
Requires:       python2-XStatic-Patternfly
Requires:       python2-XStatic-Patternfly-Bootstrap-Treeview
Requires:       python-cliff
Requires:       python-flask-script
Requires:       python-frozen-flask

%{?python_provide:%python_provide python2-%{package_name}}

%description -n python2-%{package_name}
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.

%package -n python2-%{package_name}-tests
Summary:        Tests for %{package_name}

Requires:       python2-%{package_name} = %{version}-%{release}
Requires:       python2-lxml
Requires:       python2-mock
Requires:       python2-pytest

%description -n python2-%{package_name}-tests
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.

This package contains the test files.

%if 0%{?with_python3}
%package -n python3-%{package_name}
Summary:        %{summary}

BuildRequires:  python3-devel
BuildRequires:  python3-pbr
BuildRequires:  python3-setuptools
# Test dependencies for check macro
BuildRequires:  ansible-python3 >= 2.1.6.0
BuildRequires:  python3-cliff
BuildRequires:  python3-debtcollector
BuildRequires:  python3-decorator
BuildRequires:  python3-flask >= 0.11
BuildRequires:  python3-flask-migrate
BuildRequires:  python3-flask-script
BuildRequires:  python3-frozen-flask
BuildRequires:  python3-jinja2 >= 2.9
BuildRequires:  python3-junit_xml
BuildRequires:  python3-lxml
BuildRequires:  python3-mock
BuildRequires:  python3-oslo-serialization
BuildRequires:  python3-oslo-utils
BuildRequires:  python3-pyfakefs
BuildRequires:  python3-pygments >= 1.6
BuildRequires:  python3-pytest
BuildRequires:  python3-sqlalchemy
BuildRequires:  python3-subunit
BuildRequires:  python3-XStatic
BuildRequires:  python3-XStatic-Bootstrap-SCSS
BuildRequires:  python3-XStatic-DataTables
BuildRequires:  python3-XStatic-jQuery
BuildRequires:  python3-XStatic-Patternfly
BuildRequires:  python3-XStatic-Patternfly-Bootstrap-Treeview

Requires:       ansible-python3 >= 2.1.6.0
Requires:       python3-cliff
Requires:       python3-debtcollector
Requires:       python3-decorator
Requires:       python3-flask >= 0.11
Requires:       python3-flask-migrate
Requires:       python3-flask-script
Requires:       python3-frozen-flask
Requires:       python3-jinja2 >= 2.9
Requires:       python3-junit_xml
Requires:       python3-oslo-serialization
Requires:       python3-oslo-utils
Requires:       python3-pyfakefs
Requires:       python3-pygments >= 1.6
Requires:       python3-sqlalchemy
Requires:       python3-subunit
Requires:       python3-XStatic
Requires:       python3-XStatic-Bootstrap-SCSS
Requires:       python3-XStatic-DataTables
Requires:       python3-XStatic-jQuery
Requires:       python3-XStatic-Patternfly
Requires:       python3-XStatic-Patternfly-Bootstrap-Treeview

%{?python_provide:%python_provide python3-%{package_name}}

%description -n python3-%{package_name}
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.

%package -n python3-%{package_name}-tests
Summary:        Tests for %{package_name}

Requires:       python3-%{package_name} = %{version}-%{release}
Requires:       python3-lxml
Requires:       python3-mock
Requires:       python3-pytest

%description -n python3-%{package_name}-tests
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.

This package contains the test files.
%endif

%package common
Summary:        Common files for %{package_name}

Requires(pre): shadow-utils

%description common
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.

This package contains the common files.

%package doc
Summary:        Documentation for %{package_name}

BuildRequires:  python2-sphinx
BuildRequires:  python2-sphinx_rtd_theme

%description doc
ARA: Ansible Run Analysis

ARA records Ansible Playbook runs seamlessly to make them easier to visualize,
understand and troubleshoot. It integrates with Ansible wherever you run it.

This package contains the documentation.

%prep
%autosetup -n %{package_name}-%{version} -S git

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

# Let RPM handle the requirements
rm -f {,test-}requirements.txt

%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif
# Disable warning detection as failures: https://review.openstack.org/#/c/491202/
# sphinx-build -W -b html doc/source doc/build/html
sphinx-build -b html doc/source doc/build/html

%install
%if 0%{?with_python3}
%py3_install
for f in %{buildroot}%{_bindir}/ara*; do
    mv $f $f-%{python3_version}
    ln -s %{_bindir}/$(basename $f)-%{python3_version} $f-3
done
%endif

%py2_install
for f in %{buildroot}%{_bindir}/{ara,ara-manage,ara-wsgi}; do
    mv $f $f-%{python2_version}
    ln -s %{_bindir}/$(basename $f)-%{python2_version} $f
    ln -s %{_bindir}/$(basename $f)-%{python2_version} $f-2
done

# Setup directories
install -d -m 755 %{buildroot}%{_sysconfdir}/%{package_name}
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{package_name}
install -d -m 755 %{buildroot}%{_localstatedir}/log/%{package_name}

# Setup systemd unit file
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{package_name}-server.service

# Setup default config
install -p -D -m 640 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{package_name}/%{package_name}.cfg

# Setup logrotate
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{package_name}

%check
%{__python2} -m py.test -v
%{__python3} -m pytest -v

%pre common
getent group %{package_name} >/dev/null || groupadd -r %{package_name}
getent passwd %{package_name} >/dev/null || \
    useradd -r -g %{package_name} -d %{_sharedstatedir}/%{package_name} \
    -s /sbin/nologin -c "User for ARA" %{package_name}
exit 0

%post
%systemd_post %{package_name}-server.service

%preun
%systemd_preun %{package_name}-server.service

%postun
%systemd_postun_with_restart %{package_name}-server.service

%files
%doc README.rst
%license LICENSE
%{_bindir}/ara*
%if 0%{?with_python3}
%exclude %{_bindir}/ara*-3*
%endif
%{_unitdir}/%{package_name}-server.service

%if 0%{?with_python3}
%files -n %{package_name}-python3
%doc README.rst
%license LICENSE
%{_bindir}/ara*-3*
%{_unitdir}/%{package_name}-server.service
%endif

%files -n python2-%{package_name}
%doc README.rst
%license LICENSE
%{python2_sitelib}/%{package_name}
%{python2_sitelib}/%{package_name}-*.egg-info
%exclude %{python2_sitelib}/%{package_name}/tests

%files -n python2-%{package_name}-tests
%doc README.rst
%license LICENSE
%{python2_sitelib}/%{package_name}/tests

%if 0%{?with_python3}
%files -n python3-%{package_name}
%doc README.rst
%license LICENSE
%{python3_sitelib}/%{package_name}
%{python3_sitelib}/%{package_name}-*.egg-info
%exclude %{python3_sitelib}/%{package_name}/tests

%files -n python3-%{package_name}-tests
%doc README.rst
%license LICENSE
%{python3_sitelib}/%{package_name}/tests
%endif

%files common
%doc README.rst
%license LICENSE
%dir %{_sysconfdir}/%{package_name}
%config(noreplace) %attr(0640, root, %{package_name}) %{_sysconfdir}/%{package_name}/%{package_name}.cfg
%config(noreplace) %{_sysconfdir}/logrotate.d/%{package_name}
%dir %attr(0750, %{package_name}, %{package_name}) %{_localstatedir}/log/%{package_name}
%dir %attr(0750, %{package_name}, %{package_name}) %{_sharedstatedir}/%{package_name}

%files doc
%doc README.rst doc/build/html
%license LICENSE

%changelog
* Tue Jun 19 2018 Miro HronĨok <mhroncok@redhat.com> - 0.14.6-2
- Rebuilt for Python 3.7

* Sat Feb 24 2018 David Moreau Simard <dmsimard@redhat.com> - 0.14.6-1
- Update to upstream 0.14.6

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.14.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sat Aug 5 2017 David Moreau Simard <dmsimard@redhat.com> - 0.14.0-1
- First packaged version of ARA