Split out packaging macros and generators to ansible-packaging
This commit is contained in:
parent
a0ba245c85
commit
6abbb85a54
@ -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 <ngompa@fedoraproject.org> - 2.12.1-3
|
||||
- Split out packaging macros and generators to ansible-packaging
|
||||
|
||||
* Wed Dec 08 2021 Kevin Fenzi <kevin@scrye.com> - 2.12.1-2
|
||||
- Re-enable tests
|
||||
|
||||
|
@ -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()
|
@ -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$
|
@ -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}/
|
Loading…
Reference in New Issue
Block a user