summaryrefslogtreecommitdiffstats
path: root/scripts/combo-layer
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 /scripts/combo-layer
parent7ddf64d58de9ef9f281f6afadf3c82ac8634ef65 (diff)
downloadast2050-yocto-poky-a2eab6bb1626be6a1f16eff56ff72a9288ab9de3.zip
ast2050-yocto-poky-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>
Diffstat (limited to 'scripts/combo-layer')
-rwxr-xr-xscripts/combo-layer11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 65435db..3baea24 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -183,6 +183,9 @@ def action_init(conf, args):
lastrev = repo.get('last_revision', None)
if lastrev and lastrev != "HEAD":
initialrev = lastrev
+ if branch:
+ if not check_rev_branch(name, ldir, lastrev, branch):
+ sys.exit(1)
logger.info("Copying data from %s at specified revision %s..." % (name, lastrev))
else:
lastrev = None
@@ -278,7 +281,7 @@ def drop_to_shell(workdir=None):
else:
return True
-def check_rev_branch(repodir, rev, branch):
+def check_rev_branch(component, repodir, rev, branch):
try:
actualbranch = runcmd("git branch --contains %s" % rev, repodir, printerr=False).rstrip()
except subprocess.CalledProcessError as e:
@@ -290,10 +293,10 @@ def check_rev_branch(repodir, rev, branch):
if ' ' in actualbranch:
actualbranch = actualbranch.split(' ')[-1]
if not actualbranch:
- logger.error("Specified revision %s is invalid!" % rev)
+ logger.error("%s: specified revision %s is invalid!" % (component, rev))
return False
elif actualbranch != branch:
- logger.error("Specified revision %s is not on specified branch %s!" % (rev, branch))
+ logger.error("%s: specified revision %s is not on specified branch %s!" % (component, rev, branch))
return False
return True
@@ -373,7 +376,7 @@ def action_update(conf, args):
patch_cmd_range = "--root %s" % branch
rev_cmd_range = branch
else:
- if not check_rev_branch(ldir, repo['last_revision'], branch):
+ if not check_rev_branch(name, ldir, repo['last_revision'], branch):
sys.exit(1)
patch_cmd_range = "%s..%s" % (repo['last_revision'], branch)
rev_cmd_range = patch_cmd_range
OpenPOWER on IntegriCloud