%global dlrn_nvr ansible-2.7.0.dev0-0.1.20180628220140.8876416 %global dlrn 1 %define upstream_version 2.7.0.dev0 %if !0%{?dlrn} %global upstream_version %version %endif # RHEL 6 didn't have a __python2 macro. # Amazon Linux 2015.9 is based on RHEL6, with /usr/bin/python2 -> python2.6, while # /usr/bin/python -> python2.7. Explicitly use python2.6. %if 0%{?rhel} == 6 || 0%{?rhel} == 5 %global __python2 /usr/bin/python2.6 %endif %if 0%{?rhel} <= 5 %endif %if (0%{?fedora} || 0%{?rhel} >= 8) && !0%{?dlrn} %global with_docs 1 %else %global with_docs 0 %endif %if 0%{?fedora} || 0%{?rhel} >= 8 %global with_python3 1 %else %global with_python3 0 %endif %{!?python_sitelib: %global python_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} Name: ansible Summary: SSH-based configuration management, deployment, and task execution system Version: 2.7.0 Release: 0.1.20180628220140.8876416%{?dist} Group: Development/Libraries License: GPLv3+ Source0: ansible-2.7.0.dev0-0.1.20180628220140.8876416.tar.gz # Patch to utilize a newer jinja2 package on epel6 # Non-upstreamable as it creates a dependency on a specific version of jinja. # This is desirable for us as we have packages for that version but not for # upstream as they don't know what their customers are running. Patch100: ansible-newer-jinja.patch # temprary patches for dlrn packaging (devel branch) #Patch1001: ansible-mock-ncclient-import.patch Url: http://ansible.com BuildArch: noarch %if 0%{?rhel} && 0%{?rhel} <= 5 # On RHEL6 use the python26 stack BuildRequires: python26-devel Requires: python26-PyYAML Requires: python26-paramiko Requires: python26-jinja2 %endif # for the netconf module Requires: python-ncclient BuildRequires: python2-devel BuildRequires: python-setuptools # For building docs BuildRequires: python-sphinx # For tests # We don't run tests on epel6, so don't bother pulling these in there. %if (0%{?fedora} || 0%{?rhel} > 6) BuildRequires: which BuildRequires: PyYAML BuildRequires: python-boto BuildRequires: python-netaddr BuildRequires: python-crypto BuildRequires: python-paramiko BuildRequires: python-keyczar BuildRequires: python-six BuildRequires: python-nose BuildRequires: python-coverage BuildRequires: python-mock BuildRequires: python-boto3 BuildRequires: python-botocore BuildRequires: python-passlib BuildRequires: python-lxml #BuildRequires: python-xmljson BuildRequires: python-requests # for the netconf module BuildRequires: python-ncclient # rhel7 does not have python-pytest but has pytest %if 0%{?rhel} == 7 BuildRequires: pytest #BuildRequires: python-pytest-xdist #BuildRequires: python-pytest-mock %else BuildRequires: python-pytest BuildRequires: python-attrs BuildRequires: python-pluggy BuildRequires: python-pytest-xdist BuildRequires: python-pytest-mock %endif %endif %if (0%{?rhel} && 0%{?rhel} <= 6) # Ansible will work with the jinja2 shipped with RHEL6 but users can gain # additional jinja features by using the newer version Requires: python-jinja2-26 BuildRequires: python-jinja2-26 # Distros with python < 2.7.0 BuildRequires: python-unittest2 %else Requires: python-jinja2 BuildRequires: python-jinja2 %endif Requires: PyYAML Requires: python-crypto Requires: python-paramiko Requires: python-keyczar Requires: python-httplib2 Requires: python-setuptools Requires: python-six Requires: sshpass %if (0%{?fedora} || 0%{?rhel} > 6) # needed for json_query filter # but avoid on rhel6 due to amazon linux conflicts Requires: python2-jmespath %endif %if 0%{?rhel} == 6 # RHEL 6 needs a newer version of the pycrypto library for the ansible-vault # command. Note: If other pieces of ansible also grow to need pycrypto you may # need to add: Requires: python-crypto or patch the other pieces of ansible to # make use of this forward compat package (see the patch for ansible-vault # above to see what needs to be done.) Requires: python-crypto2.6 # The python-2.6 stdlib json module has a bug that affects the ansible # to_nice_json filter Requires: python-simplejson # For testing BuildRequires: python-crypto2.6 BuildRequires: python-simplejson %endif # # This is needed to update the old ansible-firewall package that is no # longer needed. Note that you should also remove ansible-node-firewall manually # Where you still have it installed. # Provides: ansible-fireball = %{version}-%{release} Obsoletes: ansible-fireball < 1.2.4 %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. %if 0%{?with_python3} # Note, ansible is not intended to be used as a library so avoiding the # python3-ansible and python2-ansible package names so we don't confuse users. # Also note, similarly to dnf in its transition period, the python2 and python3 # versions of ansible should behave identically but python3-only bugs may be present. # So upstream would like us to ship both py2 and py3 ansible (at least in # rawhide) for people to beat on and find bugs. %package -n ansible-python3 Summary: SSH-based configuration management, deployment, and task execution system BuildRequires: python3-devel BuildRequires: python3-setuptools # For tests BuildRequires: python3-PyYAML BuildRequires: python3-paramiko BuildRequires: python3-crypto # accelerate is the only thing that makes keyczar mandatory. Since accelerate # is deprecated, just ignore it #BuildRequires: python-keyczar BuildRequires: python3-six BuildRequires: python3-nose BuildRequires: python3-pluggy BuildRequires: python3-attrs BuildRequires: python3-pytest BuildRequires: python3-pytest-xdist BuildRequires: python3-pytest-mock BuildRequires: python3-coverage BuildRequires: python3-mock BuildRequires: python3-boto3 BuildRequires: python3-botocore BuildRequires: python3-passlib BuildRequires: python3-jinja2 BuildRequires: python3-requests Requires: python3-PyYAML Requires: python3-paramiko Requires: python3-crypto # 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: sshpass # needed for json_query filter Requires: python3-jmespath %endif %if 0%{?with_python3} %description -n ansible-python3 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 versions of ansible that execute on Python3. %endif # with_python3 %package -n ansible-doc Summary: Documentation for Ansible %description -n ansible-doc 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 extensive documentation for ansible %prep %setup -q -n %name-%upstream_version echo 0%{?fedora} 0%{?rhel} 0%{?with_python3} %if 0%{?rhel} == 6 %patch100 -p1 %endif # temporary patches for DLRN #%patch1001 -p1 %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif # with_python3 %build %{__python2} setup.py build # Build docs # EPEL6/7 don't have a recent enough sphinx to build the docs %if %with_docs make webdocs %endif %if 0%{?with_python3} pushd %{py3dir} %py3_build popd %endif # with_python3 %install %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --root=$RPM_BUILD_ROOT popd for i in $RPM_BUILD_ROOT/%{_bindir}/ansible* ; do if [ $(basename $i) = "ansible-connection" -o $(basename $i) = "ansible" ] ; then mv $i $i-%{python3_version} ln -s %{_bindir}/$(basename $i)-%{python3_version} $i-3 else # The ansible commands are themselves symlinks to /usr/bin/ansible. # Need to change them to point to the python3 version ln -s %{_bindir}/ansible-3 $i-%{python3_version} ln -s %{_bindir}/$(basename $i)-%{python3_version} $i-3 fi done %endif # with_python3 %{__python2} setup.py install --root=$RPM_BUILD_ROOT for i in $RPM_BUILD_ROOT/%{_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 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/ %if %with_docs mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1 cp -v docs/man/man1/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1/ %endif cp -pr docs/docsite/rst . %if %with_docs cp -pr docs/docsite/_build/html . %endif %check # RHEL <= 6 doesn't have a new enough python-mock to run the tests # Currently RHEL <= 7 doesn't have pytest-xdist or a new enough pytest # Fedora 25 doesn't have a new enough pytest %if 0%{?fedora} >= 26 || 0%{?rhel} >= 8 if test -z $(which pytest) ; then mkdir tests_bin pushd tests_bin ln -s `which py.test` pytest export PATH=$PATH:$(pwd) popd fi make tests %if 0%{?with_python3} pushd %{py3dir} if test -z $(which pytest) ; then mkdir tests_bin pushd tests_bin ln -s `which py.test` pytest export PATH=$PATH:$(pwd) popd fi make tests-py3 %endif # python3 %endif # New enough Fedora/RHEL %files %defattr(-,root,root) %{python_sitelib}/ansible* %{_bindir}/ansible* %if 0%{?with_python3} %exclude %{_bindir}/ansible*-3* %endif # python3 %config(noreplace) %{_sysconfdir}/ansible/ %doc README.rst PKG-INFO COPYING %if %with_docs %doc %{_mandir}/man1/ansible* %endif %if 0%{?with_python3} %files -n ansible-python3 %defattr(-,root,root,-) %{python3_sitelib}/ansible* %{_bindir}/ansible*-3* %config(noreplace) %{_sysconfdir}/ansible/ %doc README.rst PKG-INFO COPYING %if %with_docs %doc %{_mandir}/man1/ansible* %endif %endif # python3 %files -n ansible-doc %doc rst %if %with_docs %doc html %endif %changelog