summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-18 19:12:01 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-08-20 16:08:59 +0100
commitc04468d113ffe2e2c03f5305da59aef93a891e90 (patch)
tree6565eb6f9769fcf38c05767946da20084c73e9c1
parent4093f0bad27828bf7a8c52e73a934790e1412435 (diff)
downloadpoky-c04468d113ffe2e2c03f5305da59aef93a891e90.tar.gz
bitbake: git: Allow local repos to use HEAD
Introduce a new 'usehead' url parameter for git repositories. Specifying usehead=1 causes bitbake to use whatever commit the repository HEAD is pointing to. Usage of usehead=1 is only allowed for local git repositories, i.e. it must always be accompanied with protocol=file url parameter. [YOCTO #9351] (Bitbake rev: 2673fac5a9d06de937101e3fb2ddf1e60ff99abf) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/git.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 4e2dcec0d7..fd8f3fdf4d 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -49,6 +49,10 @@ Supported SRC_URI options are:
49 referring to commit which is valid in tag instead of branch. 49 referring to commit which is valid in tag instead of branch.
50 The default is "0", set nobranch=1 if needed. 50 The default is "0", set nobranch=1 if needed.
51 51
52- usehead
53 For local git:// urls to use the current branch HEAD as the revsion for use with
54 AUTOREV. Implies nobranch.
55
52""" 56"""
53 57
54#Copyright (C) 2005 Richard Purdie 58#Copyright (C) 2005 Richard Purdie
@@ -153,6 +157,13 @@ class Git(FetchMethod):
153 157
154 ud.nobranch = ud.parm.get("nobranch","0") == "1" 158 ud.nobranch = ud.parm.get("nobranch","0") == "1"
155 159
160 # usehead implies nobranch
161 ud.usehead = ud.parm.get("usehead","0") == "1"
162 if ud.usehead:
163 if ud.proto != "file":
164 raise bb.fetch2.ParameterError("The usehead option is only for use with local ('protocol=file') git repositories", ud.url)
165 ud.nobranch = 1
166
156 # bareclone implies nocheckout 167 # bareclone implies nocheckout
157 ud.bareclone = ud.parm.get("bareclone","0") == "1" 168 ud.bareclone = ud.parm.get("bareclone","0") == "1"
158 if ud.bareclone: 169 if ud.bareclone:
@@ -168,6 +179,9 @@ class Git(FetchMethod):
168 ud.branches[name] = branch 179 ud.branches[name] = branch
169 ud.unresolvedrev[name] = branch 180 ud.unresolvedrev[name] = branch
170 181
182 if ud.usehead:
183 ud.unresolvedrev['default'] = 'HEAD'
184
171 ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git -c core.fsyncobjectfiles=0" 185 ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git -c core.fsyncobjectfiles=0"
172 186
173 ud.write_tarballs = ((data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0") or ud.rebaseable 187 ud.write_tarballs = ((data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) or "0") != "0") or ud.rebaseable
@@ -387,7 +401,7 @@ class Git(FetchMethod):
387 """ 401 """
388 output = self._lsremote(ud, d, "") 402 output = self._lsremote(ud, d, "")
389 # Tags of the form ^{} may not work, need to fallback to other form 403 # Tags of the form ^{} may not work, need to fallback to other form
390 if ud.unresolvedrev[name][:5] == "refs/": 404 if ud.unresolvedrev[name][:5] == "refs/" or ud.usehead:
391 head = ud.unresolvedrev[name] 405 head = ud.unresolvedrev[name]
392 tag = ud.unresolvedrev[name] 406 tag = ud.unresolvedrev[name]
393 else: 407 else: