summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-09-13 17:23:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-14 09:50:29 +0100
commita2eab6bb1626be6a1f16eff56ff72a9288ab9de3 (patch)
tree2f6dc2d15967bedbca7dce28e9667d8e3d2ca638
parent7ddf64d58de9ef9f281f6afadf3c82ac8634ef65 (diff)
downloadpoky-a2eab6bb1626be6a1f16eff56ff72a9288ab9de3.tar.gz
scripts/combo-layer: ensure we validate branch/revision on init
If both branch and last_revision are specified for a component when combo-layer init is run, ensure that the specified revision is actually on the specified branch and error out if not. Also ensure that the error message mentions the component. (From OE-Core rev: e498257ecbec94cec181d73bda57d44335b4dee0) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/combo-layer11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 65435db8c0..3baea24dee 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -183,6 +183,9 @@ def action_init(conf, args):
183 lastrev = repo.get('last_revision', None) 183 lastrev = repo.get('last_revision', None)
184 if lastrev and lastrev != "HEAD": 184 if lastrev and lastrev != "HEAD":
185 initialrev = lastrev 185 initialrev = lastrev
186 if branch:
187 if not check_rev_branch(name, ldir, lastrev, branch):
188 sys.exit(1)
186 logger.info("Copying data from %s at specified revision %s..." % (name, lastrev)) 189 logger.info("Copying data from %s at specified revision %s..." % (name, lastrev))
187 else: 190 else:
188 lastrev = None 191 lastrev = None
@@ -278,7 +281,7 @@ def drop_to_shell(workdir=None):
278 else: 281 else:
279 return True 282 return True
280 283
281def check_rev_branch(repodir, rev, branch): 284def check_rev_branch(component, repodir, rev, branch):
282 try: 285 try:
283 actualbranch = runcmd("git branch --contains %s" % rev, repodir, printerr=False).rstrip() 286 actualbranch = runcmd("git branch --contains %s" % rev, repodir, printerr=False).rstrip()
284 except subprocess.CalledProcessError as e: 287 except subprocess.CalledProcessError as e:
@@ -290,10 +293,10 @@ def check_rev_branch(repodir, rev, branch):
290 if ' ' in actualbranch: 293 if ' ' in actualbranch:
291 actualbranch = actualbranch.split(' ')[-1] 294 actualbranch = actualbranch.split(' ')[-1]
292 if not actualbranch: 295 if not actualbranch:
293 logger.error("Specified revision %s is invalid!" % rev) 296 logger.error("%s: specified revision %s is invalid!" % (component, rev))
294 return False 297 return False
295 elif actualbranch != branch: 298 elif actualbranch != branch:
296 logger.error("Specified revision %s is not on specified branch %s!" % (rev, branch)) 299 logger.error("%s: specified revision %s is not on specified branch %s!" % (component, rev, branch))
297 return False 300 return False
298 return True 301 return True
299 302
@@ -373,7 +376,7 @@ def action_update(conf, args):
373 patch_cmd_range = "--root %s" % branch 376 patch_cmd_range = "--root %s" % branch
374 rev_cmd_range = branch 377 rev_cmd_range = branch
375 else: 378 else:
376 if not check_rev_branch(ldir, repo['last_revision'], branch): 379 if not check_rev_branch(name, ldir, repo['last_revision'], branch):
377 sys.exit(1) 380 sys.exit(1)
378 patch_cmd_range = "%s..%s" % (repo['last_revision'], branch) 381 patch_cmd_range = "%s..%s" % (repo['last_revision'], branch)
379 rev_cmd_range = patch_cmd_range 382 rev_cmd_range = patch_cmd_range