[heat-cfntools/f20] Trim dependencies for cloud image

Jeff Peeler jpeeler at fedoraproject.org
Fri Aug 29 02:48:45 UTC 2014


commit 75f753b768c60f799876ddefddeacc0cf7e8dfc6
Author: Jeff Peeler <jpeeler at redhat.com>
Date:   Thu Aug 28 22:25:36 2014 -0400

    Trim dependencies for cloud image
    
    (backported patch from 1.2.8 release to replace wget with curl)
    
    Resolves: rhbz #1130964

 ...-to-curl-for-using-both-of-them-is-redund.patch |  165 ++++++++++++++++++++
 heat-cfntools.spec                                 |   12 +-
 2 files changed, 174 insertions(+), 3 deletions(-)
---
diff --git a/0001-Change-wget-to-curl-for-using-both-of-them-is-redund.patch b/0001-Change-wget-to-curl-for-using-both-of-them-is-redund.patch
new file mode 100644
index 0000000..e6a49a8
--- /dev/null
+++ b/0001-Change-wget-to-curl-for-using-both-of-them-is-redund.patch
@@ -0,0 +1,165 @@
+From 8ef88a6e864fa49cdc6dda9b1c701a29e0557253 Mon Sep 17 00:00:00 2001
+From: Yukinori Sagara <sagara177 at gmail.com>
+Date: Fri, 22 Aug 2014 18:30:37 +0900
+Subject: [PATCH] Change wget to curl for using both of them is redundant
+
+heat-cfntools depends on wget and curl. It's redundant.
+Since the curl is widely used, replace wget command to curl.
+
+Change-Id: I691bdc046bd72a44c11f25e359c5036ae1a9e86b
+Closes-Bug: 1359430
+---
+ heat_cfntools/cfntools/cfn_helper.py   | 16 ++++++++--------
+ heat_cfntools/tests/test_cfn_helper.py | 22 +++++++++++-----------
+ 2 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/heat_cfntools/cfntools/cfn_helper.py b/heat_cfntools/cfntools/cfn_helper.py
+index 6f7574b..3e55087 100644
+--- a/heat_cfntools/cfntools/cfn_helper.py
++++ b/heat_cfntools/cfntools/cfn_helper.py
+@@ -592,7 +592,7 @@ class FilesHandler(object):
+                     f.write(json.dumps(meta['content'], indent=4))
+                     f.close()
+             elif 'source' in meta:
+-                CommandRunner('wget -O %s %s' % (dest, meta['source'])).run()
++                CommandRunner('curl -o %s %s' % (dest, meta['source'])).run()
+             else:
+                 LOG.error('%s %s' % (dest, str(meta)))
+                 continue
+@@ -671,20 +671,20 @@ class SourcesHandler(object):
+         basename = os.path.basename(url)
+         stype = self._source_type(url)
+         if stype == '.tgz':
+-            cmd = "wget -q -O - '%s' | gunzip | tar -xvf -" % url
++            cmd = "curl -s '%s' | gunzip | tar -xvf -" % url
+         elif stype == '.tbz2':
+-            cmd = "wget -q -O - '%s' | bunzip2 | tar -xvf -" % url
++            cmd = "curl -s '%s' | bunzip2 | tar -xvf -" % url
+         elif stype == '.zip':
+             tmp = self._url_to_tmp_filename(url)
+-            cmd = "wget -q -O '%s' '%s' && unzip -o '%s'" % (tmp, url, tmp)
++            cmd = "curl -s -o '%s' '%s' && unzip -o '%s'" % (tmp, url, tmp)
+         elif stype == '.tar':
+-            cmd = "wget -q -O - '%s' | tar -xvf -" % url
++            cmd = "curl -s '%s' | tar -xvf -" % url
+         elif stype == '.gz':
+             (r, ext) = self._splitext(basename)
+-            cmd = "wget -q -O - '%s' | gunzip > '%s'" % (url, r)
++            cmd = "curl -s '%s' | gunzip > '%s'" % (url, r)
+         elif stype == '.bz2':
+             (r, ext) = self._splitext(basename)
+-            cmd = "wget -q -O - '%s' | bunzip2 > '%s'" % (url, r)
++            cmd = "curl -s '%s' | bunzip2 > '%s'" % (url, r)
+ 
+         if cmd != '':
+             cmd = "mkdir -p '%s'; cd '%s'; %s" % (dest, dest, cmd)
+@@ -1149,7 +1149,7 @@ class Metadata(object):
+ 
+         url = 'http://169.254.169.254/openstack/2012-08-10/meta_data.json'
+         if not os.path.exists(cache_path):
+-            CommandRunner('wget -O %s %s' % (cache_path, url)).run()
++            CommandRunner('curl -o %s %s' % (cache_path, url)).run()
+         try:
+             with open(cache_path) as fd:
+                 try:
+diff --git a/heat_cfntools/tests/test_cfn_helper.py b/heat_cfntools/tests/test_cfn_helper.py
+index e642e66..42fe7e2 100644
+--- a/heat_cfntools/tests/test_cfn_helper.py
++++ b/heat_cfntools/tests/test_cfn_helper.py
+@@ -1015,7 +1015,7 @@ class TestMetadataRetrieve(testtools.TestCase):
+ 
+             self.assertEqual(meta_in, meta_out)
+ 
+-    def test_nova_meta_wget(self):
++    def test_nova_meta_curl(self):
+         url = 'http://169.254.169.254/openstack/2012-08-10/meta_data.json'
+         temp_home = tempfile.mkdtemp()
+         cache_path = os.path.join(temp_home, 'meta_data.json')
+@@ -1045,7 +1045,7 @@ class TestMetadataRetrieve(testtools.TestCase):
+ 
+         self.m.StubOutWithMock(subprocess, 'Popen')
+         subprocess.Popen(['su', 'root', '-c',
+-                          'wget -O %s %s' % (cache_path, url)],
++                          'curl -o %s %s' % (cache_path, url)],
+                          cwd=None, env=None, stderr=-1, stdout=-1)\
+                   .WithSideEffects(write_cache_file)\
+                   .AndReturn(FakePOpen('Downloaded', '', 0))
+@@ -1057,7 +1057,7 @@ class TestMetadataRetrieve(testtools.TestCase):
+         self.assertEqual(meta_in, meta_out)
+         self.m.VerifyAll()
+ 
+-    def test_nova_meta_wget_corrupt(self):
++    def test_nova_meta_curl_corrupt(self):
+         url = 'http://169.254.169.254/openstack/2012-08-10/meta_data.json'
+         temp_home = tempfile.mkdtemp()
+         cache_path = os.path.join(temp_home, 'meta_data.json')
+@@ -1080,7 +1080,7 @@ class TestMetadataRetrieve(testtools.TestCase):
+ 
+         self.m.StubOutWithMock(subprocess, 'Popen')
+         subprocess.Popen(['su', 'root', '-c',
+-                          'wget -O %s %s' % (cache_path, url)],
++                          'curl -o %s %s' % (cache_path, url)],
+                          cwd=None, env=None, stderr=-1, stdout=-1)\
+                   .WithSideEffects(write_cache_file)\
+                   .AndReturn(FakePOpen('Downloaded', '', 0))
+@@ -1092,7 +1092,7 @@ class TestMetadataRetrieve(testtools.TestCase):
+         self.assertEqual(None, meta_out)
+         self.m.VerifyAll()
+ 
+-    def test_nova_meta_wget_failed(self):
++    def test_nova_meta_curl_failed(self):
+         url = 'http://169.254.169.254/openstack/2012-08-10/meta_data.json'
+         temp_home = tempfile.mkdtemp()
+         cache_path = os.path.join(temp_home, 'meta_data.json')
+@@ -1106,7 +1106,7 @@ class TestMetadataRetrieve(testtools.TestCase):
+ 
+         self.m.StubOutWithMock(subprocess, 'Popen')
+         subprocess.Popen(['su', 'root', '-c',
+-                          'wget -O %s %s' % (cache_path, url)],
++                          'curl -o %s %s' % (cache_path, url)],
+                          cwd=None, env=None, stderr=-1, stdout=-1)\
+                   .AndReturn(FakePOpen('Failed', '', 1))
+ 
+@@ -1230,10 +1230,10 @@ class TestSourcesHandler(MockPopenTestCase):
+         td = os.path.dirname(end_file)
+         self.m.StubOutWithMock(tempfile, 'mkdtemp')
+         tempfile.mkdtemp().AndReturn(td)
+-        er = "mkdir -p '%s'; cd '%s'; wget -q -O - '%s' | gunzip | tar -xvf -"
++        er = "mkdir -p '%s'; cd '%s'; curl -s '%s' | gunzip | tar -xvf -"
+         cmd = ['su', 'root', '-c',
+                er % (dest, dest, url)]
+-        self.mock_cmd_run(cmd).AndReturn(FakePOpen('Wget good'))
++        self.mock_cmd_run(cmd).AndReturn(FakePOpen('Curl good'))
+         self.m.ReplayAll()
+         sh = cfn_helper.SourcesHandler(sources)
+         sh.apply_sources()
+@@ -1254,7 +1254,7 @@ class TestSourcesHandler(MockPopenTestCase):
+ 
+     def test_apply_source_cmd(self):
+         sh = cfn_helper.SourcesHandler({})
+-        er = "mkdir -p '%s'; cd '%s'; wget -q -O - '%s' | %s | tar -xvf -"
++        er = "mkdir -p '%s'; cd '%s'; curl -s '%s' | %s | tar -xvf -"
+         dest = '/tmp'
+         # test tgz
+         url = 'http://www.example.com/a.tgz'
+@@ -1281,7 +1281,7 @@ class TestSourcesHandler(MockPopenTestCase):
+         cmd = sh._apply_source_cmd(dest, url)
+         self.assertEqual(er % (dest, dest, url, "bunzip2"), cmd)
+         # test zip
+-        er = "mkdir -p '%s'; cd '%s'; wget -q -O '%s' '%s' && unzip -o '%s'"
++        er = "mkdir -p '%s'; cd '%s'; curl -s -o '%s' '%s' && unzip -o '%s'"
+         url = 'http://www.example.com/a.zip'
+         d = "/tmp/tmp2I0yNK"
+         tmp = "%s/a.zip" % d
+@@ -1291,7 +1291,7 @@ class TestSourcesHandler(MockPopenTestCase):
+         cmd = sh._apply_source_cmd(dest, url)
+         self.assertEqual(er % (dest, dest, tmp, url, tmp), cmd)
+         # test gz
+-        er = "mkdir -p '%s'; cd '%s'; wget -q -O - '%s' | %s > '%s'"
++        er = "mkdir -p '%s'; cd '%s'; curl -s '%s' | %s > '%s'"
+         url = 'http://www.example.com/a.sh.gz'
+         cmd = sh._apply_source_cmd(dest, url)
+         self.assertEqual(er % (dest, dest, url, "gunzip", "a.sh"), cmd)
+-- 
+1.9.3
+
diff --git a/heat-cfntools.spec b/heat-cfntools.spec
index 0c2a565..09c9e06 100644
--- a/heat-cfntools.spec
+++ b/heat-cfntools.spec
@@ -1,6 +1,6 @@
 Name: heat-cfntools
 Version: 1.2.6
