Make the use of slashes in ansible_collection_files consistent
Resolves: rhbz#1978731 Make the ansible_collection_files macro defined in Fedora automatically and in RHEL manually consistent - having slash at the end to clean double-slashes from the code. (cherry picked from commit f04c75a2c87a901d9e2b090010744234422e9336)
This commit is contained in:
parent
bca54c544b
commit
26408b8e57
@ -22,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.3
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
|
||||
#Group: Development/Libraries
|
||||
License: GPLv3+ and MIT and BSD
|
||||
@ -56,11 +56,11 @@ License: GPLv3+ and MIT and BSD
|
||||
#%%{!?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}}
|
||||
%{!?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}
|
||||
%define ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/
|
||||
%endif
|
||||
%endif
|
||||
|
||||
@ -72,7 +72,7 @@ BuildRequires: ansible >= 2.9.10
|
||||
%if %{without ansible}
|
||||
# We don't have ansible-galaxy.
|
||||
# Simply copy everything instead of galaxy-installing the built artifact.
|
||||
%define ansible_collection_build_install() tar -cf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz .; mkdir -p %{buildroot}%{ansible_collection_files}/%{collection_name}; (cd %{buildroot}%{ansible_collection_files}/%{collection_name}; tar -xf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz)
|
||||
%define ansible_collection_build_install() tar -cf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz .; mkdir -p %{buildroot}%{ansible_collection_files}%{collection_name}; (cd %{buildroot}%{ansible_collection_files}%{collection_name}; tar -xf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz)
|
||||
%else
|
||||
%define ansible_collection_build_install() ansible-galaxy collection build; ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
|
||||
%endif
|
||||
@ -447,13 +447,13 @@ popd
|
||||
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection
|
||||
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles
|
||||
|
||||
cp -p %{buildroot}%{ansible_collection_files}/%{collection_name}/README.md \
|
||||
cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/README.md \
|
||||
$RPM_BUILD_ROOT%{_pkgdocdir}/collection
|
||||
|
||||
for rolename in %{rolenames}; do
|
||||
if [ -f %{buildroot}%{ansible_collection_files}/%{collection_name}/roles/${rolename}/README.md ]; then
|
||||
if [ -f %{buildroot}%{ansible_collection_files}%{collection_name}/roles/${rolename}/README.md ]; then
|
||||
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${rolename}
|
||||
cp -p %{buildroot}%{ansible_collection_files}/%{collection_name}/roles/${rolename}/README.md \
|
||||
cp -p %{buildroot}%{ansible_collection_files}%{collection_name}/roles/${rolename}/README.md \
|
||||
$RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${rolename}
|
||||
fi
|
||||
done
|
||||
@ -520,8 +520,8 @@ echo '%dir %{_datadir}/ansible/roles' >> $files_section
|
||||
echo '%dir %{installbase}' >> $files_section
|
||||
%endif
|
||||
echo '%dir %{ansible_collection_files}' >> $files_section
|
||||
echo '%dir %{ansible_collection_files}/%{collection_name}' >> $files_section
|
||||
find %{buildroot}%{ansible_collection_files}/%{collection_name} -mindepth 1 -maxdepth 1 | \
|
||||
echo '%dir %{ansible_collection_files}%{collection_name}' >> $files_section
|
||||
find %{buildroot}%{ansible_collection_files}%{collection_name} -mindepth 1 -maxdepth 1 | \
|
||||
while read item; do
|
||||
if [[ "$item" == */roles ]]; then
|
||||
format_item_for_files "$item" true >> $files_section
|
||||
@ -598,6 +598,10 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jun 17 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.2.3-3
|
||||
- Make the ansible_collection_files macro defined in Fedora automatically and
|
||||
in RHEL manually consistent - having slash at the end to clean double-slashes
|
||||
|
||||
* Wed Jun 16 2021 Sergei Petrosian <spetrosi@redhat.com> - 1.2.3-2
|
||||
- Remove slash (/) from the end of URLs to improve code readability
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user