diff --git a/linux-system-roles.spec b/linux-system-roles.spec index 658c7cf..4a47b3e 100644 --- a/linux-system-roles.spec +++ b/linux-system-roles.spec @@ -502,9 +502,9 @@ format_item_for_files() { else echo "%doc $files_item" fi - elif [[ "$item" == */COPYING* ]] || [[ "$item" == */LICENSE* ]]; then - echo "%%license $files_item" - else + elif [[ "$item" != */COPYING* ]] && [[ "$item" != */LICENSE* ]]; then + # Avoid dynamically using the license macro since the license macro + # is replaced with the value of License directive in the older rpmbuild. echo "$files_item" fi } @@ -575,6 +575,22 @@ fi %{_pkgdocdir}/collection/roles/*/README.html %endif %license %{_pkglicensedir}/* +%license %{installbase}/*/COPYING* +%license %{installbase}/*/LICENSE* +%license %{ansible_collection_files}/%{collection_name}/COPYING* +%license %{ansible_collection_files}/%{collection_name}/LICENSE* +%if 0%{?rhel} < 8 +# Needs to list excluded files in this hardcoded style since when +# format_item_for_files is executed, brp-python-bytecompile is not +# executed yet. +%exclude %{installbase}/*/*.py? +%exclude %{installbase}/*/*/*.py? +%exclude %{installbase}/*/*/*/*.py? +%exclude %{installbase}/*/*/*/*/*.py? +%exclude %{ansible_collection_files}/%{collection_name}/*/*/*.py? +%exclude %{ansible_collection_files}/%{collection_name}/*/*/*/*.py? +%exclude %{ansible_collection_files}/%{collection_name}/*/*/*/*/*.py? +%endif %if %{with collection_artifact} %files collection-artifact