summaryrefslogtreecommitdiffstats
path: root/scripts/combo-layer
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-07-31 01:06:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-31 08:02:11 +0100
commit6bea86370491ec1b98975eed8e0003c234a2048f (patch)
tree1f7fe8bf7153fd88bb41c43431648348a7dd127b /scripts/combo-layer
parent8140c5b7ee1e9a6fb8860ff9e2f9d88ccff48ee6 (diff)
downloadpoky-6bea86370491ec1b98975eed8e0003c234a2048f.tar.gz
combo-layer: check that last_revision is valid
If the user edits the configuration file by hand and sets last_revision, we need to ensure that the revision is valid and on the specified branch. (From OE-Core rev: 05382932257257247b8c18bc06e9c0039d134d06) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-xscripts/combo-layer21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 40e63b9ede..95653b0c21 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -197,6 +197,25 @@ def drop_to_shell(workdir=None):
197 else: 197 else:
198 return True 198 return True
199 199
200def check_rev_branch(repodir, rev, branch):
201 try:
202 actualbranch = runcmd("git branch --contains %s" % rev, repodir, printerr=False).rstrip()
203 except subprocess.CalledProcessError as e:
204 if e.returncode == 129:
205 actualbranch = ""
206 else:
207 raise
208
209 if ' ' in actualbranch:
210 actualbranch = actualbranch.split(' ')[-1]
211 if not actualbranch:
212 logger.error("Specified revision %s is invalid!" % rev)
213 return False
214 elif actualbranch != branch:
215 logger.error("Specified revision %s is not on specified branch %s!" % (rev, branch))
216 return False
217 return True
218
200def get_repos(conf, args): 219def get_repos(conf, args):
201 repos = [] 220 repos = []
202 if len(args) > 1: 221 if len(args) > 1:
@@ -273,6 +292,8 @@ def action_update(conf, args):
273 patch_cmd_range = "--root %s" % branch 292 patch_cmd_range = "--root %s" % branch
274 rev_cmd_range = branch 293 rev_cmd_range = branch
275 else: 294 else:
295 if not check_rev_branch(ldir, repo['last_revision'], branch):
296 sys.exit(1)
276 patch_cmd_range = "%s..%s" % (repo['last_revision'], branch) 297 patch_cmd_range = "%s..%s" % (repo['last_revision'], branch)
277 rev_cmd_range = patch_cmd_range 298 rev_cmd_range = patch_cmd_range
278 299