[bitbake-devel] [PATCH] fetch2: save/restore cwd for mirror URL downloads
Matt Madison
matt at madison.systems
Mon Aug 8 22:43:43 UTC 2016
Fixes "changed cwd" warnings from setscene tasks when the
packages are downloaded from a shared-state mirror.
Signed-off-by: Matt Madison <matt at madison.systems>
---
lib/bb/fetch2/__init__.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 9054b2e..c0017a8 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -928,6 +928,8 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
if ud.lockfile and ud.lockfile != origud.lockfile:
lf = bb.utils.lockfile(ud.lockfile)
+ save_cwd = os.getcwd()
+
try:
if check:
found = ud.method.checkstatus(fetch, ud, ld)
@@ -995,6 +997,7 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
pass
return False
finally:
+ os.chdir(save_cwd)
if ud.lockfile and ud.lockfile != origud.lockfile:
bb.utils.unlockfile(lf)
@@ -1558,6 +1561,7 @@ class Fetch(object):
network = self.d.getVar("BB_NO_NETWORK", True)
premirroronly = (self.d.getVar("BB_FETCH_PREMIRRORONLY", True) == "1")
+ save_cwd = os.getcwd()
for u in urls:
ud = self.ud[u]
@@ -1635,6 +1639,7 @@ class Fetch(object):
finally:
if ud.lockfile:
bb.utils.unlockfile(lf)
+ os.chdir(save_cwd)
def checkstatus(self, urls=None):
"""
--
2.7.4
More information about the bitbake-devel
mailing list