diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-04-02 09:00:13 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-04-03 11:03:43 +0100 |
commit | 49ec431d9598a9a51bd08a15ee8ceb793042c3d3 (patch) | |
tree | d2de91d0ba66fa5dcd61bf5a70905f1a0bb6c9d8 /bitbake/lib/bb/fetch2/git.py | |
parent | efe76a50952af602b60d1e7bf7413225ce92fd68 (diff) | |
download | poky-49ec431d9598a9a51bd08a15ee8ceb793042c3d3.tar.gz |
bitbake: fetch2/git: Handle srcrevs for annotated tags in tag check
If SRCREV points at an annotated tag, the comparision code can fail
as the resolved tag might not be the same sha.
Handle this by also resolving the SRCREV. We only need to do this if
they don't match in the first place for a minor performance win.
Also add a test for this.
(Bitbake rev: 136c06e251de68ed64355ec6b47a522ff3a372e3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/git.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index 3a4ae6df45..5f4ec6128c 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -730,7 +730,12 @@ class Git(FetchMethod): | |||
730 | output = runfetchcmd("%s rev-list -n 1 %s" % (ud.basecmd, ud.parm['tag']), d, workdir=destdir) | 730 | output = runfetchcmd("%s rev-list -n 1 %s" % (ud.basecmd, ud.parm['tag']), d, workdir=destdir) |
731 | output = output.strip() | 731 | output = output.strip() |
732 | if output != ud.revision: | 732 | if output != ud.revision: |
733 | raise bb.fetch2.FetchError("The revision the git tag '%s' resolved to didn't match the SRCREV in use (%s vs %s)" % (ud.parm['tag'], output, ud.revision), ud.url) | 733 | # It is possible ud.revision is the revision on an annotated tag which won't match the output of rev-list |
734 | # If it resolves to the same thing there isn't a problem. | ||
735 | output2 = runfetchcmd("%s rev-list -n 1 %s" % (ud.basecmd, ud.revision), d, workdir=destdir) | ||
736 | output2 = output2.strip() | ||
737 | if output != output2: | ||
738 | raise bb.fetch2.FetchError("The revision the git tag '%s' resolved to didn't match the SRCREV in use (%s vs %s)" % (ud.parm['tag'], output, ud.revision), ud.url) | ||
734 | 739 | ||
735 | repourl = self._get_repo_url(ud) | 740 | repourl = self._get_repo_url(ud) |
736 | runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=destdir) | 741 | runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, shlex.quote(repourl)), d, workdir=destdir) |