[oe-commits] Stefan Stanacar : oeqa/utils: targetbuild: take proxy into account

git at git.openembedded.org git at git.openembedded.org
Tue Feb 11 11:57:05 UTC 2014


Module: openembedded-core.git
Branch: master-next
Commit: 97e263b99cbe8184a74f80738fd471cfdef29e0c
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=97e263b99cbe8184a74f80738fd471cfdef29e0c

Author: Stefan Stanacar <stefanx.stanacar at intel.com>
Date:   Sun Feb  9 12:39:30 2014 +0200

oeqa/utils: targetbuild: take proxy into account

A previous commit broke downloads
when proxies are involved, let's fix it.

Signed-off-by: Stefan Stanacar <stefanx.stanacar at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oeqa/runtime/buildcvs.py      |  2 +-
 meta/lib/oeqa/runtime/buildiptables.py |  2 +-
 meta/lib/oeqa/runtime/buildsudoku.py   |  2 +-
 meta/lib/oeqa/utils/targetbuild.py     | 20 ++++++++++++++++++--
 4 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oeqa/runtime/buildcvs.py b/meta/lib/oeqa/runtime/buildcvs.py
index 9bf764d..f1fbf19 100644
--- a/meta/lib/oeqa/runtime/buildcvs.py
+++ b/meta/lib/oeqa/runtime/buildcvs.py
@@ -10,7 +10,7 @@ class BuildCvsTest(oeRuntimeTest):
 
     @classmethod
     def setUpClass(self):
-        self.project = TargetBuildProject(oeRuntimeTest.tc.target,
+        self.project = TargetBuildProject(oeRuntimeTest.tc.target, oeRuntimeTest.tc.d,
                         "http://ftp.gnu.org/non-gnu/cvs/source/feature/1.12.13/cvs-1.12.13.tar.bz2")
         self.project.download_archive()
 
diff --git a/meta/lib/oeqa/runtime/buildiptables.py b/meta/lib/oeqa/runtime/buildiptables.py
index 50faf5d..f6061a7 100644
--- a/meta/lib/oeqa/runtime/buildiptables.py
+++ b/meta/lib/oeqa/runtime/buildiptables.py
@@ -10,7 +10,7 @@ class BuildIptablesTest(oeRuntimeTest):
 
     @classmethod
     def setUpClass(self):
-        self.project = TargetBuildProject(oeRuntimeTest.tc.target,
+        self.project = TargetBuildProject(oeRuntimeTest.tc.target, oeRuntimeTest.tc.d,
                         "http://netfilter.org/projects/iptables/files/iptables-1.4.13.tar.bz2")
         self.project.download_archive()
 
diff --git a/meta/lib/oeqa/runtime/buildsudoku.py b/meta/lib/oeqa/runtime/buildsudoku.py
index 61dc1ff..a754f1d 100644
--- a/meta/lib/oeqa/runtime/buildsudoku.py
+++ b/meta/lib/oeqa/runtime/buildsudoku.py
@@ -10,7 +10,7 @@ class SudokuTest(oeRuntimeTest):
 
     @classmethod
     def setUpClass(self):
-        self.project = TargetBuildProject(oeRuntimeTest.tc.target,
+        self.project = TargetBuildProject(oeRuntimeTest.tc.target, oeRuntimeTest.tc.d,
                         "http://downloads.sourceforge.net/project/sudoku-savant/sudoku-savant/sudoku-savant-1.3/sudoku-savant-1.3.tar.bz2")
         self.project.download_archive()
 
diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py
index 77181b1..3229676 100644
--- a/meta/lib/oeqa/utils/targetbuild.py
+++ b/meta/lib/oeqa/utils/targetbuild.py
@@ -11,8 +11,9 @@ import subprocess
 
 class TargetBuildProject():
 
-    def __init__(self, target, uri, foldername=None):
+    def __init__(self, target, d, uri, foldername=None):
         self.target = target
+        self.d = d
         self.uri = uri
         self.targetdir = "~/"
         self.archive = os.path.basename(uri)
@@ -23,7 +24,22 @@ class TargetBuildProject():
 
     def download_archive(self):
 
-        subprocess.check_call("wget -O %s %s" % (self.localarchive, self.uri), shell=True)
+        exportvars = ['HTTP_PROXY', 'http_proxy',
+                      'HTTPS_PROXY', 'https_proxy',
+                      'FTP_PROXY', 'ftp_proxy',
+                      'FTPS_PROXY', 'ftps_proxy',
+                      'NO_PROXY', 'no_proxy',
+                      'ALL_PROXY', 'all_proxy',
+                      'SOCKS5_USER', 'SOCKS5_PASSWD']
+
+        cmd = ''
+        for var in exportvars:
+            val = self.d.getVar(var, True)
+            if val:
+                cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd)
+
+        cmd = cmd + "wget -O %s %s" % (self.localarchive, self.uri)
+        subprocess.check_call(cmd, shell=True)
 
         (status, output) = self.target.copy_to(self.localarchive, self.targetdir)
         if status != 0:



More information about the Openembedded-commits mailing list