|
 |
64a06a4 |
%global _docdir_fmt ansible-packaging
|
|
 |
64a06a4 |
|
|
 |
6ae39f7 |
Name: ansible-packaging
|
|
 |
6ae39f7 |
Version: 1
|
|
 |
4714272 |
Release: 11%{?dist}
|
|
 |
6ae39f7 |
Summary: RPM packaging macros and generators for Ansible collections
|
|
 |
6ae39f7 |
|
|
 |
247eaef |
License: GPL-3.0-or-later
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
Source0: ansible-generator
|
|
 |
6ae39f7 |
Source1: ansible.attr
|
|
 |
6ae39f7 |
Source2: macros.ansible
|
|
 |
1fc7f62 |
Source3: macros.ansible-srpm
|
|
 |
bc337bd |
Source4: ansible_collection.py
|
|
 |
bc337bd |
|
|
 |
bc337bd |
Source100: COPYING
|
|
 |
bc337bd |
|
|
 |
bc337bd |
# Needed for ansible_collection.py
|
|
 |
bc337bd |
Requires: %{py3_dist pyyaml}
|
|
 |
6ae39f7 |
|
|
 |
a5b014c |
# Require ansible-core for building. Collections still have a boolean runtime
|
|
 |
a5b014c |
# dependency on either ansible 2.9 OR ansible-core.
|
|
 |
a5b014c |
Requires: ansible-core
|
|
 |
6ae39f7 |
|
|
 |
1fc7f62 |
Requires: ansible-srpm-macros = %{version}-%{release}
|
|
 |
1fc7f62 |
|
|
 |
6ae39f7 |
# Conflict with anything providing its own copies of these files
|
|
 |
d349c3c |
%if ! (0%{?rhel} >= 8)
|
|
 |
6ae39f7 |
Conflicts: ansible-core < 2.12.1-3
|
|
 |
76cc4a6 |
%endif
|
|
 |
854a086 |
Conflicts: ansible < 2.9.27-3
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
BuildArch: noarch
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
%description
|
|
 |
6ae39f7 |
%{summary}.
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
|
|
 |
1fc7f62 |
%package -n ansible-srpm-macros
|
|
 |
1fe80d2 |
Summary: SRPM stage RPM packaging macros for Ansible collections
|
|
 |
1fc7f62 |
|
|
 |
1fc7f62 |
%description -n ansible-srpm-macros
|
|
 |
1fc7f62 |
%{summary}.
|
|
 |
1fc7f62 |
|
|
 |
1fe80d2 |
%package tests
|
|
 |
1fe80d2 |
Summary: Dependencies for Ansible collection package unit tests
|
|
 |
1fe80d2 |
Requires: %{name} = %{version}-%{release}
|
|
 |
1fe80d2 |
Requires: /usr/bin/ansible-test
|
|
 |
1fe80d2 |
# This list is taken from %%{python3_sitelib}/ansible_test/_data/requirements/units.txt
|
|
 |
1fe80d2 |
Requires: %{py3_dist pytest}
|
|
 |
1fe80d2 |
Requires: %{py3_dist pytest-mock}
|
|
 |
1fe80d2 |
Requires: %{py3_dist pytest-xdist}
|
|
 |
4cecf06 |
Requires: (%{py3_dist pytest-forked} if ansible-core < 2.16~~)
|
|
 |
1fe80d2 |
Requires: %{py3_dist pyyaml}
|
|
 |
1fe80d2 |
# mock is included in the list upstream, but is deprecated in Fedora.
|
|
 |
1fe80d2 |
# Maintainers should work with upstream to add compat code to support
|
|
 |
1fe80d2 |
# both unittest.mock and mock and/or patch it out themselves.
|
|
 |
1fe80d2 |
# See https://fedoraproject.org/wiki/Changes/DeprecatePythonMock.
|
|
 |
1fe80d2 |
# Requires: %%{py3_dist mock}
|
|
 |
1fe80d2 |
|
|
 |
1fe80d2 |
%description tests
|
|
 |
1fe80d2 |
This package contains the necessary dependencies to run unit tests for packaged
|
|
 |
1fe80d2 |
Ansible collections
|
|
 |
