summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-20 12:40:02 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-21 11:35:07 +0100
commitea032bb2c3b18c50ab3fa9dd6dfd2ca9adaba8bc (patch)
treecaac35efa31d5c7cb93f7885162f2c3655941639 /bitbake
parent4bfb54e0ba03bbb19511158bbe68c08782b76bea (diff)
downloadpoky-ea032bb2c3b18c50ab3fa9dd6dfd2ca9adaba8bc.tar.gz
bitbake: fetch2: Ensure when downloading we are consistently in the same directory
This assists with build reproducuility. It also avoids errors if cwd happens not to exist when we call into the fetcher. That situation would be unusual but I hit it with the unit tests. (From Poky rev: 86517af9e066c2da1d580fa66b7c7f0340f3403e) (Bitbake rev: b886c6c15a58643e06ca5ad7a3ff1f7766e4f48c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 2ae8185601..5c8652fc3a 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -471,6 +471,8 @@ def try_mirrors(d, origud, mirrors, check = False):
471 ud = FetchData(newuri, ld) 471 ud = FetchData(newuri, ld)
472 ud.setup_localpath(ld) 472 ud.setup_localpath(ld)
473 473
474 os.chdir(ld.getVar("DL_DIR", True))
475
474 if check: 476 if check:
475 found = ud.method.checkstatus(newuri, ud, ld) 477 found = ud.method.checkstatus(newuri, ud, ld)
476 if found: 478 if found:
@@ -965,6 +967,8 @@ class Fetch(object):
965 if premirroronly: 967 if premirroronly:
966 self.d.setVar("BB_NO_NETWORK", "1") 968 self.d.setVar("BB_NO_NETWORK", "1")
967 969
970 os.chdir(self.d.getVar("DL_DIR", True))
971
968 firsterr = None 972 firsterr = None
969 if not localpath and ((not os.path.exists(ud.donestamp)) or m.need_update(u, ud, self.d)): 973 if not localpath and ((not os.path.exists(ud.donestamp)) or m.need_update(u, ud, self.d)):
970 try: 974 try:
@@ -1024,7 +1028,7 @@ class Fetch(object):
1024 except: 1028 except:
1025 # Finally, try checking uri, u, from MIRRORS 1029 # Finally, try checking uri, u, from MIRRORS
1026 mirrors = mirror_from_string(self.d.getVar('MIRRORS', True)) 1030 mirrors = mirror_from_string(self.d.getVar('MIRRORS', True))
1027 ret = try_mirrors (self.d, ud, mirrors, True) 1031 ret = try_mirrors(self.d, ud, mirrors, True)
1028 1032
1029 if not ret: 1033 if not ret:
1030 raise FetchError("URL %s doesn't work" % u, u) 1034 raise FetchError("URL %s doesn't work" % u, u)