Make spec file available for older versions of OSes. (1970165)

Drop python3-six dependency which was used by lsr_role2collection.py.
Drop html files from rpm if the version has no markdown parser.
Drop unnecessary python scripts which include python3 only code, e.g.,
  f-strings.

  Resolves: rhbz#1961404
This commit is contained in:
Noriko Hosoi 2021-06-10 14:05:56 -07:00
parent a1ccf36593
commit 533ad2c992
3 changed files with 56 additions and 6 deletions

1
.gitignore vendored
View File

@ -88,3 +88,4 @@
/logging-5bb2a62d4432c12748ceb8cdfcf6c499151d288f.tar.gz
/logging-20dd3e5520ca06dcccaa9b3f1fb428d055e0c23f.tar.gz
/kdump-02fc72b482e165472624b2f68eecd2ddce1d93b1.tar.gz
/auto-maintenance-5e5cb71ec2b9def68d91cc9516b2611b29abafa1.tar.gz

View File

@ -6,6 +6,14 @@
%bcond_with collection_artifact
%if 0%{?fedora} || 0%{?rhel} >= 8
%bcond_without html
%else
# pandoc is not supported in rhel 7 and older,
# which is needed for converting .md to .html.
%bcond_with html
%endif
%if 0%{?rhel}
Name: rhel-system-roles
%else
@ -14,7 +22,7 @@ Name: linux-system-roles
Url: https://github.com/linux-system-roles/
Summary: Set of interfaces for unified system management
Version: 1.2.2
Release: 1%{?dist}
Release: 2%{?dist}
#Group: Development/Libraries
License: GPLv3+ and MIT and BSD
@ -47,7 +55,15 @@ License: GPLv3+ and MIT and BSD
# Not used (yet). Could be made to point to AH in RHEL - but what about CentOS Stream?
#%%{!?ansible_collection_url:%%define ansible_collection_url() https://galaxy.ansible.com/%%{collection_namespace}/%%{collection_name}}
%if 0%{?fedora} || 0%{?rhel} >= 8
%{!?ansible_collection_files:%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}}
%else
# Define undefined macro using "!?ansible_collection_files:..." does not work for rhel-7
%if %{?ansible_collection_files:0}%{!?ansible_collection_files:1}
%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}
%endif
%endif
%if %{with ansible}
BuildRequires: ansible >= 2.9.10
@ -160,7 +176,7 @@ BuildRequires: ansible >= 2.9.10
%defcommit 18 5f6cb73e6753fbdbb219b7d3079f0378b2d3bdb3
%global rolename18 vpn
%global mainid 17baba973c8c77b32ae65838a98dc4fbaf7b7b3e
%global mainid 5e5cb71ec2b9def68d91cc9516b2611b29abafa1
Source: %{url}auto-maintenance/archive/%{mainid}/auto-maintenance-%{mainid}.tar.gz
Source1: %{archiveurl1}
Source2: %{archiveurl2}
@ -190,6 +206,7 @@ Patch52: network-disable-bondtests.diff
BuildArch: noarch
%if %{with html}
# Requirements for md2html.sh to build the documentation
%if 0%{?fedora} || 0%{?rhel} >= 9
BuildRequires: rubygem-kramdown-parser-gfm
@ -198,14 +215,21 @@ BuildRequires: pandoc
BuildRequires: asciidoc
BuildRequires: highlight
%endif
%endif
# Requirements for galaxy_transform.py
BuildRequires: python3
BuildRequires: python3-six
%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: python3dist(ruamel.yaml)
Requires: python3-jmespath
Requires: python3-netaddr
%else
BuildRequires: python3-ruamel-yaml
Requires: python-jmespath
Requires: python-netaddr
%endif
Obsoletes: rhel-system-roles-techpreview < 1.0-3
@ -274,17 +298,24 @@ done
rm %{rolename5}/tests/modules
rm %{rolename5}/tests/module_utils
rm %{rolename5}/tests/playbooks/roles
# Drop network/{scripts/print_all_options.py,tests/ensure_provider_tests.py}
# from rpm. These 2 files fail in brp-python-bytecompile due to f-strings
# when python2 is default python.
rm %{rolename5}/scripts/print_all_options.py
rm %{rolename5}/tests/ensure_provider_tests.py
# transform ambiguous #!/usr/bin/env python shebangs to python3 to stop brp-mangle-shebangs complaining
find -type f -executable -name '*.py' -exec \
sed -i -r -e '1s@^(#! */usr/bin/env python)(\s|$)@#\13\2@' '{}' +
%build
%if %{with html}
readmes=""
for role in %{rolenames}; do
readmes="${readmes} $role/README.md"
done
sh md2html.sh $readmes
%endif
mkdir .collections
%if 0%{?rhel}
@ -362,8 +393,11 @@ rm $RPM_BUILD_ROOT%{installbase}/%{roleinstprefix}network/examples/roles
for role in %{rolenames}; do
mkdir -p "$RPM_BUILD_ROOT%{_pkgdocdir}/$role"
cp -p "$RPM_BUILD_ROOT%{installbase}/%{roleinstprefix}$role/README.md" \
"$RPM_BUILD_ROOT%{installbase}/%{roleinstprefix}$role/README.html" \
"$RPM_BUILD_ROOT%{_pkgdocdir}/$role"
%if %{with html}
cp -p "$RPM_BUILD_ROOT%{installbase}/%{roleinstprefix}$role/README.html" \
"$RPM_BUILD_ROOT%{_pkgdocdir}/$role"
%endif
if [ -f "$RPM_BUILD_ROOT%{installbase}/%{roleinstprefix}$role/COPYING" ]; then
cp -p "$RPM_BUILD_ROOT%{installbase}/%{roleinstprefix}$role/COPYING" \
"$RPM_BUILD_ROOT%{_pkglicensedir}/$role.COPYING"
@ -424,12 +458,14 @@ for rolename in %{rolenames}; do
fi
done
%if %{with html}
# converting README.md to README.html for collection in $RPM_BUILD_ROOT%{_pkgdocdir}/collection
readmes="$RPM_BUILD_ROOT%{_pkgdocdir}/collection/README.md"
for role in %{rolenames}; do
readmes="${readmes} $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${role}/README.md"
done
sh md2html.sh $readmes
%endif
%if %{with collection_artifact}
# Copy collection artifact to /usr/share/ansible/collections/ for collection-artifact
@ -530,10 +566,14 @@ fi
%files -f files_section.txt
%{_pkgdocdir}/*/README.md
%if %{with html}
%{_pkgdocdir}/*/README.html
%endif
%{_pkgdocdir}/*/example-*
%{_pkgdocdir}/collection/roles/*/README.md
%if %{with html}
%{_pkgdocdir}/collection/roles/*/README.html
%endif
%license %{_pkglicensedir}/*
%if %{with collection_artifact}
@ -542,6 +582,15 @@ fi
%endif
%changelog
* Fri Jun 11 2021 Noriko Hosoi <nhosoi@redhat.com> - 1.2.2-2
- Make spec file available for older versions of OSes.
- Drop python3-six dependency which was used by lsr_role2collection.py.
- Drop html files from rpm if the version has no markdown parser.
- Drop unnecessary python scripts which include python3 only code, e.g.,
f-strings.
Resolves rhbz#1970165
* Wed Jun 9 2021 Rich Megginson <rmeggins@redhat.com> - 1.2.2-1
- fix kdump tests_ssh for basic smoke test
Resolves rhbz#1957876
@ -552,7 +601,7 @@ fi
- fix broken internal links in README.md files
Resolves rhbz#1962976
* Mon May 21 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.2.0-2
* Fri May 21 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.2.0-2
- Add BuildRequires: rubygem-kramdown for Fedora and RHEL >= 9
* Fri May 14 2021 Rich Megginson <rmeggins@redhat.com> - 1.2.0-1

View File

@ -1,4 +1,4 @@
SHA512 (auto-maintenance-17baba973c8c77b32ae65838a98dc4fbaf7b7b3e.tar.gz) = 769fd93b42f97c54cc9435aaa62a2b2d21882315593bc0fc4e38d5c667a7ff952d93b59e93dd35035ce41be19729c98eb07419718f52e651a8a9be313311f816
SHA512 (auto-maintenance-5e5cb71ec2b9def68d91cc9516b2611b29abafa1.tar.gz) = 3afcee9d80d6b71bd3c51951e4bfe7b6fdfbca54aef7087338bb11697af9688df801ae4210c5fe9e1bfb445962cad4e84bef48951f45603f08b2c94581628c1d
SHA512 (ansible-sshd-32f9d0dda5a801cbefad09214ec2d88b6838b943.tar.gz) = 2191a78e59dd55b976dec3c017115ce8f618a01b9b8cce3c9373862e6ce087ca2ab411e9bf4d0466d7ee52d2d68954bb48736acc931fcf68f046af2995e43f3c
SHA512 (certificate-310fc53db04e8d3134524afb7a89b0477a2ffb83.tar.gz) = 01ace6d936859422957b8685f035eaefc64874add266fe062eb862cc57a9f0f5c218937a31d95fa57b22d3ceb610d45e103bb1b684ea337808a6dca374b7bf3e
SHA512 (crypto_policies-b2a9857ac661fa32e66666e444b73bfdb34cdf95.tar.gz) = 59471ed5df2d6f5933f087e08ceab7535a02d1830d0ae240d5261dd5c8819f4d7c6c376ed1308704af380a032678068532ea7cdcaa65e596971fdd7575312d8f