bitbake: fetch2/git: Restore escape quoting for the git url when used

This fixes a bug where escapes in the url path would not be properly
restored for the git commands in the git fetcher. For example, a
space which is encoded as '%20' was not properly encoded before the
clone command.

e.g.

SRC_URI="git://git.openembedded.org/bitbake%20example/bitbake;protocol=https"

resulted in
git clone 'https://git.openembedded.org/bitbake example/bitbake'

instead of
git clone 'https://git.openembedded.org/bitbake%20example/bitbake'

(Bitbake rev: be48024253b93215bb110cd1d05925e789ec9680)

Signed-off-by: Patrik Nordvall <patrik.nordvall95@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Patrik Nordvall
2025-03-14 12:25:59 +01:00
committed by Richard Purdie
parent 85c2eb6d42
commit 8180865c22
2 changed files with 5 additions and 1 deletions

View File

@@ -81,6 +81,7 @@ import shlex
import shutil
import subprocess
import tempfile
import urllib
import bb
import bb.progress
from contextlib import contextmanager
@@ -888,7 +889,7 @@ class Git(FetchMethod):
username = ud.user + '@'
else:
username = ""
return "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path)
return "%s://%s%s%s" % (ud.proto, username, ud.host, urllib.parse.quote(ud.path))
def _revision_key(self, ud, d, name):
"""