Blame SPECS/ansible-packaging.spec

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