summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorCharlie Davies <charles.davies@whitetree.xyz>2020-10-12 05:07:52 -1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-13 09:40:10 +0100
commit52daea2287c868cec6008cb407933b673675e08e (patch)
tree92bad934b89c59c4c708e4768a051291c0a86f45 /bitbake
parentaa2ba21a1af0be4e4648f3f4b3a57d4629026bd0 (diff)
downloadpoky-52daea2287c868cec6008cb407933b673675e08e.tar.gz
bitbake: bitbake: fetch/git: add support for SRC_URI containing spaces in url
Microsoft's TFS VCS system allows for spaces in a git repository url. An example of a valid url is: ssh://tfs-my-company.org:22/tfs/My Projects/FooBar This commit adds support for such urls by implementing two changes. Firstly, when bitbake makes a git command line call the url is surrounded by quotes so that the url, regardless of spaces, is treated as one argument. Secondly, additional parsing of various filepath variables, which are based off of the url, are now completed with any spaces in the url replaced with underscores. (Bitbake rev: c4a51b7f4fd8a3c7d63c184675c014ec955d2606) Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit eb38b6f0935763f7ba19e5618f376fcae1dac41a) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/git.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 2ce9395f50..dcecff5d38 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -236,7 +236,7 @@ class Git(FetchMethod):
236 ud.unresolvedrev[name] = ud.revisions[name] 236 ud.unresolvedrev[name] = ud.revisions[name]
237 ud.revisions[name] = self.latest_revision(ud, d, name) 237 ud.revisions[name] = self.latest_revision(ud, d, name)
238 238
239 gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.')) 239 gitsrcname = '%s%s' % (ud.host.replace(':', '.'), ud.path.replace('/', '.').replace('*', '.').replace(' ','_'))
240 if gitsrcname.startswith('.'): 240 if gitsrcname.startswith('.'):
241 gitsrcname = gitsrcname[1:] 241 gitsrcname = gitsrcname[1:]
242 242
@@ -342,7 +342,7 @@ class Git(FetchMethod):
342 # We do this since git will use a "-l" option automatically for local urls where possible 342 # We do this since git will use a "-l" option automatically for local urls where possible
343 if repourl.startswith("file://"): 343 if repourl.startswith("file://"):
344 repourl = repourl[7:] 344 repourl = repourl[7:]
345 clone_cmd = "LANG=C %s clone --bare --mirror %s %s --progress" % (ud.basecmd, repourl, ud.clonedir) 345 clone_cmd = "LANG=C %s clone --bare --mirror \"%s\" %s --progress" % (ud.basecmd, repourl, ud.clonedir)
346 if ud.proto.lower() != 'file': 346 if ud.proto.lower() != 'file':
347 bb.fetch2.check_network_access(d, clone_cmd, ud.url) 347 bb.fetch2.check_network_access(d, clone_cmd, ud.url)
348 progresshandler = GitProgressHandler(d) 348 progresshandler = GitProgressHandler(d)
@@ -354,8 +354,8 @@ class Git(FetchMethod):
354 if "origin" in output: 354 if "origin" in output:
355 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) 355 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
356 356
357 runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d, workdir=ud.clonedir) 357 runfetchcmd("%s remote add --mirror=fetch origin \"%s\"" % (ud.basecmd, repourl), d, workdir=ud.clonedir)
358 fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, repourl) 358 fetch_cmd = "LANG=C %s fetch -f --progress \"%s\" refs/*:refs/*" % (ud.basecmd, repourl)
359 if ud.proto.lower() != 'file': 359 if ud.proto.lower() != 'file':
360 bb.fetch2.check_network_access(d, fetch_cmd, ud.url) 360 bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
361 progresshandler = GitProgressHandler(d) 361 progresshandler = GitProgressHandler(d)
@@ -501,7 +501,7 @@ class Git(FetchMethod):
501 raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url) 501 raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url)
502 502
503 repourl = self._get_repo_url(ud) 503 repourl = self._get_repo_url(ud)
504 runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir) 504 runfetchcmd("%s remote set-url origin \"%s\"" % (ud.basecmd, repourl), d, workdir=destdir)
505 505
506 if self._contains_lfs(ud, d, destdir): 506 if self._contains_lfs(ud, d, destdir):
507 if need_lfs and not self._find_git_lfs(d): 507 if need_lfs and not self._find_git_lfs(d):
@@ -613,7 +613,7 @@ class Git(FetchMethod):
613 d.setVar('_BB_GIT_IN_LSREMOTE', '1') 613 d.setVar('_BB_GIT_IN_LSREMOTE', '1')
614 try: 614 try:
615 repourl = self._get_repo_url(ud) 615 repourl = self._get_repo_url(ud)
616 cmd = "%s ls-remote %s %s" % \ 616 cmd = "%s ls-remote \"%s\" %s" % \
617 (ud.basecmd, repourl, search) 617 (ud.basecmd, repourl, search)
618 if ud.proto.lower() != 'file': 618 if ud.proto.lower() != 'file':
619 bb.fetch2.check_network_access(d, cmd, repourl) 619 bb.fetch2.check_network_access(d, cmd, repourl)