diff options
author | André Draszik <andre.draszik@linaro.org> | 2024-02-16 16:24:59 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-19 12:00:59 +0000 |
commit | b3d9663817c87f38277677b32aca43d2e8eb8aa2 (patch) | |
tree | f7972784b11245247c277f2c5a1007cc2a517685 /bitbake/lib/bb | |
parent | a5b23365539b89b8474a11cecb0c25f3442eb7d3 (diff) | |
download | poky-b3d9663817c87f38277677b32aca43d2e8eb8aa2.tar.gz |
bitbake: fetch/git2: support git's safe.bareRepository
When git is configured with safe.bareRepository=explicit [1], the
bitbake git fetcher fails miserably. LWN has an article about the
problem that this configuration option addresses and why it is useful
in [2].
It also seems that it is being rolled out in some environments as a
default for users.
In order to allow having this configuration turned on for a user's
environment in general, the fetcher has to be tought to use --git-dir=
for all relevent git operations.
The alternative, implemented here, is to forcibly turn off that option
for all git operations. In the future, we could look into converting
these to using the --git-dir= command line argument instead.
While at it, fix one open-coded invocation of git that wasn't using
ud.basecmd
Link: https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/config/safe.txt#n1 [1]
Link: https://lwn.net/Articles/892755/ [2]
(Bitbake rev: 5f3b1d8dc9ee70e707536bd75ee845b547440c97)
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 0deeb5cee1..842f1c6896 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -258,7 +258,7 @@ class Git(FetchMethod): | |||
258 | for name in ud.names: | 258 | for name in ud.names: |
259 | ud.unresolvedrev[name] = 'HEAD' | 259 | ud.unresolvedrev[name] = 'HEAD' |
260 | 260 | ||
261 | ud.basecmd = d.getVar("FETCHCMD_git") or "git -c gc.autoDetach=false -c core.pager=cat" | 261 | ud.basecmd = d.getVar("FETCHCMD_git") or "git -c gc.autoDetach=false -c core.pager=cat -c safe.bareRepository=all" |
262 | 262 | ||
263 | write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS") or "0" | 263 | write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS") or "0" |
264 | ud.write_tarballs = write_tarballs != "0" or ud.rebaseable | 264 | ud.write_tarballs = write_tarballs != "0" or ud.rebaseable |
@@ -514,7 +514,7 @@ class Git(FetchMethod): | |||
514 | 514 | ||
515 | logger.info("Creating tarball of git repository") | 515 | logger.info("Creating tarball of git repository") |
516 | with create_atomic(ud.fullmirror) as tfile: | 516 | with create_atomic(ud.fullmirror) as tfile: |
517 | mtime = runfetchcmd("git log --all -1 --format=%cD", d, | 517 | mtime = runfetchcmd("{} log --all -1 --format=%cD".format(ud.basecmd), d, |
518 | quiet=True, workdir=ud.clonedir) | 518 | quiet=True, workdir=ud.clonedir) |
519 | runfetchcmd("tar -czf %s --owner oe:0 --group oe:0 --mtime \"%s\" ." | 519 | runfetchcmd("tar -czf %s --owner oe:0 --group oe:0 --mtime \"%s\" ." |
520 | % (tfile, mtime), d, workdir=ud.clonedir) | 520 | % (tfile, mtime), d, workdir=ud.clonedir) |