summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/repo.py
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2016-08-10 10:08:16 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-20 16:08:59 +0100
commitab09541d5517da9b1a23923ea8f5c26ddf745084 (patch)
treeb0b81a809ec783b7481c012b430b9f6618e87a73 /bitbake/lib/bb/fetch2/repo.py
parenteefb4b66c8628fbf366ebc5c23cfe013c8fa3756 (diff)
downloadpoky-ab09541d5517da9b1a23923ea8f5c26ddf745084.tar.gz
bitbake: fetch2: preserve current working directory
Fix the methods in all fetchers so they don't change the current working directory of the calling process, which could lead to "changed cwd" warnings from bitbake. (Bitbake rev: 6aa78bf3bd1f75728209e2d01faef31cb8887333) Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/repo.py')
-rw-r--r--bitbake/lib/bb/fetch2/repo.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py
index fd64b7e626..ecc6e68e97 100644
--- a/bitbake/lib/bb/fetch2/repo.py
+++ b/bitbake/lib/bb/fetch2/repo.py
@@ -69,15 +69,14 @@ class Repo(FetchMethod):
69 else: 69 else:
70 username = "" 70 username = ""
71 71
72 bb.utils.mkdirhier(os.path.join(codir, "repo")) 72 repodir = os.path.join(codir, "repo")
73 os.chdir(os.path.join(codir, "repo")) 73 bb.utils.mkdirhier(repodir)
74 if not os.path.exists(os.path.join(codir, "repo", ".repo")): 74 if not os.path.exists(os.path.join(repodir, ".repo")):
75 bb.fetch2.check_network_access(d, "repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url) 75 bb.fetch2.check_network_access(d, "repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url)
76 runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d) 76 runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d, workdir=repodir)
77 77
78 bb.fetch2.check_network_access(d, "repo sync %s" % ud.url, ud.url) 78 bb.fetch2.check_network_access(d, "repo sync %s" % ud.url, ud.url)
79 runfetchcmd("repo sync", d) 79 runfetchcmd("repo sync", d, workdir=repodir)
80 os.chdir(codir)
81 80
82 scmdata = ud.parm.get("scmdata", "") 81 scmdata = ud.parm.get("scmdata", "")
83 if scmdata == "keep": 82 if scmdata == "keep":
@@ -86,7 +85,7 @@ class Repo(FetchMethod):
86 tar_flags = "--exclude='.repo' --exclude='.git'" 85 tar_flags = "--exclude='.repo' --exclude='.git'"
87 86
88 # Create a cache 87 # Create a cache
89 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d) 88 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d, workdir=codir)
90 89
91 def supports_srcrev(self): 90 def supports_srcrev(self):
92 return False 91 return False