[ansible/el6] Fix ansible-vault for newer python-crypto dependency

Toshio くらとみ toshio at fedoraproject.org
Sat Mar 15 04:49:55 UTC 2014


commit 2c0e80e17137296f3618dc2e88bf06dfabfe07a0
Author: Toshio Kuratomi <toshio at fedoraproject.org>
Date:   Fri Mar 14 21:49:40 2014 -0700

    Fix ansible-vault for newer python-crypto dependency

 ...ols-to-get-a-recent-enough-version-of-pyt.patch |   56 ++++++++++++++++++++
 ansible.spec                                       |   24 ++++++++-
 2 files changed, 78 insertions(+), 2 deletions(-)
---
diff --git a/0001-Use-setuptools-to-get-a-recent-enough-version-of-pyt.patch b/0001-Use-setuptools-to-get-a-recent-enough-version-of-pyt.patch
new file mode 100644
index 0000000..9a658d3
--- /dev/null
+++ b/0001-Use-setuptools-to-get-a-recent-enough-version-of-pyt.patch
@@ -0,0 +1,56 @@
+From 02519a2a77e7d88c32fb3f3b4db7c6cb20da7006 Mon Sep 17 00:00:00 2001
+From: Toshio Kuratomi <toshio at fedoraproject.org>
+Date: Fri, 14 Mar 2014 13:16:04 -0700
+Subject: [PATCH] Use setuptools to get a recent enough version of
+ python-crypto2.6
+
+---
+ bin/ansible-playbook | 3 +++
+ bin/ansible-vault    | 3 +++
+ setup.py             | 2 +-
+ 3 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/bin/ansible-playbook b/bin/ansible-playbook
+index 5aa020a..a8ada00 100755
+--- a/bin/ansible-playbook
++++ b/bin/ansible-playbook
+@@ -18,6 +18,9 @@
+ 
+ #######################################################
+ 
++__requires__ = ['pycrypto >= 2.6']
++import pkg_resources
++
+ import sys
+ import os
+ import stat
+diff --git a/bin/ansible-vault b/bin/ansible-vault
+index 2c8094d..b0a9926 100755
+--- a/bin/ansible-vault
++++ b/bin/ansible-vault
+@@ -20,6 +20,9 @@
+ # example playbook to bootstrap this script in the examples/ dir which
+ # installs ansible and sets it up to run on cron.
+ 
++__requires__ = ['pycrypto >= 2.6']
++import pkg_resources
++
+ import os
+ import sys
+ import traceback
+diff --git a/setup.py b/setup.py
+index c537ee9..34425e1 100644
+--- a/setup.py
++++ b/setup.py
+@@ -29,7 +29,7 @@ setup(name='ansible',
+       author_email='michael at ansible.com',
+       url='http://ansible.com/',
+       license='GPLv3',
+-      install_requires=['paramiko', 'jinja2', "PyYAML"],
++      install_requires=['paramiko', 'jinja2', "PyYAML", 'setuptools', 'pycrypto >= 2.6'],
+       package_dir={ 'ansible': 'lib/ansible' },
+       packages=[
+          'ansible',
+-- 
+1.8.5.3
+
diff --git a/ansible.spec b/ansible.spec
index fbcf1ce..6315810 100644
--- a/ansible.spec
+++ b/ansible.spec
@@ -9,12 +9,15 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
 
 Name: ansible
 Summary: SSH-based configuration management, deployment, and task execution system
-Version: 1.5
+Version: 1.5.3
 Release: 1%{?dist}
 
 Group: Development/Libraries
 License: GPLv3
 Source0: http://releases.ansible.com/ansible/%{name}-%{version}.tar.gz
+# Patch to make ansible-vault use the forward-compat python-crypto2.6 package
+# Upstreamed here: https://github.com/ansible/ansible/pull/6498
+Patch0: 0001-Use-setuptools-to-get-a-recent-enough-version-of-pyt.patch
 Url: http://ansible.com
 
 BuildArch: noarch
@@ -36,6 +39,15 @@ Requires: python-keyczar
 Requires: python-httplib2
 %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
+%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
@@ -55,11 +67,16 @@ are transferred to managed machines automatically.
 %prep
 %setup -q
 
+%if 0%{?rhel} == 6
+# Patch to make ansible-vault use a newer pycrypto forward-compat package
+%patch0 -p1
+%endif
+
 %build
 %{__python} setup.py build
 
 %install
-%{__python} setup.py install -O1 --root=$RPM_BUILD_ROOT
+%{__python} setup.py install --root=$RPM_BUILD_ROOT
 mkdir -p $RPM_BUILD_ROOT/etc/ansible/
 cp examples/hosts $RPM_BUILD_ROOT/etc/ansible/
 cp examples/ansible.cfg $RPM_BUILD_ROOT/etc/ansible/
@@ -82,6 +99,9 @@ rm -rf $RPM_BUILD_ROOT
 %doc examples/playbooks
 
 %changelog
+* Wed Mar 12 2014 Toshio Kuratomi <toshio at fedoraproject.org> - 1.5.3-1
+- Fix ansible-vault for newer python-crypto dependency
+
 * Fri Feb 28 2014 Kevin Fenzi <kevin at scrye.com> 1.5-1
 - Update to 1.5
 


More information about the scm-commits mailing list