omit trailing slash from ansible_collection_files

Related: rhbz#1961404
This commit is contained in:
Rich Megginson 2021-04-22 10:14:27 -06:00 committed by Noriko Hosoi
parent 1f04d44d20
commit 23c4878234

View File

@ -47,7 +47,7 @@ License: GPLv3+ and MIT and BSD
# Not used (yet). Could be made to point to AH in RHEL - but what about CentOS Stream? # 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}} #%%{!?ansible_collection_url:%%define ansible_collection_url() https://galaxy.ansible.com/%%{collection_namespace}/%%{collection_name}}
%{!?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}}
%if %{with ansible} %if %{with ansible}
BuildRequires: ansible >= 2.9.10 BuildRequires: ansible >= 2.9.10
@ -62,7 +62,7 @@ BuildRequires: ansible >= 2.9.10
%if %{without ansible} %if %{without ansible}
# Simply copy everything instead of galaxy-installing the built artifact. # Simply copy everything instead of galaxy-installing the built artifact.
%define ansible_collection_install() 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_install() 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 %else
%define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz %define ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
%endif %endif
@ -431,20 +431,20 @@ popd
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection
mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles 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 \
%{buildroot}%{ansible_collection_files}%{collection_name}/README.html \ %{buildroot}%{ansible_collection_files}/%{collection_name}/README.html \
$RPM_BUILD_ROOT%{_pkgdocdir}/collection $RPM_BUILD_ROOT%{_pkgdocdir}/collection
# no html files in collection directory # no html files in collection directory
rm -f %{buildroot}%{ansible_collection_files}%{collection_name}/README.html rm -f %{buildroot}%{ansible_collection_files}/%{collection_name}/README.html
for rolename in %{rolenames}; do 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} 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 \
%{buildroot}%{ansible_collection_files}%{collection_name}/roles/${rolename}/README.html \ %{buildroot}%{ansible_collection_files}/%{collection_name}/roles/${rolename}/README.html \
$RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${rolename} $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${rolename}
# no html files in collection directory # no html files in collection directory
rm -f %{buildroot}%{ansible_collection_files}%{collection_name}/roles/${rolename}/README.html rm -f %{buildroot}%{ansible_collection_files}/%{collection_name}/roles/${rolename}/README.html
fi fi
done done
@ -501,8 +501,8 @@ echo '%dir %{_datadir}/ansible/roles' >> $files_section
echo '%dir %{installbase}' >> $files_section echo '%dir %{installbase}' >> $files_section
%endif %endif
echo '%dir %{ansible_collection_files}' >> $files_section echo '%dir %{ansible_collection_files}' >> $files_section
echo '%dir %{ansible_collection_files}%{collection_name}' >> $files_section echo '%dir %{ansible_collection_files}/%{collection_name}' >> $files_section
find %{buildroot}%{ansible_collection_files}%{collection_name} -mindepth 1 -maxdepth 1 | \ find %{buildroot}%{ansible_collection_files}/%{collection_name} -mindepth 1 -maxdepth 1 | \
while read item; do while read item; do
if [[ "$item" == */roles ]]; then if [[ "$item" == */roles ]]; then
format_item_for_files "$item" true >> $files_section format_item_for_files "$item" true >> $files_section