aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/svn.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-19 16:50:22 +0100
commit6aa78bf3bd1f75728209e2d01faef31cb8887333 (patch)
treeb69f9370c155f3e63d73630f29e176bab27a7c48 /lib/bb/fetch2/svn.py
parent435c6fb838b9f38c0477bcc2f07c8ce22999132b (diff)
downloadbitbake-6aa78bf3bd1f75728209e2d01faef31cb8887333.tar.gz
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. Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/fetch2/svn.py')
-rw-r--r--lib/bb/fetch2/svn.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/bb/fetch2/svn.py b/lib/bb/fetch2/svn.py
index 968ca79b3..9ff94108e 100644
--- a/lib/bb/fetch2/svn.py
+++ b/lib/bb/fetch2/svn.py
@@ -126,25 +126,22 @@ class Svn(FetchMethod):
if os.access(os.path.join(ud.moddir, '.svn'), os.R_OK):
svnupdatecmd = self._buildsvncommand(ud, d, "update")
logger.info("Update " + ud.url)
- # update sources there
- os.chdir(ud.moddir)
# We need to attempt to run svn upgrade first in case its an older working format
try:
- runfetchcmd(ud.basecmd + " upgrade", d)
+ runfetchcmd(ud.basecmd + " upgrade", d, workdir=ud.moddir)
except FetchError:
pass
logger.debug(1, "Running %s", svnupdatecmd)
bb.fetch2.check_network_access(d, svnupdatecmd, ud.url)
- runfetchcmd(svnupdatecmd, d)
+ runfetchcmd(svnupdatecmd, d, workdir=ud.moddir)
else:
svnfetchcmd = self._buildsvncommand(ud, d, "fetch")
logger.info("Fetch " + ud.url)
# check out sources there
bb.utils.mkdirhier(ud.pkgdir)
- os.chdir(ud.pkgdir)
logger.debug(1, "Running %s", svnfetchcmd)
bb.fetch2.check_network_access(d, svnfetchcmd, ud.url)
- runfetchcmd(svnfetchcmd, d)
+ runfetchcmd(svnfetchcmd, d, ud.pkgdir)
scmdata = ud.parm.get("scmdata", "")
if scmdata == "keep":
@@ -152,9 +149,9 @@ class Svn(FetchMethod):
else:
tar_flags = "--exclude='.svn'"
- os.chdir(ud.pkgdir)
# tar them up to a defined filename
- runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.path_spec), d, cleanup = [ud.localpath])
+ runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.path_spec), d,
+ cleanup=[ud.localpath], workdir=ud.pkgdir)
def clean(self, ud, d):
""" Clean SVN specific files and dirs """