diff --git a/Makefile b/Makefile index bd8e03acd30..b91e45a000f 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,6 @@ # make clean ---------------- clean up # make webdocs -------------- produce ansible doc at docs/docsite/_build/html # make sdist ---------------- produce a tarball -# make srpm ----------------- produce a SRPM -# make rpm ----------------- produce RPMs # make deb-src -------------- produce a DEB source # make deb ------------------ produce a DEB # make docs ----------------- rebuild the manpages (results are checked in) @@ -35,20 +33,12 @@ endif PYTHON=python GENERATE_CLI = hacking/build-ansible.py generate-man -SITELIB = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()") - # fetch version from project release.py as single source-of-truth VERSION := $(shell $(PYTHON) packaging/release/versionhelper/version_helper.py --raw || echo error) ifeq ($(findstring error,$(VERSION)), error) $(error "version_helper failed") endif -MAJOR_VERSION := $(shell $(PYTHON) packaging/release/versionhelper/version_helper.py --majorversion) -CODENAME := $(shell $(PYTHON) packaging/release/versionhelper/version_helper.py --codename) - -# if a specific release was not requested, set to 1 (RPMs have "fancier" logic for this further down) -RELEASE ?= 1 - # Get the branch information from git ifneq ($(shell which git),) GIT_DATE := $(shell git log -n 1 --format="%ci") @@ -98,32 +88,6 @@ PBUILDER_CACHE_DIR = /var/cache/pbuilder PBUILDER_BIN ?= pbuilder PBUILDER_OPTS ?= --debootstrapopts --variant=buildd --architecture $(PBUILDER_ARCH) --debbuildopts -b -# RPM build parameters -RPMSPECDIR= packaging/rpm -RPMSPEC = $(RPMSPECDIR)/ansible.spec -RPMDIST = $(shell rpm --eval '%{?dist}') - -ifneq ($(OFFICIAL),yes) - RPMRELEASE = 100.git$(DATE)$(GITINFO) -endif -ifeq ($(PUBLISH),nightly) - # https://fedoraproject.org/wiki/Packaging:Versioning#Snapshots - RPMRELEASE = $(RELEASE).$(DATE)git.$(GIT_HASH) -endif - -RPMVERSION ?= $(shell $(PYTHON) packaging/release/versionhelper/version_helper.py --baseversion) -RPMRELEASE ?= $(shell $(PYTHON) packaging/release/versionhelper/version_helper.py --rpmrelease) -RPMNVR = "$(NAME)-$(RPMVERSION)-$(RPMRELEASE)$(RPMDIST)$(REPOTAG)" - -# MOCK build parameters -MOCK_BIN ?= mock -MOCK_CFG ?= - -# dynamically add repotag define only if specified -ifneq ($(REPOTAG),) - EXTRA_RPM_DEFINES += --define "repotag $(REPOTAG)" -endif - # ansible-test parameters ANSIBLE_TEST ?= bin/ansible-test TEST_FLAGS ?= @@ -189,8 +153,6 @@ clean: rm -f test/units/.coverage* rm -rf test/results/*/* find test/ -type f -name '*.retry' -delete - @echo "Cleaning up RPM building stuff" - rm -rf MANIFEST rpm-build @echo "Cleaning up Debian building stuff" rm -rf debian rm -rf deb-build @@ -235,76 +197,6 @@ sdist_upload: clean docs changelog: PYTHONPATH=./lib packaging/release/changelogs/changelog.py release -vv && PYTHONPATH=./lib packaging/release/changelogs/changelog.py generate -vv -.PHONY: rpmcommon -rpmcommon: sdist - @mkdir -p rpm-build - @cp dist/*.gz rpm-build/ - @cp $(RPMSPEC) rpm-build/$(NAME).spec - -.PHONY: mock-srpm -mock-srpm: /etc/mock/$(MOCK_CFG).cfg rpmcommon - $(MOCK_BIN) -r $(MOCK_CFG) $(MOCK_ARGS) --resultdir rpm-build/ --bootstrap-chroot --old-chroot --buildsrpm --spec rpm-build/$(NAME).spec --sources rpm-build/ \ - --define "rpmversion $(RPMVERSION)" \ - --define "upstream_version $(VERSION)" \ - --define "rpmrelease $(RPMRELEASE)" \ - $(EXTRA_RPM_DEFINES) - @echo "#############################################" - @echo "Ansible SRPM is built:" - @echo rpm-build/*.src.rpm - @echo "#############################################" - -.PHONY: mock-rpm -mock-rpm: /etc/mock/$(MOCK_CFG).cfg mock-srpm - $(MOCK_BIN) -r $(MOCK_CFG) $(MOCK_ARGS) --resultdir rpm-build/ --bootstrap-chroot --old-chroot --rebuild rpm-build/$(NAME)-*.src.rpm \ - --define "rpmversion $(RPMVERSION)" \ - --define "upstream_version $(VERSION)" \ - --define "rpmrelease $(RPMRELEASE)" \ - $(EXTRA_RPM_DEFINES) - @echo "#############################################" - @echo "Ansible RPM is built:" - @echo rpm-build/*.noarch.rpm - @echo "#############################################" - -.PHONY: srpm -srpm: rpmcommon - @rpmbuild --define "_topdir %(pwd)/rpm-build" \ - --define "_builddir %{_topdir}" \ - --define "_rpmdir %{_topdir}" \ - --define "_srcrpmdir %{_topdir}" \ - --define "_specdir $(RPMSPECDIR)" \ - --define "_sourcedir %{_topdir}" \ - --define "upstream_version $(VERSION)" \ - --define "rpmversion $(RPMVERSION)" \ - --define "rpmrelease $(RPMRELEASE)" \ - $(EXTRA_RPM_DEFINES) \ - -bs rpm-build/$(NAME).spec - @rm -f rpm-build/$(NAME).spec - @echo "#############################################" - @echo "Ansible SRPM is built:" - @echo " rpm-build/$(RPMNVR).src.rpm" - @echo "#############################################" - -.PHONY: rpm -rpm: rpmcommon - @rpmbuild --define "_topdir %(pwd)/rpm-build" \ - --define "_builddir %{_topdir}" \ - --define "_rpmdir %{_topdir}" \ - --define "_srcrpmdir %{_topdir}" \ - --define "_specdir $(RPMSPECDIR)" \ - --define "_sourcedir %{_topdir}" \ - --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ - --define "__python `which $(PYTHON)`" \ - --define "upstream_version $(VERSION)" \ - --define "rpmversion $(RPMVERSION)" \ - --define "rpmrelease $(RPMRELEASE)" \ - $(EXTRA_RPM_DEFINES) \ - -ba rpm-build/$(NAME).spec - @rm -f rpm-build/$(NAME).spec - @echo "#############################################" - @echo "Ansible RPM is built:" - @echo " rpm-build/$(RPMNVR).noarch.rpm" - @echo "#############################################" - .PHONY: debian debian: sdist @for DIST in $(DEB_DIST) ; do \ diff --git a/docs/docsite/rst/installation_guide/intro_installation.rst b/docs/docsite/rst/installation_guide/intro_installation.rst index 89d08fe7c3a..9f0ff088970 100644 --- a/docs/docsite/rst/installation_guide/intro_installation.rst +++ b/docs/docsite/rst/installation_guide/intro_installation.rst @@ -114,7 +114,7 @@ On RHEL and CentOS: $ sudo yum install ansible -RPMs for RHEL 7 and RHEL 8 are available from the `Ansible Engine repository `_. +RPMs for RHEL 7 and RHEL 8 are available from the `Ansible Engine repository `_. To enable the Ansible Engine repository for RHEL 8, run the following command: @@ -128,18 +128,9 @@ To enable the Ansible Engine repository for RHEL 7, run the following command: $ sudo subscription-manager repos --enable rhel-7-server-ansible-2.9-rpms -RPMs for currently supported versions of RHEL, CentOS, and Fedora are available from `EPEL `_. +RPMs for currently supported versions of RHEL and CentOS are also available from `EPEL `_. -Ansible version 2.4 and later can manage earlier operating systems that contain Python 2.6 or higher. - -You can also build an RPM yourself. From the root of a checkout or tarball, use the ``make rpm`` command to build an RPM you can distribute and install. - -.. code-block:: bash - - $ git clone https://github.com/ansible/ansible.git - $ cd ./ansible - $ make rpm - $ sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm +Ansible version 2.4 and later can manage older operating systems that contain Python 2.6 or higher. .. _from_apt: diff --git a/packaging/rpm/ansible.spec b/packaging/rpm/ansible.spec deleted file mode 100644 index d5af411208d..00000000000 --- a/packaging/rpm/ansible.spec +++ /dev/null @@ -1,313 +0,0 @@ -%define release_date %(date "+%a %b %e %Y") - -# Disable shebang munging for specific paths. These files are data files. -# ansible-test munges the shebangs itself. -%global __brp_mangle_shebangs_exclude_from /usr/lib/python[0-9]+\.[0-9]+/site-packages/ansible_test/_data/.* - -# RHEL and Fedora add -s to the shebang line. We do *not* use -s -E -S or -I -# with ansible because it has many optional features which users need to -# install libraries on their own to use. For instance, paramiko for the -# network connection plugins or winrm to talk to windows hosts. -# Set this to nil to remove -s -%define py_shbang_opts %{nil} -%define py2_shbang_opts %{nil} -%define py3_shbang_opts %{nil} - - -%if 0%{?fedora} || 0%{?rhel} >= 8 -%global with_python2 0 -%global with_python3 1 -%else -%global with_python2 1 -%global with_python3 0 -%endif - -Name: ansible -Summary: SSH-based configuration management, deployment, and task execution system -Version: %{rpmversion} -Release: %{rpmrelease}%{?dist}%{?repotag} - -Group: Development/Libraries -License: GPLv3+ -Source0: https://releases.ansible.com/ansible/%{name}-%{upstream_version}.tar.gz - -Url: http://ansible.com -BuildArch: noarch - -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -%{!?python2_sitelib: %global python_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%{!?python3_sitelib: %global python_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} - -# Bundled provides -Provides: bundled(python-backports-ssl_match_hostname) = 3.7.0.1 -Provides: bundled(python-distro) = 1.4.0 -Provides: bundled(python-ipaddress) = 1.0.22 -Provides: bundled(python-selectors2) = 1.1.1 -Provides: bundled(python-six) = 1.12.0 - -%if 0%{?rhel} >= 8 - -BuildRequires: python3-devel -BuildRequires: python3-setuptools - -# man pages -BuildRequires: python3-docutils - -# Tests -BuildRequires: python3-jinja2 -BuildRequires: python3-PyYAML -BuildRequires: python3-cryptography -BuildRequires: python3-six - -BuildRequires: python3-pytest -BuildRequires: python3-pytest-xdist -BuildRequires: python3-pytest-mock -BuildRequires: python3-requests -BUildRequires: %{py3_dist coverage} -BuildRequires: python3-mock -# Not available in RHEL8, we'll just skip the tests where they apply -#BuildRequires: python3-boto3 -#BuildRequires: python3-botocore -BuildRequires: python3-systemd - -BuildRequires: git-core - -Requires: python3-jinja2 - -Requires: python3-PyYAML -Requires: python3-cryptography -Requires: python3-six -Requires: sshpass - -%else -%if 0%{?rhel} >= 7 -# RHEL 7 -BuildRequires: python2-devel -BuildRequires: python-setuptools - -# For building docs -BuildRequires: python-sphinx - -# Tests -BuildRequires: python-jinja2 -BuildRequires: PyYAML -BuildRequires: python2-cryptography -BuildRequires: python-six - -# rhel7 does not have python-pytest but has pytest -BuildRequires: pytest -#BuildRequires: python-pytest-xdist -#BuildRequires: python-pytest-mock -BuildRequires: python-requests -BuildRequires: python-coverage -BuildRequires: python-mock -BuildRequires: python-boto3 -#BuildRequires: python-botocore -BuildRequires: git - -BuildRequires: python-paramiko -BuildRequires: python-jmespath -BuildRequires: python-passlib - -Requires: python-jinja2 - -Requires: PyYAML -Requires: python2-cryptography -Requires: python-six -Requires: sshpass - -# As of Ansible-2.9.0, we no longer depend on the optional dependencies jmespath or passlib -# Users have to install those on their own -Requires: python-paramiko - -# The ansible-doc package is no longer provided as of Ansible Engine 2.6.0 -Obsoletes: ansible-doc < 2.6.0 -%endif # Requires for RHEL 7 -%endif # Requires for RHEL 8 - - -# FEDORA >= 29 -%if 0%{?fedora} >= 29 -BuildRequires: python3-devel -BuildRequires: python3-setuptools -Requires: python3-PyYAML -Requires: python3-paramiko -Requires: python3-jinja2 -Requires: python3-httplib2 -Requires: python3-setuptools -Requires: python3-six -Requires: sshpass -%endif - -# SUSE/openSUSE -%if 0%{?suse_version} -BuildRequires: python-devel -BuildRequires: python-setuptools -Requires: python-paramiko -Requires: python-jinja2 -Requires: python-yaml -Requires: python-httplib2 -Requires: python-setuptools -Requires: python-six -Requires: sshpass -%endif - - -%description -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. - -%package -n ansible-test -Summary: Tool for testing ansible plugin and module code -Requires: %{name} = %{version}-%{release} -%if 0%{?rhel} >= 8 -# Will use the python3 stdlib venv -#Requires: python3-virtualenv -#BuildRequires: python3-virtualenv -%else -%if 0%{?rhel} >= 7 -Requires: python-virtualenv -BuildRequires: python-virtualenv -%endif # Requires for RHEL 7 -%endif # Requires for RHEL 8 - -# SUSE/openSUSE -%if 0%{?suse_version} -Requires: python-virtualenv -BuildRequires: python-virtualenv -%endif - -%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. - -This package installs the ansible-test command for testing modules and plugins -developed for ansible. - -%prep -%setup -q -n %{name}-%{upstream_version} - -%build -%if %{with_python2} -%py2_build -%endif - -%if %{with_python3} -%py3_build -%endif - -%install -%if %{with_python2} -%{__python2} setup.py install --root=%{buildroot} -for i in %{buildroot}/%{_bindir}/{ansible,ansible-console,ansible-doc,ansible-galaxy,ansible-playbook,ansible-pull,ansible-vault} ; do - mv $i $i-%{python2_version} - ln -s %{_bindir}/$(basename $i)-%{python2_version} $i - ln -s %{_bindir}/$(basename $i)-%{python2_version} $i-2 -done -%endif - -%if %{with_python3} -%{__python3} setup.py install --root=%{buildroot} -%endif - - -# Amazon Linux doesn't install to dist-packages but python_sitelib expands to -# that location and the python interpreter expects things to be there. -if expr x'%{python_sitelib}' : 'x.*dist-packages/\?' ; then - DEST_DIR='%{buildroot}%{python_sitelib}' - SOURCE_DIR=$(echo "$DEST_DIR" | sed 's/dist-packages/site-packages/g') - if test -d "$SOURCE_DIR" -a ! -d "$DEST_DIR" ; then - mv $SOURCE_DIR $DEST_DIR - fi -fi - -# Create system directories that Ansible defines as default locations in -# ansible/config/base.yml -DATADIR_LOCATIONS='%{_datadir}/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 %{buildroot}%{_datadir}/ansible/plugins/ -for location in $DATADIR_LOCATIONS ; do - mkdir %{buildroot}"$location" -done -mkdir -p %{buildroot}%{_sysconfdir}/ansible/ -mkdir -p %{buildroot}%{_sysconfdir}/ansible/roles/ - -cp examples/hosts %{buildroot}%{_sysconfdir}/ansible/ -cp examples/ansible.cfg %{buildroot}%{_sysconfdir}/ansible/ -mkdir -p %{buildroot}/%{_mandir}/man1/ -cp -v docs/man/man1/*.1 %{buildroot}/%{_mandir}/man1/ - -cp -pr docs/docsite/rst . - -%clean -rm -rf %{buildroot} - -%check -# We need pytest-4.5.0 or greater -%if 0%{?fedora} >= 31 -ln -s /usr/bin/pytest-3 bin/pytest -%{__python3} bin/ansible-test units -v --python %{python3_version} -%endif - -%files -%defattr(-,root,root) -%{_bindir}/ansible* -%exclude %{_bindir}/ansible-test -%config(noreplace) %{_sysconfdir}/ansible/ -%doc README.rst PKG-INFO COPYING changelogs/CHANGELOG*.rst -%doc %{_mandir}/man1/ansible* -%{_datadir}/ansible/ -%if %{with_python3} -%{python3_sitelib}/ansible* -%exclude %{python3_sitelib}/ansible_test -%endif -%if %{with_python2} -%{python2_sitelib}/ansible* -%exclude %{python2_sitelib}/ansible_test -%endif - -%files -n ansible-test -%{_bindir}/ansible-test -%if %{with_python3} -%{python3_sitelib}/ansible_test -%endif -%if %{with_python2} -%{python2_sitelib}/ansible_test -%endif - -%changelog - -* %{release_date} Ansible, Inc. - %{rpmversion}-%{rpmrelease} -- Release %{rpmversion}-%{rpmrelease}