[bitbake-devel] [PATCH] bitbake: bb.fetch2.git: Fix _latest_revision function while using tags
Richard Purdie
richard.purdie at linuxfoundation.org
Tue Jan 7 13:38:28 UTC 2014
On Sun, 2014-01-05 at 03:53 +0200, Andrei Gherzan wrote:
> When getting the revision we must take into consideration if the name we are
> looking for is a tag and in that case we need the dereferenced commit ID in
> order to check for it existance in a specific branch.
>
> So first search for the reference^{} commit ID and only if that returns nothing
> get the name as it is.
In what case would reference^{} fail to work when reference would?
Reading the git documentation, I'm struggling to see a case when ^{}
wouldn't do the right thing and if that is the case we don't need the
fallback?
Cheers,
Richard
> Signed-off-by: Andrei Gherzan <andrei at gherzan.ro>
> ---
> bitbake/lib/bb/fetch2/git.py | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
> index b4b9368..1584232 100644
> --- a/bitbake/lib/bb/fetch2/git.py
> +++ b/bitbake/lib/bb/fetch2/git.py
> @@ -318,9 +318,13 @@ class Git(FetchMethod):
> (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
> if ud.proto.lower() != 'file':
> bb.fetch2.check_network_access(d, cmd)
> - output = runfetchcmd(cmd, d, True)
> + # Maybe the ref is a tag so try to dereference it first
> + output = runfetchcmd(cmd + '^{}', d, True)
> if not output:
> - raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url)
> + # Dereference gave nothing so try to get it as it is
> + output = runfetchcmd(cmd, d, True)
> + if not output:
> + raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url)
> return output.split()[0]
>
> def _build_revision(self, ud, d, name):
More information about the bitbake-devel
mailing list