* [RFC] WIP: git: prefix with refs/tags/ when revision isn't git hash
@ 2013-08-11 8:36 Martin Jansa
2013-08-12 11:26 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Martin Jansa @ 2013-08-11 8:36 UTC (permalink / raw)
To: bitbake-devel
* many Open webOS components have tag in format
submissions/N, versions/X.Y.Z
just by chance I've noticed that git ls-remote behaves a bit different
than what I've expected:
We were using tag=18 in SRC_URI.
librolegen repository doesn't have tag '18'
$ git tag -l
submissions/0
submissions/16
submissions/17
submissions/18
version/2.0.0
versions/2.1.0
It was working correctly until now, just because we were lucky.
From git help ls-remote:
When <refs>... are specified, only references matching the given
patterns are displayed.
$ git ls-remote git://github.com/openwebos/librolegen 18
cbedc69733f65cd2f498787a621c014e219d38ab refs/tags/submissions/18
$ git ls-remote git://github.com/openwebos/librolegen 17
af5b0e7b514938d5589c89ab9508ad23dce43e98 refs/tags/submissions/17
$ git ls-remote git://github.com/openwebos/librolegen
9040954a24115b05219e7dd459dcf91ad05cc739 HEAD
9040954a24115b05219e7dd459dcf91ad05cc739 refs/heads/master
85524970dba46557d3c9672455a4a88165efe7f1 refs/notes/review
fe509e33f5d68c834bce087dff0f6c801d869b68 refs/tags/submissions/0
04bc2c24ce628de3ac0fba8afce088f2391f96bb refs/tags/submissions/0^{}
7aa394eea6bd76618337772894f7615d0ae8e13a refs/tags/submissions/16
af5b0e7b514938d5589c89ab9508ad23dce43e98 refs/tags/submissions/17
cbedc69733f65cd2f498787a621c014e219d38ab refs/tags/submissions/18
9040954a24115b05219e7dd459dcf91ad05cc739 refs/tags/submissions/18^{}
7aa394eea6bd76618337772894f7615d0ae8e13a refs/tags/version/2.0.0
af5b0e7b514938d5589c89ab9508ad23dce43e98 refs/tags/versions/2.1.0
So if someone creates tag 'foo/18' ls-remote will return both lines and
build will fail.
Prefixing with 'refs/tags/' will work in this case, but I haven't tested
if this code breaks AUTOREV or other use-cases -> that's why it's RFC + WIP.
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
lib/bb/fetch2/git.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 6175e4c..ebb5722 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -124,7 +124,7 @@ class Git(FetchMethod):
# Ensure anything that doesn't look like a sha256 checksum/revision is translated into one
if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):
if ud.revisions[name]:
- ud.branches[name] = ud.revisions[name]
+ ud.branches[name] = "refs/tags/%s" % ud.revisions[name]
ud.revisions[name] = self.latest_revision(ud.url, ud, d, name)
gitsrcname = '%s%s' % (ud.host.replace(':','.'), ud.path.replace('/', '.').replace('*', '.'))
--
1.8.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC] WIP: git: prefix with refs/tags/ when revision isn't git hash
2013-08-11 8:36 [RFC] WIP: git: prefix with refs/tags/ when revision isn't git hash Martin Jansa
@ 2013-08-12 11:26 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2013-08-12 11:26 UTC (permalink / raw)
To: Martin Jansa; +Cc: bitbake-devel
On Sun, 2013-08-11 at 10:36 +0200, Martin Jansa wrote:
> * many Open webOS components have tag in format
> submissions/N, versions/X.Y.Z
> just by chance I've noticed that git ls-remote behaves a bit different
> than what I've expected:
>
> We were using tag=18 in SRC_URI.
> librolegen repository doesn't have tag '18'
> $ git tag -l
> submissions/0
> submissions/16
> submissions/17
> submissions/18
> version/2.0.0
> versions/2.1.0
>
> It was working correctly until now, just because we were lucky.
>
> From git help ls-remote:
> When <refs>... are specified, only references matching the given
> patterns are displayed.
> $ git ls-remote git://github.com/openwebos/librolegen 18
> cbedc69733f65cd2f498787a621c014e219d38ab refs/tags/submissions/18
> $ git ls-remote git://github.com/openwebos/librolegen 17
> af5b0e7b514938d5589c89ab9508ad23dce43e98 refs/tags/submissions/17
> $ git ls-remote git://github.com/openwebos/librolegen
> 9040954a24115b05219e7dd459dcf91ad05cc739 HEAD
> 9040954a24115b05219e7dd459dcf91ad05cc739 refs/heads/master
> 85524970dba46557d3c9672455a4a88165efe7f1 refs/notes/review
> fe509e33f5d68c834bce087dff0f6c801d869b68 refs/tags/submissions/0
> 04bc2c24ce628de3ac0fba8afce088f2391f96bb refs/tags/submissions/0^{}
> 7aa394eea6bd76618337772894f7615d0ae8e13a refs/tags/submissions/16
> af5b0e7b514938d5589c89ab9508ad23dce43e98 refs/tags/submissions/17
> cbedc69733f65cd2f498787a621c014e219d38ab refs/tags/submissions/18
> 9040954a24115b05219e7dd459dcf91ad05cc739 refs/tags/submissions/18^{}
> 7aa394eea6bd76618337772894f7615d0ae8e13a refs/tags/version/2.0.0
> af5b0e7b514938d5589c89ab9508ad23dce43e98 refs/tags/versions/2.1.0
>
> So if someone creates tag 'foo/18' ls-remote will return both lines and
> build will fail.
>
> Prefixing with 'refs/tags/' will work in this case, but I haven't tested
> if this code breaks AUTOREV or other use-cases -> that's why it's RFC + WIP.
>
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
> lib/bb/fetch2/git.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> index 6175e4c..ebb5722 100644
> --- a/lib/bb/fetch2/git.py
> +++ b/lib/bb/fetch2/git.py
> @@ -124,7 +124,7 @@ class Git(FetchMethod):
> # Ensure anything that doesn't look like a sha256 checksum/revision is translated into one
> if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):
> if ud.revisions[name]:
> - ud.branches[name] = ud.revisions[name]
> + ud.branches[name] = "refs/tags/%s" % ud.revisions[name]
> ud.revisions[name] = self.latest_revision(ud.url, ud, d, name)
>
> gitsrcname = '%s%s' % (ud.host.replace(':','.'), ud.path.replace('/', '.').replace('*', '.'))
This may need to test "refs/heads/%s" before checking "refs/tags/%s"
since a head name or tag name are currently equally accepted in
revisions.
Also, what if ud.branches was already set to something, shouldn't we
error in that case? (I appreciate you haven't introduced that issue).
Cheers,
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-08-12 11:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-11 8:36 [RFC] WIP: git: prefix with refs/tags/ when revision isn't git hash Martin Jansa
2013-08-12 11:26 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.