| |
@@ -1,131 +1,30 @@
|
| |
- # Note to maintainers: main and all fedora branches can be merged.
|
| |
- # epel8 and epel7 and should be updated seperately.
|
| |
-
|
| |
- # in Fedora and EPEL8 build with docs and tests by default
|
| |
- %global with_docs 1
|
| |
-
|
| |
- # Disable tests on f29/f30 and epel8 for now.
|
| |
- # epel8 is missing 2 required packages.
|
| |
- # fedora29 and fedora30 have too old pytest
|
| |
- %if 0%{?fedora} < 31 || 0%{?rhel} >= 8
|
| |
+ # TODO: Re-enable docs and tests once possible
|
| |
+ %global with_docs 0
|
| |
%global with_tests 0
|
| |
- %else
|
| |
- %global with_tests 1
|
| |
- %endif
|
| |
-
|
| |
- Name: ansible
|
| |
- Summary: SSH-based configuration management, deployment, and task execution system
|
| |
- Version: 2.9.27
|
| |
- Release: 2%{?dist}
|
| |
-
|
| |
- License: GPLv3+
|
| |
- Source0: https://releases.ansible.com/ansible/%{name}-%{version}.tar.gz
|
| |
- Source1: ansible.attr
|
| |
- Source2: ansible-generator
|
| |
- Source3: macros.ansible
|
| |
- Url: http://ansible.com
|
| |
- BuildArch: noarch
|
| |
-
|
| |
- # add patch for Rocky linux: rhbz#1968728
|
| |
- Patch1: ansible-2.9.22-rocky.patch
|
| |
-
|
| |
- # Disable failing test
|
| |
- Patch2: ansible-2.9.6-disable-test_build_requirement_from_path_no_version.patch
|
| |
- # Fix Python 3.9 compatibility
|
| |
- # Backported from upstream: https://github.com/ansible/ansible/pull/67891
|
| |
- Patch3: fix-python-3.9-compatibility.patch
|
| |
-
|
| |
- # Fix to build docs with sphinx > 4.0
|
| |
- Patch4: ansible-2.9.23-sphinx4.patch
|
| |
-
|
| |
- # compatiblity with pyyaml > 6 for some tests
|
| |
- Patch5: ansible-2.9.27-pyyaml-6-compat.patch
|
| |
-
|
| |
- # compatibility with openssl v3
|
| |
- Patch6: ansible-2.9.27-openssl-3-compat.patch
|
| |
+ %global ansible_licensedir %{_defaultlicensedir}/ansible
|
| |
+ %global ansible_docdir %{_defaultdocdir}/ansible
|
| |
|
| |
- # add patch for Oracle linux: rhbz#2018369
|
| |
- Patch7: ansible-2.9.27-oracle.patch
|
| |
+ Name: ansible
|
| |
+ Summary: Curated set of Ansible collections included in addition to ansible-core
|
| |
+ Version: 5.1.0
|
| |
+ Release: 1%{?dist}
|
| |
|
| |
- # We used to have a ansible-python3 package that a number of other things
|
| |
- # started depending on, so we should now provide/obsolete it until they
|
| |
- # can all adjust to just needing ansible.
|
| |
- Provides: ansible-python3 = %{version}-%{release}
|
| |
- Obsoletes: ansible-python3 < %{version}-%{release}
|
| |
+ License: GPLv3+
|
| |
+ Source0: %{pypi_source}
|
| |
+ Url: https://ansible.com
|
| |
+ BuildArch: noarch
|
| |
|
| |
- # Conflict with the ansible-base package for now.
|
| |
- Conflicts: ansible-base > 2.10.0
|
| |
- # Conflict with the ansible-core package for now also.
|
| |
- Conflicts: ansible-core > 2.11.0
|
| |
+ BuildRequires: findutils
|
| |
+ BuildRequires: python3-devel
|
| |
+ BuildRequires: python3-setuptools
|
| |
|
| |
%if 0%{?with_tests}
|
| |
- #
|
| |
- # For tests
|
| |
- #
|
| |
- # These two exist on both fedora and rhel8
|
| |
- #
|
| |
- BuildRequires: python3-packaging
|
| |
- BuildRequires: python3-pexpect
|
| |
- #
|
| |
- # These only exist on Fedora. RHEL8 will just skip tests that need them.
|
| |
- #
|
| |
- %if 0%{?fedora}
|
| |
- BuildRequires: python3-paramiko
|
| |
- BuildRequires: python3-winrm
|
| |
-
|
| |
- BuildRequires: python3-crypto
|
| |
- BuildRequires: python3-pbkdf2
|
| |
- BuildRequires: python3-httmock
|
| |
- BuildRequires: python3-gitlab
|
| |
- BuildRequires: python3-boto3
|
| |
- BuildRequires: python3-botocore
|
| |
- BuildRequires: python3-coverage
|
| |
- BuildRequires: python3-passlib
|
| |
+ # TODO build-requires
|
| |
%endif
|
| |
- %endif
|
| |
- # For Docs/tests
|
| |
- BuildRequires: git-core
|
| |
- BuildRequires: openssl
|
| |
+
|
| |
%if 0%{?with_docs}
|
| |
- BuildRequires: python3-sphinx
|
| |
- BuildRequires: python3-sphinx-theme-alabaster
|
| |
- BuildRequires: python3-sphinx-notfound-page
|
| |
- BuildRequires: asciidoc
|
| |
- BuildRequires: python3-straight-plugin
|
| |
+ # TODO build-requires
|
| |
%endif
|
| |
- BuildRequires: python3-devel
|
| |
- BuildRequires: python3-setuptools
|
| |
- # accelerate is the only thing that makes keyczar mandatory. Since accelerate
|
| |
- # is deprecated, just ignore it
|
| |
- #BuildRequires: python-keyczar
|
| |
- BuildRequires: python3-six
|
| |
- # We pin Pytest to version 4 for now
|
| |
- # as there are some test failures with
|
| |
- # version 5. See rhbz#1841968
|
| |
- BuildRequires: %{py3_dist pytest}
|
| |
- BuildRequires: python3-pytest-xdist
|
| |
- BuildRequires: python3-pytest-mock
|
| |
- BuildRequires: python3-requests
|
| |
- BuildRequires: python3-mock
|
| |
- BuildRequires: python3-jinja2
|
| |
- BuildRequires: python3-pyyaml
|
| |
- BuildRequires: python3-cryptography
|
| |
- BuildRequires: python3-pyvmomi
|
| |
- BuildRequires: make
|
| |
-
|
| |
- # RHEL8 doesn't have python3-paramiko or python3-winrm (yet), but Fedora does
|
| |
- Recommends: python3-paramiko
|
| |
- Recommends: python3-winrm
|
| |
- # accelerate is the only thing that makes keyczar mandatory. Since accelerate
|
| |
- # is deprecated, just ignore it
|
| |
- #Requires: python3-keyczar
|
| |
- Requires: python3-setuptools
|
| |
- Requires: python3-six
|
| |
- Requires: python3-jinja2
|
| |
- Requires: python3-pyyaml
|
| |
- Requires: sshpass
|
| |
- # needed for json_query filter
|
| |
- Requires: python3-jmespath
|
| |
|
| |
%description
|
| |
Ansible is a radically simple model-driven configuration management,
|
| |
@@ -134,155 +33,86 @@
|
| |
on remote nodes. Extension modules can be written in any language and
|
| |
are transferred to managed machines automatically.
|
| |
|
| |
- %package -n ansible-doc
|
| |
- Summary: Documentation for Ansible
|
| |
+ This package provides a curated set of Ansible collections included in addition
|
| |
+ to ansible-core.
|
| |
|
| |
- %description -n ansible-doc
|
| |
+ %prep
|
| |
+ %autosetup -n ansible-%{version}
|
| |
|
| |
- Ansible is a radically simple model-driven configuration management,
|
| |
- multi-node deployment, and remote task execution system. Ansible works
|
| |
- over SSH and does not require any software or daemons to be installed
|
| |
- on remote nodes. Extension modules can be written in any language and
|
| |
- are transferred to managed machines automatically.
|
| |
+ # Remove unnecessary files and directories included in the Ansible collection release tarballs
|
| |
+ # Tracked upstream in part by: https://github.com/ansible-community/community-topics/issues/29
|
| |
+ echo "[START] Delete unnecessary files and directories"
|
| |
|
| |
- This package installs extensive documentation for ansible
|
| |
+ # Collection tarballs contain a lot of hidden files and directories
|
| |
+ hidden_pattern=".*\.(DS_Store|all-contributorsrc|ansible-lint|azure-pipelines|circleci|codeclimate.yml|flake8|galaxy_install_info|gitattributes|github|gitignore|gitkeep|gitlab-ci.yml|idea|keep|mypy_cache|nojekyll|orig|plugin-cache.yaml|pre-commit-config.yaml|project|pydevproject|pytest_cache|pytest_cache|readthedocs.yml|settings|swp|travis.yml|vscode|yamllint|yamllint.yaml|zuul.d|zuul.yaml)$"
|
| |
+ find ansible_collections -regextype posix-egrep -regex "${hidden_pattern}" -print -depth -exec rm -rf {} \;
|
| |
|
| |
- %package -n ansible-test
|
| |
- Summary: Tool for testing ansible plugin and module code
|
| |
- Requires: %{name} = %{version}-%{release}
|
| |
+ # TODO: Delete (bulky) tests for now but we should run sanity and unit tests soon.
|
| |
+ find ansible_collections -type d -wholename "*tests/integration" -print -depth -exec rm -rf {} \;
|
| |
+ find ansible_collections -type d -wholename "*tests/unit" -print -depth -exec rm -rf {} \;
|
| |
+ find ansible_collections -type d -wholename "*tests/sanity" -print -depth -exec rm -rf {} \;
|
| |
+ find ansible_collections -type d -wholename "*tests/regression" -print -depth -exec rm -rf {} \;
|
| |
|
| |
- %description -n ansible-test
|
| |
- Ansible is a radically simple model-driven configuration management,
|
| |
- multi-node deployment, and remote task execution system. Ansible works
|
| |
- over SSH and does not require any software or daemons to be installed
|
| |
- on remote nodes. Extension modules can be written in any language and
|
| |
- are transferred to managed machines automatically.
|
| |
+ # https://github.com/ansible-collections/kubernetes.core/pull/298
|
| |
+ rm -rf ansible_collections/kubernetes/core/molecule
|
| |
|
| |
- This package installs the ansible-test command for testing modules and plugins
|
| |
- developed for ansible.
|
| |
+ # rpmlint W: pem-certificate
|
| |
+ find ansible_collections/cyberark/conjur -type f -name "*.pem" -print -delete
|
| |
|
| |
+ # rpmlint E: zero-length
|
| |
+ find -type f -name "*requirements.txt" -size 0 -print -delete
|
| |
+ rm -f ansible_collections/community/zabbix/roles/zabbix_agent/files/win_sample/doSomething.ps1
|
| |
|
| |
- %prep
|
| |
- %autosetup -p1
|
| |
- cp -a %{S:1} %{S:2} %{S:3} .
|
| |
+ echo "[END] Delete unnecessary files and directories"
|
| |
|
| |
%build
|
| |
-
|
| |
- # Fix some files shebangs
|
| |
- sed -i -e 's|/usr/bin/env python|/usr/bin/python3|' test/lib/ansible_test/_data/*.py test/lib/ansible_test/_data/*/*.py test/lib/ansible_test/_data/*/*/*.py docs/bin/find-plugin-refs.py
|
| |
-
|
| |
- # These we have to supress or the package will depend on /usr/bin/pwsh and not be installable.
|
| |
- sed -i -s 's|/usr/bin/env pwsh||' test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/ps_argspec.ps1
|
| |
- sed -i -s 's|/usr/bin/env pwsh||' test/lib/ansible_test/_data/sanity/pslint/pslint.ps1
|
| |
- sed -i -s 's|/usr/bin/env pwsh||' test/lib/ansible_test/_data/requirements/sanity.ps1
|
| |
-
|
| |
- # disable the python -s shbang flag as we want to be able to find non system modules
|
| |
- %global py3_shbang_opts %(echo %{py3_shbang_opts} | sed 's/-s//')
|
| |
+ %py3_shebang_fix ansible_collections
|
| |
%py3_build
|
| |
|
| |
- %if 0%{?with_docs}
|
| |
- make PYTHON=/usr/bin/python3 SPHINXBUILD=sphinx-build-3 webdocs
|
| |
- %else
|
| |
- make PYTHON=/usr/bin/python3 -Cdocs/docsite config cli keywords modules plugins testing
|
| |
- %endif
|
| |
-
|
| |
%install
|
| |
%py3_install
|
| |
|
| |
- # Create system directories that Ansible defines as default locations in
|
| |
- # ansible/config/base.yml
|
| |
- DATADIR_LOCATIONS='%{_datadir}/ansible/collections
|
| |
- %{_datadir}/ansible/collections/ansible_collections
|
| |
- %{_datadir}/ansible/plugins/doc_fragments
|
| |
- %{_datadir}/ansible/plugins/action
|
| |
- %{_datadir}/ansible/plugins/become
|
| |
- %{_datadir}/ansible/plugins/cache
|
| |
- %{_datadir}/ansible/plugins/callback
|
| |
- %{_datadir}/ansible/plugins/cliconf
|
| |
- %{_datadir}/ansible/plugins/connection
|
| |
- %{_datadir}/ansible/plugins/filter
|
| |
- %{_datadir}/ansible/plugins/httpapi
|
| |
- %{_datadir}/ansible/plugins/inventory
|
| |
- %{_datadir}/ansible/plugins/lookup
|
| |
- %{_datadir}/ansible/plugins/modules
|
| |
- %{_datadir}/ansible/plugins/module_utils
|
| |
- %{_datadir}/ansible/plugins/netconf
|
| |
- %{_datadir}/ansible/roles
|
| |
- %{_datadir}/ansible/plugins/strategy
|
| |
- %{_datadir}/ansible/plugins/terminal
|
| |
- %{_datadir}/ansible/plugins/test
|
| |
- %{_datadir}/ansible/plugins/vars'
|
| |
-
|
| |
- UPSTREAM_DATADIR_LOCATIONS=$(grep -ri default lib/ansible/config/base.yml| tr ':' '\n' | grep '/usr/share/ansible')
|
| |
-
|
| |
- if [ "$SYSTEM_LOCATIONS" != "$UPSTREAM_SYSTEM_LOCATIONS" ] ; then
|
| |
- echo "The upstream Ansible datadir locations have changed. Spec file needs to be updated"
|
| |
- exit 1
|
| |
- fi
|
| |
-
|
| |
- mkdir -p $RPM_BUILD_ROOT%{_datadir}/ansible/plugins/
|
| |
- for location in $DATADIR_LOCATIONS ; do
|
| |
- mkdir $RPM_BUILD_ROOT"$location"
|
| |
- done
|
| |
- mkdir -p $RPM_BUILD_ROOT/etc/ansible/
|
| |
- mkdir -p $RPM_BUILD_ROOT/etc/ansible/roles/
|
| |
-
|
| |
- cp examples/hosts $RPM_BUILD_ROOT/etc/ansible/
|
| |
- cp examples/ansible.cfg $RPM_BUILD_ROOT/etc/ansible/
|
| |
- mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1
|
| |
- cp -v docs/man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1/
|
| |
-
|
| |
- cp -pr docs/docsite/rst .
|
| |
- %if 0%{?with_docs}
|
| |
- cp -pr docs/docsite/_build/html %{_builddir}/%{name}-%{version}/html
|
| |
- %endif
|
| |
-
|
| |
- install -Dpm0644 -t %{buildroot}%{_fileattrsdir} ansible.attr
|
| |
- install -Dpm0644 -t %{buildroot}%{_rpmmacrodir} macros.ansible
|
| |
- install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} ansible-generator
|
| |
-
|
| |
+ # Install docs and licenses
|
| |
+ (
|
| |
+ mkdir -p "%{buildroot}%{ansible_docdir}" "%{buildroot}%{ansible_licensedir}"
|
| |
+ cd ansible_collections
|
| |
+ # This finds the license file for each collection, copies it to
|
| |
+ # `%%{ansible_licensedir}/collection_namespace/collection_name`, and then adds
|
| |
+ # `%%license /path/to/license` to the %%files list. See `man find` for more info.
|
| |
+ # The extra percent signs are needed to escape RPM.
|
| |
+ find . -mindepth 3 -type f \( -name LICENSE -o -name COPYING \) \
|
| |
+ -exec cp -p --parents '{}' '%{buildroot}%{ansible_licensedir}' \; \
|
| |
+ -printf '%%%%license %%%%{ansible_licensedir}/%%P\n' | tee -a ../files.list
|
| |
+ # This does the same thing, but for READMEs.
|
| |
+ find . -mindepth 3 -type f -name 'README.*' \
|
| |
+ -exec cp -p --parents '{}' '%{buildroot}%{ansible_docdir}' \; \
|
| |
+ -printf '%%%%doc %%%%{ansible_docdir}/%%P\n' | tee -a ../files.list
|
| |
+ )
|
| |
|
| |
%check
|
| |
%if 0%{?with_tests}
|
| |
- ln -s /usr/bin/pytest-3 bin/pytest
|
| |
- pathfix.py -i %{__python3} -p test/lib/ansible_test/_data/cli/ansible_test_cli_stub.py
|
| |
- # This test needs a module not packaged in Fedora so disable it.
|
| |
- rm -f test/units/modules/cloud/cloudstack/test_cs_traffic_type.py
|
| |
- # These tests are failing with pytest 6
|
| |
- rm -f test/units/module_utils/facts/hardware/test_sunos_get_uptime_facts.py
|
| |
- rm -f test/units/modules/source_control/test_gitlab_runner.py
|
| |
- rm -f test/units/plugins/lookup/test_aws_secret.py
|
| |
- rm -f test/units/plugins/lookup/test_aws_ssm.py
|
| |
- make PYTHON=/usr/bin/python3 tests-py3
|
| |
+ # TODO: Run tests
|
| |
%endif
|
| |
|
| |
- %files
|
| |
+ %files -f files.list
|
| |
%license COPYING
|
| |
- %doc README.rst PKG-INFO changelogs/CHANGELOG-v2.9.rst
|
| |
- %doc %{_mandir}/man1/ansible*
|
| |
- %config(noreplace) %{_sysconfdir}/ansible/
|
| |
- %{_bindir}/ansible*
|
| |
- %{_datadir}/ansible/
|
| |
- %{python3_sitelib}/ansible
|
| |
- %{python3_sitelib}/ansible_test
|
| |
+ %doc README.rst PKG-INFO porting_guide_5.rst CHANGELOG-v5.rst
|
| |
+ # Note (dmsimard): This ansible package installs collections to the python sitelib to mirror the UX
|
| |
+ # when installing the ansible package from PyPi.
|
| |
+ # This allows users to install individual collections manually with ansible-galaxy (~/.ansible/collections/ansible_collections)
|
| |
+ # or via standalone distribution packages to datadir (/usr/share).
|
| |
+ # Both will have precedence over the collections installed in the python sitelib.
|
| |
+ %{python3_sitelib}/ansible_collections
|
| |
%{python3_sitelib}/*egg-info
|
| |
- %{_fileattrsdir}/ansible.attr
|
| |
- %{_rpmmacrodir}/macros.ansible
|
| |
- %{_rpmconfigdir}/ansible-generator
|
| |
- %exclude %{_bindir}/ansible-test
|
| |
- %exclude %{python3_sitelib}/ansible_test
|
| |
-
|
| |
- %files -n ansible-doc
|
| |
- %doc rst
|
| |
- %if 0%{?with_docs}
|
| |
- %doc html
|
| |
- %endif
|
| |
-
|
| |
- %files -n ansible-test
|
| |
- %{_bindir}/ansible-test
|
| |
- %{python3_sitelib}/ansible_test
|
| |
|
| |
%changelog
|
| |
+ * Tue Jan 11 2022 David Moreau-Simard <moi@dmsimard.com> - 5.1.0-1
|
| |
+ - Update to latest upstream release
|
| |
+ - Refactor to take into account split from ansible-core after ansible 2.9, see: https://fedoraproject.org/wiki/Changes/Ansible5
|
| |
+ - Remove patches intended for Ansible 2.9
|
| |
+ - Removed packaging macros (soon included in ansible-packaging, see rhbz#2038591)
|
| |
+ - Removed provides/obsoletes on ansible-python3
|
| |
+
|
| |
* Mon Nov 01 2021 Kevin Fenzi <kevin@scrye.com> - 2.9.27-2
|
| |
- Add patch for oracle linux Fixes rhbz#2018369
|
| |
|
| |
You should not remove this or
ansible-generator
. These macros are used by theansible-collection-*
packages.