summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorCharlie Davies <charles.davies@whitetree.xyz>2020-10-14 10:48:38 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-17 12:36:14 +0100
commitb50b6007e5fab1b2f7634836dcaa775c8836edce (patch)
tree35c5225f044b1ed8a08717a321b24979349b60ca /bitbake
parent8aedc04676843aab8b76be951ead5b85b5bf295b (diff)
downloadpoky-b50b6007e5fab1b2f7634836dcaa775c8836edce.tar.gz
bitbake: bitbake: fetch/git: use shlex.quote() to support spaces in SRC_URI url
This commit replaces the instances where escaped double quotes are used to support SRC_URI url containing spaces with the more pythonic shlex.quote(). (Bitbake rev: 4f9ba9c794de55bea0343267467bddea99844374) Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/git.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 07064c694f..b97967b487 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -63,6 +63,7 @@ import errno
63import fnmatch 63import fnmatch
64import os 64import os
65import re 65import re
66import shlex
66import subprocess 67import subprocess
67import tempfile 68import tempfile
68import bb 69import bb
@@ -342,7 +343,7 @@ class Git(FetchMethod):
342 # We do this since git will use a "-l" option automatically for local urls where possible 343 # We do this since git will use a "-l" option automatically for local urls where possible
343 if repourl.startswith("file://"): 344 if repourl.startswith("file://"):
344 repourl = repourl[7:] 345 repourl = repourl[7:]
345 clone_cmd = "LANG=C %s clone --bare --mirror \"%s\" %s --progress" % (ud.basecmd, repourl, ud.clonedir) 346 clone_cmd = "LANG=C %s clone --bare --mirror %s %s --progress" % (ud.basecmd, shlex.quote(repourl), ud.clonedir)
346 if ud.proto.lower() != 'file': 347 if ud.proto.lower() != 'file':
347 bb.fetch2.check_network_access(d, clone_cmd, ud.url) 348 bb.fetch2.check_network_access(d, clone_cmd, ud.url)
348 progresshandler = GitProgressHandler(d) 349 progresshandler = GitProgressHandler(d)
@@ -354,8 +355,8 @@ class Git(FetchMethod):
354 if "origin" in output: 355 if "origin" in output:
355 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) 356 runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir)
356 357
357 runfetchcmd("%s remote add --mirror=fetch origin \"%s\"" % (ud.basecmd, repourl), d, workdir=ud.clonedir) 358 runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=ud.clonedir)
358 fetch_cmd = "LANG=C %s fetch -f --progress \"%s\" refs/*:refs/*" % (ud.basecmd, repourl) 359 fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, shlex.quote(repourl))
359 if ud.proto.lower() != 'file': 360 if ud.proto.lower() != 'file':
360 bb.fetch2.check_network_access(d, fetch_cmd, ud.url) 361 bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
361 progresshandler = GitProgressHandler(d) 362 progresshandler = GitProgressHandler(d)
@@ -504,7 +505,7 @@ class Git(FetchMethod):
504 raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url) 505 raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url)
505 506
506 repourl = self._get_repo_url(ud) 507 repourl = self._get_repo_url(ud)
507 runfetchcmd("%s remote set-url origin \"%s\"" % (ud.basecmd, repourl), d, workdir=destdir) 508 runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=destdir)
508 509
509 if self._contains_lfs(ud, d, destdir): 510 if self._contains_lfs(ud, d, destdir):
510 if need_lfs and not self._find_git_lfs(d): 511 if need_lfs and not self._find_git_lfs(d):
@@ -623,8 +624,8 @@ class Git(FetchMethod):
623 d.setVar('_BB_GIT_IN_LSREMOTE', '1') 624 d.setVar('_BB_GIT_IN_LSREMOTE', '1')
624 try: 625 try:
625 repourl = self._get_repo_url(ud) 626 repourl = self._get_repo_url(ud)
626 cmd = "%s ls-remote \"%s\" %s" % \ 627 cmd = "%s ls-remote %s %s" % \
627 (ud.basecmd, repourl, search) 628 (ud.basecmd, shlex.quote(repourl), search)
628 if ud.proto.lower() != 'file': 629 if ud.proto.lower() != 'file':
629 bb.fetch2.check_network_access(d, cmd, repourl) 630 bb.fetch2.check_network_access(d, cmd, repourl)
630 output = runfetchcmd(cmd, d, True) 631 output = runfetchcmd(cmd, d, True)