summaryrefslogtreecommitdiffstats
path: root/bitbake/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-20 16:08:59 +0100
commitab09541d5517da9b1a23923ea8f5c26ddf745084 (patch)
treeb0b81a809ec783b7481c012b430b9f6618e87a73 /bitbake/lib/bb/fetch2/svn.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/svn.py')
-rw-r--r--bitbake/lib/bb/fetch2/svn.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py
index 968ca79b30..9ff94108ed 100644
--- a/bitbake/lib/bb/fetch2/svn.py
+++ b/bitbake/lib/bb/fetch2/svn.py
@@ -126,25 +126,22 @@ class Svn(FetchMethod):
126 if os.access(os.path.join(ud.moddir, '.svn'), os.R_OK): 126 if os.access(os.path.join(ud.moddir, '.svn'), os.R_OK):
127 svnupdatecmd = self._buildsvncommand(ud, d, "update") 127 svnupdatecmd = self._buildsvncommand(ud, d, "update")
128 logger.info("Update " + ud.url) 128 logger.info("Update " + ud.url)
129 # update sources there
130 os.chdir(ud.moddir)
131 # We need to attempt to run svn upgrade first in case its an older working format 129 # We need to attempt to run svn upgrade first in case its an older working format
132 try: 130 try:
133 runfetchcmd(ud.basecmd + " upgrade", d) 131 runfetchcmd(ud.basecmd + " upgrade", d, workdir=ud.moddir)
134 except FetchError: 132 except FetchError:
135 pass 133 pass
136 logger.debug(1, "Running %s", svnupdatecmd) 134 logger.debug(1, "Running %s", svnupdatecmd)
137 bb.fetch2.check_network_access(d, svnupdatecmd, ud.url) 135 bb.fetch2.check_network_access(d, svnupdatecmd, ud.url)
138 runfetchcmd(svnupdatecmd, d) 136 runfetchcmd(svnupdatecmd, d, workdir=ud.moddir)
139 else: 137 else:
140 svnfetchcmd = self._buildsvncommand(ud, d, "fetch") 138 svnfetchcmd = self._buildsvncommand(ud, d, "fetch")
141 logger.info("Fetch " + ud.url) 139 logger.info("Fetch " + ud.url)
142 # check out sources there 140 # check out sources there
143 bb.utils.mkdirhier(ud.pkgdir) 141 bb.utils.mkdirhier(ud.pkgdir)
144 os.chdir(ud.pkgdir)
145 logger.debug(1, "Running %s", svnfetchcmd) 142 logger.debug(1, "Running %s", svnfetchcmd)
146 bb.fetch2.check_network_access(d, svnfetchcmd, ud.url) 143 bb.fetch2.check_network_access(d, svnfetchcmd, ud.url)
147 runfetchcmd(svnfetchcmd, d) 144 runfetchcmd(svnfetchcmd, d, ud.pkgdir)
148 145
149 scmdata = ud.parm.get("scmdata", "") 146 scmdata = ud.parm.get("scmdata", "")
150 if scmdata == "keep": 147 if scmdata == "keep":
@@ -152,9 +149,9 @@ class Svn(FetchMethod):
152 else: 149 else:
153 tar_flags = "--exclude='.svn'" 150 tar_flags = "--exclude='.svn'"
154 151
155 os.chdir(ud.pkgdir)
156 # tar them up to a defined filename 152 # tar them up to a defined filename
157 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.path_spec), d, cleanup = [ud.localpath]) 153 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, ud.path_spec), d,
154 cleanup=[ud.localpath], workdir=ud.pkgdir)
158 155
159 def clean(self, ud, d): 156 def clean(self, ud, d):
160 """ Clean SVN specific files and dirs """ 157 """ Clean SVN specific files and dirs """