Blob Blame History Raw
%global package_name ara

%global common_desc \
ARA Records Ansible playbook runs and makes the recorded data available and \
intuitive for users and systems.

Name:           %{package_name}
Version:        0.16.1
Release:        4%{?dist}
Summary:        ARA Records Ansible playbook runs

License:        GPLv3
Source1:        ara-server.service
Source2:        ara.cfg
Source3:        logging-config.yaml
Source4:        ara.logrotate
BuildArch:      noarch

BuildRequires:  systemd
BuildRequires:  git

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


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

BuildRequires:  python3-devel
BuildRequires:  python3-pbr
BuildRequires:  python3-setuptools
# Test dependencies for check macro
BuildRequires:  ansible >=
BuildRequires:  python3-cliff
BuildRequires:  python3-flask >= 0.12.4
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-six
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 >=
Requires:       python3-cliff
Requires:       python3-flask >= 0.12.4
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-six
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}

%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

This package contains the test files.

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

Requires(pre): shadow-utils

%description common

This package contains the common files.

%package doc
Summary:        Documentation for %{package_name}

BuildRequires:  python3-sphinx
BuildRequires:  python3-sphinx_rtd_theme

%description doc

This package contains the documentation.

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

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

# Disable warning detection as failures:
# sphinx-build -W -b html doc/source doc/build/html
sphinx-build -b html doc/source doc/build/html


# 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
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/%{package_name}/logging-config.yaml

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

# Run unit tests
%{__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

%systemd_post %{package_name}-server.service

%systemd_preun %{package_name}-server.service

%systemd_postun_with_restart %{package_name}-server.service

%doc README.rst
%license LICENSE

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

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

%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) %attr(0644, root, %{package_name}) %{_sysconfdir}/%{package_name}/logging-config.yaml
%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

* Wed Jul 24 2019 Fedora Release Engineering <> - 0.16.1-4
- Rebuilt for

* Thu Jan 31 2019 Fedora Release Engineering <> - 0.16.1-3
- Rebuilt for

* Mon Sep 10 2018 David Moreau Simard <> - 0.16.1
- Update to latest upstream release
- Default to python3

* Thu Jul 12 2018 Fedora Release Engineering <> - 0.14.6-3
- Rebuilt for

* Tue Jun 19 2018 Miro HronĨok <> - 0.14.6-2
- Rebuilt for Python 3.7

* Sat Feb 24 2018 David Moreau Simard <> - 0.14.6-1
- Update to upstream 0.14.6

* Wed Feb 07 2018 Fedora Release Engineering <> - 0.14.0-2
- Rebuilt for

* Sat Aug 5 2017 David Moreau Simard <> - 0.14.0-1
- First packaged version of ARA