Blame ara.spec

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