diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2023-03-24 00:09:02 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-04-11 11:31:52 +0100 |
commit | c6939e8b7f5a3f8e92bf4133ca29c141f4196942 (patch) | |
tree | ee0d27e899d64e312eb90eee3803a04e02bb5d92 /bitbake | |
parent | 407c3e0237d947ec003bdd1af89a226121c7939c (diff) | |
download | poky-c6939e8b7f5a3f8e92bf4133ca29c141f4196942.tar.gz |
bitbake: fetch/git: Fix local clone url to make it work with repo
The "git clone /path/to/git/objects_symlink" couldn't work after the following
change:
https://github.com/git/git/commit/6f054f9fb3a501c35b55c65e547a244f14c38d56
But repo command manages the git repo as symlinks, so check whether the objects
is an symlink to fix the problem:
* Nothing is changed if git/objects is not a symlink
* Use "git clone file://" when git/objects is a symlink
(Bitbake rev: 2802adb572eb73a3eb2725a74a9bbdaafc543fa7)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit a0d8108eba8d542707740d00c66c1c5f5b963f18)
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.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 4e286ca96f..4d6e57ade7 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -359,9 +359,13 @@ class Git(FetchMethod): | |||
359 | 359 | ||
360 | # If the repo still doesn't exist, fallback to cloning it | 360 | # If the repo still doesn't exist, fallback to cloning it |
361 | if not os.path.exists(ud.clonedir): | 361 | if not os.path.exists(ud.clonedir): |
362 | # We do this since git will use a "-l" option automatically for local urls where possible | 362 | # We do this since git will use a "-l" option automatically for local urls where possible, |
363 | # but it doesn't work when git/objects is a symlink, only works when it is a directory. | ||
363 | if repourl.startswith("file://"): | 364 | if repourl.startswith("file://"): |
364 | repourl = repourl[7:] | 365 | repourl_path = repourl[7:] |
366 | objects = os.path.join(repourl_path, 'objects') | ||
367 | if os.path.isdir(objects) and not os.path.islink(objects): | ||
368 | repourl = repourl_path | ||
365 | clone_cmd = "LANG=C %s clone --bare --mirror %s %s --progress" % (ud.basecmd, shlex.quote(repourl), ud.clonedir) | 369 | clone_cmd = "LANG=C %s clone --bare --mirror %s %s --progress" % (ud.basecmd, shlex.quote(repourl), ud.clonedir) |
366 | if ud.proto.lower() != 'file': | 370 | if ud.proto.lower() != 'file': |
367 | bb.fetch2.check_network_access(d, clone_cmd, ud.url) | 371 | bb.fetch2.check_network_access(d, clone_cmd, ud.url) |