diff --git a/linux-system-roles.spec b/linux-system-roles.spec index 2f413f9..bdce5cd 100644 --- a/linux-system-roles.spec +++ b/linux-system-roles.spec @@ -54,17 +54,11 @@ BuildRequires: ansible >= 2.9.10 %endif %if %{without ansible} -# Empty command. We don't have ansible-galaxy. -%define ansible_collection_build() tar -cf %{_tmppath}/%{collection_namespace}-%{collection_name}-%{version}.tar.gz . -%else -%define ansible_collection_build() ansible-galaxy collection build -%endif - -%if %{without ansible} +# We don't have ansible-galaxy. # 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_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_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz +%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 # For each role, call either defcommit() or deftag(). The other macros @@ -342,13 +336,6 @@ sed -i -e 's/^\(## Table of Contents\)/## Background\n\1/' \ sed -i -e '/^## Table of Contents/,/^## Background/d' \ .collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/logging/README.md -# converting README.md to README.html for collection -readmes=".collections/ansible_collections/%{collection_namespace}/%{collection_name}/README.md" -for role in %{rolenames}; do - readmes="${readmes} .collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/$role/README.md" -done -sh md2html.sh $readmes - # Remove internal links from readme files # They are not rendered properly on AH. for role in %{rolenames}; do @@ -356,10 +343,6 @@ for role in %{rolenames}; do .collections/ansible_collections/%{collection_namespace}/%{collection_name}/roles/$role/README.md done -pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ -%ansible_collection_build -popd - %install mkdir -p $RPM_BUILD_ROOT%{installbase} mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/roles @@ -424,29 +407,30 @@ rm $RPM_BUILD_ROOT%{installbase}/%{roleinstprefix}*/tests/.git* # must be updated if changing the file path pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/ -%ansible_collection_install +%ansible_collection_build_install 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 \ - %{buildroot}%{ansible_collection_files}/%{collection_name}/README.html \ $RPM_BUILD_ROOT%{_pkgdocdir}/collection -# no html files in collection directory -rm -f %{buildroot}%{ansible_collection_files}/%{collection_name}/README.html for rolename in %{rolenames}; do 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 \ - %{buildroot}%{ansible_collection_files}/%{collection_name}/roles/${rolename}/README.html \ $RPM_BUILD_ROOT%{_pkgdocdir}/collection/roles/${rolename} - # no html files in collection directory - rm -f %{buildroot}%{ansible_collection_files}/%{collection_name}/roles/${rolename}/README.html fi done +# 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 + %if %{with collection_artifact} # Copy collection artifact to /usr/share/ansible/collections/ for collection-artifact pushd .collections/ansible_collections/%{collection_namespace}/%{collection_name}/