summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-09-09 15:51:25 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-09-09 17:13:22 +0530
commit589de4db79fd3fc98db9164f60de8aed2af3d65b (patch)
tree07ee435082aa4ef8a8f555106399a3fe2d30bc94
parent48debb45c5761241d05984d9343ed8be298b5bbf (diff)
cerbero: Run download tool outside of the build env
When we run from inside the build env, LD_LIBRARY_PATH is set to point to the cerbero prefix, which contains an old version of GnuTLS. This is no longer possible in master because we no longer set the build env in `os.environ` there. Fixes: wget: [...]/dist/linux_x86_64/lib/libgnutls.so.30: version `GNUTLS_3_6_3' not found (required by wget) Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/596>
-rw-r--r--cerbero/build/source.py3
-rw-r--r--cerbero/commands/cache.py8
-rw-r--r--cerbero/utils/shell.py14
3 files changed, 13 insertions, 12 deletions
diff --git a/cerbero/build/source.py b/cerbero/build/source.py
index aa40bb29..7a988ee6 100644
--- a/cerbero/build/source.py
+++ b/cerbero/build/source.py
@@ -185,7 +185,8 @@ class BaseTarball(object):
cc = self.config.platform == Platform.LINUX
shell.download(self.url, self.download_path, check_cert=cc,
overwrite=redownload, logfile=get_logfile(self),
- mirrors= self.config.extra_mirrors + DEFAULT_MIRRORS)
+ mirrors= self.config.extra_mirrors + DEFAULT_MIRRORS,
+ env=self.config._pre_environ)
self.verify()
@staticmethod
diff --git a/cerbero/commands/cache.py b/cerbero/commands/cache.py
index 5cd14f5c..bbd4b60c 100644
--- a/cerbero/commands/cache.py
+++ b/cerbero/commands/cache.py
@@ -57,12 +57,12 @@ class BaseCache(Command):
git_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
return git.get_hash(git_dir, args.commit)
- def json_get(self, url):
+ def json_get(self, url, config):
m.message("GET %s" % url)
tmpdir = tempfile.mkdtemp()
tmpfile = os.path.join(tmpdir, 'deps.json')
- shell.download(url, destination=tmpfile)
+ shell.download(url, destination=tmpfile, env=config._pre_environ)
with open(tmpfile, 'r') as f:
resp = f.read()
@@ -92,7 +92,7 @@ class BaseCache(Command):
deps = []
try:
- deps = self.json_get(url)
+ deps = self.json_get(url, config)
except FatalError as e:
m.warning("Could not get cache list: %s" % e.msg)
@@ -130,7 +130,7 @@ class FetchCache(BaseCache):
def fetch_dep(self, config, dep, namespace):
try:
dep_path = os.path.join(config.home_dir, os.path.basename(dep['url']))
- shell.download(dep['url'], dep_path, check_cert=True, overwrite=True)
+ shell.download(dep['url'], dep_path, check_cert=True, overwrite=True, env=config._pre_environ)
if dep['checksum'] == self.checksum(dep_path):
shell.unpack(dep_path, config.home_dir)
else:
diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py
index 2f38c7bc..f382974d 100644
--- a/cerbero/utils/shell.py
+++ b/cerbero/utils/shell.py
@@ -317,7 +317,7 @@ def unpack(filepath, output_dir, logfile=None):
else:
raise FatalError("Unknown tarball format %s" % filepath)
-def download_wget(url, destination=None, check_cert=True, overwrite=False):
+def download_wget(url, destination=None, check_cert=True, overwrite=False, env=None):
'''
Downloads a file with wget
@@ -339,13 +339,13 @@ def download_wget(url, destination=None, check_cert=True, overwrite=False):
cmd += " --progress=dot:giga"
try:
- call(cmd, path)
+ call(cmd, path, env=env)
except FatalError as e:
if os.path.exists(destination):
os.remove(destination)
raise e
-def download_urllib2(url, destination=None, check_cert=True, overwrite=False):
+def download_urllib2(url, destination=None, check_cert=True, overwrite=False, env=None):
'''
Download a file with urllib2, which does not rely on external programs
@@ -376,7 +376,7 @@ def download_urllib2(url, destination=None, check_cert=True, overwrite=False):
os.remove(destination)
raise e
-def download_curl(url, destination=None, check_cert=True, overwrite=False):
+def download_curl(url, destination=None, check_cert=True, overwrite=False, env=None):
'''
Downloads a file with cURL
@@ -394,13 +394,13 @@ def download_curl(url, destination=None, check_cert=True, overwrite=False):
else:
cmd += "-O %s " % url
try:
- call(cmd, path)
+ call(cmd, path, env=env)
except FatalError as e:
if os.path.exists(destination):
os.remove(destination)
raise e
-def download(url, destination=None, check_cert=True, overwrite=False, logfile=None, mirrors=None):
+def download(url, destination=None, check_cert=True, overwrite=False, logfile=None, mirrors=None, env=None):
'''
Downloads a file
@@ -450,7 +450,7 @@ def download(url, destination=None, check_cert=True, overwrite=False, logfile=No
errors = []
for murl in urls:
try:
- return download_func(murl, destination, check_cert, overwrite)
+ return download_func(murl, destination, check_cert, overwrite, env)
except Exception as ex:
errors.append((murl, ex))
if len(errors) == 1: