diff options
Diffstat (limited to 'meta/lib/oeqa/utils/buildproject.py')
-rw-r--r-- | meta/lib/oeqa/utils/buildproject.py | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/meta/lib/oeqa/utils/buildproject.py b/meta/lib/oeqa/utils/buildproject.py index 1ed9624a76..386a927881 100644 --- a/meta/lib/oeqa/utils/buildproject.py +++ b/meta/lib/oeqa/utils/buildproject.py | |||
@@ -6,17 +6,17 @@ | |||
6 | 6 | ||
7 | import os | 7 | import os |
8 | import re | 8 | import re |
9 | import bb.utils | ||
10 | import subprocess | 9 | import subprocess |
10 | import shutil | ||
11 | |||
11 | from abc import ABCMeta, abstractmethod | 12 | from abc import ABCMeta, abstractmethod |
12 | 13 | ||
13 | class BuildProject(metaclass=ABCMeta): | 14 | class BuildProject(metaclass=ABCMeta): |
14 | 15 | def __init__(self, uri, foldername=None, tmpdir="/tmp/", dl_dir=None): | |
15 | def __init__(self, d, uri, foldername=None, tmpdir="/tmp/"): | ||
16 | self.d = d | ||
17 | self.uri = uri | 16 | self.uri = uri |
18 | self.archive = os.path.basename(uri) | 17 | self.archive = os.path.basename(uri) |
19 | self.localarchive = os.path.join(tmpdir,self.archive) | 18 | self.localarchive = os.path.join(tmpdir,self.archive) |
19 | self.dl_dir = dl_dir | ||
20 | if foldername: | 20 | if foldername: |
21 | self.fname = foldername | 21 | self.fname = foldername |
22 | else: | 22 | else: |
@@ -24,27 +24,11 @@ class BuildProject(metaclass=ABCMeta): | |||
24 | 24 | ||
25 | # Download self.archive to self.localarchive | 25 | # Download self.archive to self.localarchive |
26 | def _download_archive(self): | 26 | def _download_archive(self): |
27 | 27 | if self.dl_dir and os.path.exists(os.path.join(self.dl_dir, self.archive)): | |
28 | dl_dir = self.d.getVar("DL_DIR") | 28 | shutil.copyfile(os.path.join(self.dl_dir, self.archive), self.localarchive) |
29 | if dl_dir and os.path.exists(os.path.join(dl_dir, self.archive)): | ||
30 | bb.utils.copyfile(os.path.join(dl_dir, self.archive), self.localarchive) | ||
31 | return | 29 | return |
32 | 30 | ||
33 | exportvars = ['HTTP_PROXY', 'http_proxy', | 31 | cmd = "wget -O %s %s" % (self.localarchive, self.uri) |
34 | 'HTTPS_PROXY', 'https_proxy', | ||
35 | 'FTP_PROXY', 'ftp_proxy', | ||
36 | 'FTPS_PROXY', 'ftps_proxy', | ||
37 | 'NO_PROXY', 'no_proxy', | ||
38 | 'ALL_PROXY', 'all_proxy', | ||
39 | 'SOCKS5_USER', 'SOCKS5_PASSWD'] | ||
40 | |||
41 | cmd = '' | ||
42 | for var in exportvars: | ||
43 | val = self.d.getVar(var) | ||
44 | if val: | ||
45 | cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) | ||
46 | |||
47 | cmd = cmd + "wget -O %s %s" % (self.localarchive, self.uri) | ||
48 | subprocess.check_call(cmd, shell=True) | 32 | subprocess.check_call(cmd, shell=True) |
49 | 33 | ||
50 | # This method should provide a way to run a command in the desired environment. | 34 | # This method should provide a way to run a command in the desired environment. |
@@ -66,4 +50,3 @@ class BuildProject(metaclass=ABCMeta): | |||
66 | def clean(self): | 50 | def clean(self): |
67 | self._run('rm -rf %s' % self.targetdir) | 51 | self._run('rm -rf %s' % self.targetdir) |
68 | subprocess.call('rm -f %s' % self.localarchive, shell=True) | 52 | subprocess.call('rm -f %s' % self.localarchive, shell=True) |
69 | pass | ||