diff options
author | Charlie Davies <charles.davies@whitetree.xyz> | 2023-02-07 05:09:53 -1000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-13 07:48:16 +0000 |
commit | a99017d705b08f95763aebe94b44045164dc90b2 (patch) | |
tree | 237b1ff8b1f103e59c349fd8f6b171662f919905 /bitbake/lib | |
parent | 88cf58e2f50646b882dd2f46ba128191412a9637 (diff) | |
download | poky-a99017d705b08f95763aebe94b44045164dc90b2.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: ecc1dac4ad8c8593810c69a25d674b0e0bed6097)
Signed-off-by: Charlie Davies <charles.davies@whitetree.xyz>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4f9ba9c794de55bea0343267467bddea99844374)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 63a9f92b0a..2868aa5d53 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -63,6 +63,7 @@ import errno | |||
63 | import fnmatch | 63 | import fnmatch |
64 | import os | 64 | import os |
65 | import re | 65 | import re |
66 | import shlex | ||
66 | import subprocess | 67 | import subprocess |
67 | import tempfile | 68 | import tempfile |
68 | import bb | 69 | import bb |
@@ -352,7 +353,7 @@ class Git(FetchMethod): | |||
352 | # We do this since git will use a "-l" option automatically for local urls where possible | 353 | # We do this since git will use a "-l" option automatically for local urls where possible |
353 | if repourl.startswith("file://"): | 354 | if repourl.startswith("file://"): |
354 | repourl = repourl[7:] | 355 | repourl = repourl[7:] |
355 | clone_cmd = "LANG=C %s clone --bare --mirror \"%s\" %s --progress" % (ud.basecmd, repourl, ud.clonedir) | 356 | clone_cmd = "LANG=C %s clone --bare --mirror %s %s --progress" % (ud.basecmd, shlex.quote(repourl), ud.clonedir) |
356 | if ud.proto.lower() != 'file': | 357 | if ud.proto.lower() != 'file': |
357 | bb.fetch2.check_network_access(d, clone_cmd, ud.url) | 358 | bb.fetch2.check_network_access(d, clone_cmd, ud.url) |
358 | progresshandler = GitProgressHandler(d) | 359 | progresshandler = GitProgressHandler(d) |
@@ -364,8 +365,8 @@ class Git(FetchMethod): | |||
364 | if "origin" in output: | 365 | if "origin" in output: |
365 | runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) | 366 | runfetchcmd("%s remote rm origin" % ud.basecmd, d, workdir=ud.clonedir) |
366 | 367 | ||
367 | runfetchcmd("%s remote add --mirror=fetch origin \"%s\"" % (ud.basecmd, repourl), d, workdir=ud.clonedir) | 368 | runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=ud.clonedir) |
368 | fetch_cmd = "LANG=C %s fetch -f --progress \"%s\" refs/*:refs/*" % (ud.basecmd, repourl) | 369 | fetch_cmd = "LANG=C %s fetch -f --progress %s refs/*:refs/*" % (ud.basecmd, shlex.quote(repourl)) |
369 | if ud.proto.lower() != 'file': | 370 | if ud.proto.lower() != 'file': |
370 | bb.fetch2.check_network_access(d, fetch_cmd, ud.url) | 371 | bb.fetch2.check_network_access(d, fetch_cmd, ud.url) |
371 | progresshandler = GitProgressHandler(d) | 372 | progresshandler = GitProgressHandler(d) |
@@ -559,7 +560,7 @@ class Git(FetchMethod): | |||
559 | raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url) | 560 | raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url) |
560 | 561 | ||
561 | repourl = self._get_repo_url(ud) | 562 | repourl = self._get_repo_url(ud) |
562 | runfetchcmd("%s remote set-url origin \"%s\"" % (ud.basecmd, repourl), d, workdir=destdir) | 563 | runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=destdir) |
563 | 564 | ||
564 | if self._contains_lfs(ud, d, destdir): | 565 | if self._contains_lfs(ud, d, destdir): |
565 | if need_lfs and not self._find_git_lfs(d): | 566 | if need_lfs and not self._find_git_lfs(d): |
@@ -687,8 +688,8 @@ class Git(FetchMethod): | |||
687 | d.setVar('_BB_GIT_IN_LSREMOTE', '1') | 688 | d.setVar('_BB_GIT_IN_LSREMOTE', '1') |
688 | try: | 689 | try: |
689 | repourl = self._get_repo_url(ud) | 690 | repourl = self._get_repo_url(ud) |
690 | cmd = "%s ls-remote \"%s\" %s" % \ | 691 | cmd = "%s ls-remote %s %s" % \ |
691 | (ud.basecmd, repourl, search) | 692 | (ud.basecmd, shlex.quote(repourl), search) |
692 | if ud.proto.lower() != 'file': | 693 | if ud.proto.lower() != 'file': |
693 | bb.fetch2.check_network_access(d, cmd, repourl) | 694 | bb.fetch2.check_network_access(d, cmd, repourl) |
694 | output = runfetchcmd(cmd, d, True) | 695 | output = runfetchcmd(cmd, d, True) |