summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-12 17:48:54 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-12-18 17:08:08 +0000
commit498de0473709414961873333b9473ad5a922d78c (patch)
treebe0374d6d379bbd8f71c389ae42b54d7b76c7a0a /bitbake/lib/bb/fetch2
parentba82035412d5dec2ce6f8a459ee52da48b1afe32 (diff)
downloadpoky-498de0473709414961873333b9473ad5a922d78c.tar.gz
bitbake: fetch2/git: Improve handling of unresolved names verses branches
Currently the fetcher doesn't distinguish between names that the fetcher needs to resolve verses branch names that the user specified. This meant that if you specify a tag and a branch, the fetcher broke. This separates the two so that the branch name is preserved and can be used in appropriate places. (Bitbake rev: e85f39fe9d1b224414b5da0780da514f75c5df92) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/git.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 00a459d653..c391b38039 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -106,6 +106,7 @@ class Git(FetchMethod):
106 if ud.bareclone: 106 if ud.bareclone:
107 ud.nocheckout = 1 107 ud.nocheckout = 1
108 108
109 ud.unresolvedrev = {}
109 branches = ud.parm.get("branch", "master").split(',') 110 branches = ud.parm.get("branch", "master").split(',')
110 if len(branches) != len(ud.names): 111 if len(branches) != len(ud.names):
111 raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url) 112 raise bb.fetch2.ParameterError("The number of name and branch parameters is not balanced", ud.url)
@@ -113,6 +114,7 @@ class Git(FetchMethod):
113 for name in ud.names: 114 for name in ud.names:
114 branch = branches[ud.names.index(name)] 115 branch = branches[ud.names.index(name)]
115 ud.branches[name] = branch 116 ud.branches[name] = branch
117 ud.unresolvedrev[name] = branch
116 118
117 ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" 119 ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
118 120
@@ -124,7 +126,7 @@ class Git(FetchMethod):
124 # Ensure anything that doesn't look like a sha256 checksum/revision is translated into one 126 # Ensure anything that doesn't look like a sha256 checksum/revision is translated into one
125 if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]): 127 if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):
126 if ud.revisions[name]: 128 if ud.revisions[name]:
127 ud.branches[name] = ud.revisions[name] 129 ud.unresolvedrev[name] = ud.revisions[name]
128 ud.revisions[name] = self.latest_revision(ud, d, name) 130 ud.revisions[name] = self.latest_revision(ud, d, name)
129 131
130 gitsrcname = '%s%s' % (ud.host.replace(':','.'), ud.path.replace('/', '.').replace('*', '.')) 132 gitsrcname = '%s%s' % (ud.host.replace(':','.'), ud.path.replace('/', '.').replace('*', '.'))
@@ -300,7 +302,7 @@ class Git(FetchMethod):
300 """ 302 """
301 Return a unique key for the url 303 Return a unique key for the url
302 """ 304 """
303 return "git:" + ud.host + ud.path.replace('/', '.') + ud.branches[name] 305 return "git:" + ud.host + ud.path.replace('/', '.') + ud.unresolvedrev[name]
304 306
305 def _latest_revision(self, ud, d, name): 307 def _latest_revision(self, ud, d, name):
306 """ 308 """
@@ -313,7 +315,7 @@ class Git(FetchMethod):
313 315
314 basecmd = data.getVar("FETCHCMD_git", d, True) or "git" 316 basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
315 cmd = "%s ls-remote %s://%s%s%s %s" % \ 317 cmd = "%s ls-remote %s://%s%s%s %s" % \
316 (basecmd, ud.proto, username, ud.host, ud.path, ud.branches[name]) 318 (basecmd, ud.proto, username, ud.host, ud.path, ud.unresolvedrev[name])
317 if ud.proto.lower() != 'file': 319 if ud.proto.lower() != 'file':
318 bb.fetch2.check_network_access(d, cmd) 320 bb.fetch2.check_network_access(d, cmd)
319 output = runfetchcmd(cmd, d, True) 321 output = runfetchcmd(cmd, d, True)