1fe80d2 |
|
|
 |
1fc7f62 |
|
|
 |
6ae39f7 |
%prep
|
|
 |
6ae39f7 |
%autosetup -T -c
|
|
 |
6ae39f7 |
cp -a %{sources} .
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
%build
|
|
 |
6ae39f7 |
# Nothing to build
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
%install
|
|
 |
6ae39f7 |
install -Dpm0644 -t %{buildroot}%{_fileattrsdir} ansible.attr
|
|
 |
bc337bd |
install -Dpm0644 -t %{buildroot}%{_rpmmacrodir} macros.ansible
|
|
 |
bc337bd |
install -Dpm0644 -t %{buildroot}%{_rpmmacrodir} macros.ansible-srpm
|
|
 |
6ae39f7 |
install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} ansible-generator
|
|
 |
bc337bd |
install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} ansible_collection.py
|
|
 |
6ae39f7 |
|
|
 |
c67bd58 |
%check
|
|
 |
c67bd58 |
# TODO: Currently, this only tests %%{ansible_collection_url}.
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
rpm_eval() {
|
|
 |
c67bd58 |
default_macros_path="$(rpm --showrc | grep 'Macro path' | awk -F ': ' '{print $2}')"
|
|
 |
c67bd58 |
rpm --macros="${default_macros_path}:%{buildroot}%{_rpmmacrodir}/macros.*" "$@"
|
|
 |
c67bd58 |
}
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
errors() {
|
|
 |
c67bd58 |
error="error: %%ansible_collection_url: You must pass the collection namespace as the first arg and the collection name as the second"
|
|
 |
c67bd58 |
"$@" && exit 1
|
|
 |
c67bd58 |
"$@" |& grep -q "${error}"
|
|
 |
c67bd58 |
}
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo "Ensure macro fails when only collection_namespace macro is defined"
|
|
 |
c67bd58 |
errors rpm_eval -D 'collection_namespace cc' -E '%%ansible_collection_url'
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo "Ensure macro fails when only collection_name macro is defined"
|
|
 |
c67bd58 |
errors rpm_eval -D 'collection_name cc' -E '%%ansible_collection_url'
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo "Ensure macro fails when second argument is missing"
|
|
 |
c67bd58 |
errors rpm_eval -E '%%ansible_collection_url a'
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo "Ensure macro fails when second argument is missing"
|
|
 |
c67bd58 |
errors rpm_eval -D 'collection_name b' -E '%%ansible_collection_url a'
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo "Ensure macro fails when neither the control macros nor macro arguments are passed"
|
|
 |
c67bd58 |
errors rpm_eval -E '%%ansible_collection_url'
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo "Ensure macro works when both arguments are passed and no control macros are set"
|
|
 |
e967649 |
[ "$(rpm_eval -E '%%ansible_collection_url community general')" = \
|
|
 |
e967649 |
"https://galaxy.ansible.com/community/general" ]
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo "Ensure macro works with the control macros"
|
|
 |
e967649 |
[ "$(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \
|
|
 |
e967649 |
-E '%%ansible_collection_url')" = "https://galaxy.ansible.com/ansible/posix" ]
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
echo
|
|
 |
c67bd58 |
echo "Ensure macro prefers the collection namespace and name passed as an argument over the control macros"
|
|
 |
e967649 |
[ "$(rpm_eval -D 'collection_namespace ansible' -D 'collection_name posix' \
|
|
 |
e967649 |
-E '%%ansible_collection_url community general')" = "https://galaxy.ansible.com/community/general" ]
|
|
 |
c67bd58 |
|
|
 |
c67bd58 |
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
%files
|
|
 |
6ae39f7 |
%{_fileattrsdir}/ansible.attr
|
|
 |
6ae39f7 |
%{_rpmmacrodir}/macros.ansible
|
|
 |
6ae39f7 |
%{_rpmconfigdir}/ansible-generator
|
|
 |
bc337bd |
%{_rpmconfigdir}/ansible_collection.py
|
|
 |
6ae39f7 |
|
|
 |
6ae39f7 |
|
|
 |
1fc7f62 |
%files -n ansible-srpm-macros
|
|
 |
