From 6abbb85a5464acf99277622689f0da0e89983080 Mon Sep 17 00:00:00 2001 From: Neal Gompa Date: Thu, 13 Jan 2022 20:28:59 -0500 Subject: [PATCH] Split out packaging macros and generators to ansible-packaging --- ansible-core.spec | 20 ++++++++------------ ansible-generator | 46 ---------------------------------------------- ansible.attr | 3 --- macros.ansible | 7 ------- 4 files changed, 8 insertions(+), 68 deletions(-) delete mode 100755 ansible-generator delete mode 100644 ansible.attr delete mode 100644 macros.ansible diff --git a/ansible-core.spec b/ansible-core.spec index 43e78ca..4a52dc3 100644 --- a/ansible-core.spec +++ b/ansible-core.spec @@ -15,17 +15,18 @@ Name: ansible-core Summary: A radically simple IT automation system Version: 2.12.1 -Release: 2%{?betaver}%{?dist} +Release: 3%{?betaver}%{?dist} License: GPLv3+ Source0: %pypi_source ansible-core %{version}%{?betaver} -Source1: ansible.attr -Source2: ansible-generator -Source3: macros.ansible Url: http://ansible.com BuildArch: noarch +# Require packaging macros if rpm-build exists +# This makes the transition seamless for other packages +Requires: (ansible-packaging if rpm-build) + #Provides: ansible = %%{version}-%%{release} #Obsoletes: ansible <= 2.9.99 # For now conflict with the ansible 'classic' package. @@ -135,7 +136,6 @@ This package installs extensive documentation for ansible-core %prep %autosetup -p1 -n %{name}-%{version}%{?betaver} -cp -a %{S:1} %{S:2} %{S:3} . %build @@ -198,10 +198,6 @@ cp examples/ansible.cfg %{buildroot}/etc/ansible/ mkdir -p %{buildroot}/%{_mandir}/man1 cp -v docs/man/man1/*.1 %{buildroot}/%{_mandir}/man1/ -install -Dpm0644 -t %{buildroot}%{_fileattrsdir} ansible.attr -install -Dpm0644 -t %{buildroot}%{_rpmmacrodir} macros.ansible -install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} ansible-generator - # no need to ship zero length files find %{buildroot}/%{python3_sitelib} -name .git_keep -exec rm -f {} \; find %{buildroot}/%{python3_sitelib} -name .travis.yml -exec rm -f {} \; @@ -232,9 +228,6 @@ make PYTHON=/usr/bin/python3 tests-py3 %{python3_sitelib}/ansible %{python3_sitelib}/ansible_test %{python3_sitelib}/*egg-info -%{_fileattrsdir}/ansible.attr -%{_rpmmacrodir}/macros.ansible -%{_rpmconfigdir}/ansible-generator %files -n ansible-core-doc %doc docs/docsite/rst @@ -243,6 +236,9 @@ make PYTHON=/usr/bin/python3 tests-py3 %endif %changelog +* Thu Jan 13 2022 Neal Gompa - 2.12.1-3 +- Split out packaging macros and generators to ansible-packaging + * Wed Dec 08 2021 Kevin Fenzi - 2.12.1-2 - Re-enable tests diff --git a/ansible-generator b/ansible-generator deleted file mode 100755 index b1470e2..0000000 --- a/ansible-generator +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/python3 - -import argparse -import json -import re -import sys - - -def main(): - parser = argparse.ArgumentParser() - group = parser.add_mutually_exclusive_group(required=True) - group.add_argument( - "-P", "--provides", action="store_const", const="provides", dest="action" - ) - group.add_argument( - "-R", "--requires", action="store_const", const="requires", dest="action" - ) - args = parser.parse_args() - - files = sys.stdin.read().splitlines() - - for f in files: - with open(f, "r") as fobj: - info = json.load(fobj)["collection_info"] - if args.action == "provides": - print( - f"ansible-collection({info['namespace']}.{info['name']}) = {info['version']}" - ) - if args.action == "requires": - print("(ansible >= 2.9.0 or ansible-core >= 2.11.0)") - for dep, req in info.get("dependencies", {}).items(): - print(f"ansible-collection({dep})", end="") - if req == "*": - print() - continue - m = re.match(r"^>=(\d+\.\d+\.\d+)$", req) - if m: - print(f" >= {m.group(1)}") - continue - raise NotImplementedError( - "Generation of dependencies different than '*' or '>=' is not supported yet" - ) - - -if __name__ == "__main__": - main() diff --git a/ansible.attr b/ansible.attr deleted file mode 100644 index 997dafa..0000000 --- a/ansible.attr +++ /dev/null @@ -1,3 +0,0 @@ -%__ansible_provides %{_rpmconfigdir}/ansible-generator --provides -%__ansible_requires %{_rpmconfigdir}/ansible-generator --requires -%__ansible_path ^%{_datadir}/ansible/collections/ansible_collections/[^/]+/[^/]+/MANIFEST.json$ diff --git a/macros.ansible b/macros.ansible deleted file mode 100644 index c8c91fb..0000000 --- a/macros.ansible +++ /dev/null @@ -1,7 +0,0 @@ -%ansible_collection_url() https://galaxy.ansible.com/%{collection_namespace}/%{collection_name} - -%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_files %{_datadir}/ansible/collections/ansible_collections/%{collection_namespace}/