aboutsummaryrefslogtreecommitdiffstats
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 07:57:13 +0100
commit05382932257257247b8c18bc06e9c0039d134d06 (patch)
treebfae9069769e8fa1d65e6df6b837733ee33cb086 /scripts/combo-layer
parent65461d7c35fdadb5b008052798731dce19ed187f (diff)
downloadopenembedded-core-contrib-05382932257257247b8c18bc06e9c0039d134d06.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. 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 40e63b9ede9..95653b0c213 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -197,6 +197,25 @@ def drop_to_shell(workdir=None):
else:
return True
+def check_rev_branch(repodir, rev, branch):
+ try:
+ actualbranch = runcmd("git branch --contains %s" % rev, repodir, printerr=False).rstrip()
+ except subprocess.CalledProcessError as e:
+ if e.returncode == 129:
+ actualbranch = ""
+ else:
+ raise
+
+ if ' ' in actualbranch:
+ actualbranch = actualbranch.split(' ')[-1]
+ if not actualbranch:
+ logger.error("Specified revision %s is invalid!" % rev)
+ return False
+ elif actualbranch != branch:
+ logger.error("Specified revision %s is not on specified branch %s!" % (rev, branch))
+ return False
+ return True
+
def get_repos(conf, args):
repos = []
if len(args) > 1:
@@ -273,6 +292,8 @@ 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):
+ sys.exit(1)
patch_cmd_range = "%s..%s" % (repo['last_revision'], branch)
rev_cmd_range = patch_cmd_range