64a06a4 |
%license COPYING
|
|
 |
1fc7f62 |
%{_rpmmacrodir}/macros.ansible-srpm
|
|
 |
1fc7f62 |
|
|
 |
1fe80d2 |
# ansible-core in RHEL 8.6 is built against python38. In c8s and the next RHEL
|
|
 |
1fe80d2 |
# 8 minor release, it will be built against python39. The testing dependencies
|
|
 |
1fe80d2 |
# are not yet packaged for either python version in EPEL 8.
|
|
 |
1fe80d2 |
%if ! (%{defined rhel} && 0%{?rhel} < 9)
|
|
 |
1fe80d2 |
%files tests
|
|
 |
1fe80d2 |
%endif
|
|
 |
1fe80d2 |
|
|
 |
1fc7f62 |
|
|
 |
6ae39f7 |
%changelog
|
|
 |
4714272 |
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1-11
|
|
 |
4714272 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
|
 |
4714272 |
|
|
 |
62d0879 |
* Thu May 11 2023 Maxwell G <maxwell@gtmx.me> - 1-10
|
|
 |
62d0879 |
- %%ansible_collection_install - disable spurious collections path warnings
|
|
 |
4cecf06 |
- ansible-packaging-tests - don't depend on pytest-forked with ansible-core 2.16
|
|
 |
64a06a4 |
- ansible-srpm-macros - include license file in the package
|
|
 |
62d0879 |
|
|
 |
a7e7605 |
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1-9.1
|
|
 |
a7e7605 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
|
 |
a7e7605 |
|
|
 |
7ea0e61 |
* Sat Sep 24 2022 Maxwell G <gotmax@e.email> - 1-8.1
|
|
 |
7ea0e61 |
- Refactor %%ansible_collection_url, %%ansible_collection_install,
|
|
 |
7ea0e61 |
%%ansible_test_unit.
|
|
 |
7ea0e61 |
- Specfiles no longer need to define %%collection_namespace or %%collection_name
|
|
 |
7ea0e61 |
for the macros to work.
|
|
 |
7ea0e61 |
- Add new %%ansible_collections_dir, %%ansible_roles_dir, and
|
|
 |
f85cd2c |
%%ansible_collection_filelist macros.
|
|
 |
7ea0e61 |
- Prepare to deprecate %%ansible_collection_files
|
|
 |
7ea0e61 |
- Undefine %%_package_note_file to stop that file from leaking into collection
|
|
 |
7ea0e61 |
artifacts.
|
|
 |
7ea0e61 |
|
|
 |
1fe80d2 |
* Mon Aug 01 2022 Maxwell G <gotmax@e.email> - 1-7
|
|
 |
1fe80d2 |
- Implement %%ansible_test_unit and add ansible-packaging-tests metapackage.
|
|
 |
1fe80d2 |
- Require ansible-core at buildtime
|
|
 |
1fe80d2 |
|
|
 |
aee1b87 |
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1-6
|
|
 |
aee1b87 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
|
 |
aee1b87 |
|
|
 |
1fc7f62 |
* Tue May 17 2022 Maxwell G <gotmax@e.email> - 1-5
|
|
 |
1fc7f62 |
- Split macros required for building SRPMs into a separate package.
|
|
 |
1fc7f62 |
|
|
 |
854a086 |
* Tue Apr 26 2022 Maxwell G <gotmax@e.email> - 1-4
|
|
 |
854a086 |
- Restore compatability with f34 and f35.
|
|
 |
854a086 |
|
|
 |
d349c3c |
* Mon Jan 31 2022 Neal Gompa <ngompa@fedoraproject.org> - 1-3
|
|
 |
d349c3c |
- Drop vestigial support for the legacy ansible package
|
|
 |
d349c3c |
- Make compatibile with RHEL 8.6+
|
|
 |
d349c3c |
|
|
 |
04cd2f8 |
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1-2
|
|
 |
04cd2f8 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
|
 |
04cd2f8 |
|
|
 |
6ae39f7 |
* Thu Jan 13 2022 Neal Gompa <ngompa@fedoraproject.org> - 1-1
|
|
 |
6ae39f7 |
- Initial packaging split out of ansible-core (#2038591)
|