Patchwork [bitbake-devel,1/1] bitbake: fetch2/git: Anchor names when using ls-remote

login
register
mail settings
Submitter Robert Yang
Date March 26, 2014, 9:27 a.m.
Message ID <6d78004e5ccfd737bac24e5346d079aab11df2e7.1395802560.git.liezhi.yang@windriver.com>
Download mbox | patch
Permalink /patch/69237/
State New
Headers show

Comments

Robert Yang - March 26, 2014, 9:27 a.m.
From: Richard Purdie <richard.purdie@linuxfoundation.org>

When specifying tags, they're searched for unanchored so foo/bar could
match:

refs/heads/abc/foo/bar
refs/heads/xyz/foo/bar
refs/heads/foo/bar

This change anchors the expressions so they are based against heads
or tags (or any other base level tree that has been created).

(Bitbake master rev: df2e0972cd1db7abd5ec8b7cb295fb0c42e284a4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Conflicts:
	bitbake/lib/bb/fetch2/git.py
	(ud.basecmd and basecmd conflicts, keep using basecmd)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 bitbake/lib/bb/fetch2/git.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Richard Purdie - March 26, 2014, 10:04 a.m.
On Wed, 2014-03-26 at 05:27 -0400, Robert Yang wrote:
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> 
> When specifying tags, they're searched for unanchored so foo/bar could
> match:
> 
> refs/heads/abc/foo/bar
> refs/heads/xyz/foo/bar
> refs/heads/foo/bar
> 
> This change anchors the expressions so they are based against heads
> or tags (or any other base level tree that has been created).
> 
> (Bitbake master rev: df2e0972cd1db7abd5ec8b7cb295fb0c42e284a4)
> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> 
> Conflicts:
> 	bitbake/lib/bb/fetch2/git.py
> 	(ud.basecmd and basecmd conflicts, keep using basecmd)
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  bitbake/lib/bb/fetch2/git.py |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
> index 6175e4c..cff5ce1 100644
> --- a/bitbake/lib/bb/fetch2/git.py
> +++ b/bitbake/lib/bb/fetch2/git.py
> @@ -305,8 +305,8 @@ class Git(FetchMethod):
>              username = ""
>  
>          basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
> -        cmd = "%s ls-remote %s://%s%s%s %s" % \
> -              (basecmd, ud.proto, username, ud.host, ud.path, ud.branches[name])
> +        cmd = "%s ls-remote %s://%s%s%s refs/heads/%s refs/tags/%s" % \
> +              (basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name], ud.unresolvedrev[name])

Shouldn't this be ud.branches[name] for dora?

Cheers,

Richard

Patch

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 6175e4c..cff5ce1 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -305,8 +305,8 @@  class Git(FetchMethod):
             username = ""
 
         basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
-        cmd = "%s ls-remote %s://%s%s%s %s" % \
-              (basecmd, ud.proto, username, ud.host, ud.path, ud.branches[name])
+        cmd = "%s ls-remote %s://%s%s%s refs/heads/%s refs/tags/%s" % \
+              (basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name], ud.unresolvedrev[name])
         if ud.proto.lower() != 'file':
             bb.fetch2.check_network_access(d, cmd)
         output = runfetchcmd(cmd, d, True)