-Release: 3%{?dist}
+Release: 4%{?dist}
 Summary: Tools required to be installed on Heat provisioned cloud instances
 Group: System Environment/Base
 License: ASL 2.0
@@ -22,18 +22,20 @@ Requires: coreutils
 Requires: curl
 Requires: gzip
 Requires: python-setuptools
-Requires: rubygems
 Requires: shadow-utils
 Requires: tar
-Requires: wget
 Requires: yum
 
+Patch1: 0001-Change-wget-to-curl-for-using-both-of-them-is-redund.patch
+
 %description
 Tools required to be installed on Heat provisioned cloud instances
 
 %prep
 %setup -q
 
+%patch1 -p1
+
 %build
 %{__python} setup.py build
 
@@ -48,6 +50,10 @@ mkdir -p %{buildroot}/%{_sharedstatedir}/%{name}
 %dir %{_sharedstatedir}/%{name}
 
 %changelog
+* Thu Aug 28 2014 Jeff Peeler <jpeeler at redhat.com> 1.2.6-4
+- add patch to remove wget dependency
+- remove ruby dependency as it's too big for non-ruby users
+
 * Tue Aug 19 2014 Jeff Peeler <jpeeler at redhat.com> 1.2.6-3
 - fix dependencies to include external commands (rhbz#1130964)
 


More information about the scm-commits mailing list