Notification time stamped 2022-09-30 21:08:12 UTC
From deee147c9518bb49974d96436ca11ce60345be17 Mon Sep 17 00:00:00 2001
From: Maxwell G <gotmax(a)e.email>
Date: Sep 26 2022 04:07:26 +0000
Subject: Refactor %ansible_collection_install
This change removes %ansible_collection_install's dependence on the
%collection_namespace and %collection_name macros. Now, the macro uses
the new helper script which extracts this information from galaxy.yml.
Parsing the galaxy.yml instead of using %{version} to determine the
collection version also lends another benefit: it allows us to package
pre-releases. Previously, discrepancies between %{version} and the
upstream version (eg. "3.0.0~rc1" vs "3.0.0-rc1") broke the macro.
---
diff --git a/macros.ansible b/macros.ansible
index 5e2bc06..856688e 100644
--- a/macros.ansible
+++ b/macros.ansible
@@ -1,9 +1,18 @@
+# Stores ephemeral data that's created by %%ansible_collection_install
+# and used by other macros.
+%__ansible_builddir %{_builddir}/%{?buildsubdir:%{buildsubdir}/}.ansible-packaging
+
%ansible_roles_dir %{_datadir}/ansible/roles
%ansible_collections_dir %{_datadir}/ansible/collections/ansible_collections
%ansible_collection_build() ansible-galaxy collection build
-%ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
+%ansible_collection_install() %{shrink:
+%{_rpmconfigdir}/ansible_collection.py install
+--collections-dir %{buildroot}%{ansible_collections_dir}
+--filelist %{ansible_collection_filelist}
+}
+
%ansible_test_unit() %{expand:\\\
mkdir -p ../ansible_collections/%{collection_namespace}
https://src.fedoraproject.org/rpms/ansible-packaging/c/deee147c9518bb49974d…
Notification time stamped 2022-09-30 21:08:12 UTC
From b1de39d9c64cabf7c40c29d445e135b0e41a3f0b Mon Sep 17 00:00:00 2001
From: Maxwell G <gotmax(a)e.email>
Date: Sep 26 2022 04:07:27 +0000
Subject: Add new %ansible_collection_filelist macro
%ansible_collection_files cannot be adapted to dynamically determine the
collection namespace. We need to use a file list for that.
%ansible_collection_install writes out a file list to
%ansible_collection_filelist. Packagers would pass
`%{ansible_collection_filelist}` to `%files -f`.
Eventually, I'd like to deprecate %ansible_collection_files. That won't
happen until the new approach has gotten more testing and adoption.
---
diff --git a/macros.ansible b/macros.ansible
index 0c81432..57c89fe 100644
--- a/macros.ansible
+++ b/macros.ansible
@@ -18,5 +18,11 @@
--python-interpreter %{__python3} --local %{?*}
}
+# TODO: Officially deprecate this macro and add the following line to the macro
+# def after the new approach has gotten more testing and adoption:
+# %%{warn: %%{ansible_collection_files} is deprecated. Use %%files -f %%{ansible_collection_filelist} instead.}
+%ansible_collection_files %{shrink:
+%{ansible_collections_dir}/%{collection_namespace}/
+}
-%ansible_collection_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/
+%ansible_collection_filelist %{__ansible_builddir}/ansible_collection_files
https://src.fedoraproject.org/rpms/ansible-packaging/c/b1de39d9c64cabf7c40c…
Notification time stamped 2022-09-30 21:08:12 UTC
From 2f4f3dbe16c97231a99c1f0b7305846609058c93 Mon Sep 17 00:00:00 2001
From: Maxwell G <gotmax(a)e.email>
Date: Sep 23 2022 23:00:58 +0000
Subject: Add %ansible_roles_dir and %ansible_collections_dir
We expect collections to use %ansible_collection_install and
%ansible_collection_file{s,list}. I'm mainly defining
%ansible_collection_dir for use in our macros.
There are a couple packaged roles in Fedora that can use
%ansible_roles_dir. This can also be used if we decide to implement
macros for packaging roles.
---
diff --git a/macros.ansible b/macros.ansible
index abab21d..5e2bc06 100644
--- a/macros.ansible
+++ b/macros.ansible
@@ -1,3 +1,6 @@
+%ansible_roles_dir %{_datadir}/ansible/roles
+%ansible_collections_dir %{_datadir}/ansible/collections/ansible_collections
+
%ansible_collection_build() ansible-galaxy collection build
%ansible_collection_install() ansible-galaxy collection install -n -p %{buildroot}%{_datadir}/ansible/collections %{collection_namespace}-%{collection_name}-%{version}.tar.gz
https://src.fedoraproject.org/rpms/ansible-packaging/c/2f4f3dbe16c97231a99c…