From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 6/7] combo-layer: check that last_revision is valid
Date: Tue, 31 Jul 2012 01:06:25 +0100 [thread overview]
Message-ID: <c0c6856ea08dc44a97da9f4da0100805e6b371c0.1343693147.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1343693147.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1343693147.git.paul.eggleton@linux.intel.com>
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>
---
scripts/combo-layer | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 40e63b9..95653b0 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
--
1.7.9.5
next prev parent reply other threads:[~2012-07-31 0:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 0:06 [PATCH 0/7] combo-layer improvements Paul Eggleton
2012-07-31 0:06 ` [PATCH 1/7] combo-layer: remove &> bashism Paul Eggleton
2012-07-31 0:06 ` [PATCH 2/7] combo-layer: allow component pull to be done separately Paul Eggleton
2012-07-31 0:06 ` [PATCH 3/7] combo-layer: ignore patch-* temp directories in dirty check Paul Eggleton
2012-07-31 0:06 ` [PATCH 4/7] combo-layer: drop to a shell when apply fails during update Paul Eggleton
2012-07-31 0:06 ` [PATCH 5/7] combo-layer: improve patch list handling and output Paul Eggleton
2012-07-31 0:06 ` Paul Eggleton [this message]
2012-07-31 0:06 ` [PATCH 7/7] combo-layer: allow splitting out local config Paul Eggleton
2012-07-31 4:55 ` [PATCH 0/7] combo-layer improvements McClintock Matthew-B29882
2012-07-31 10:46 ` Paul Eggleton
2012-07-31 11:07 ` Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c0c6856ea08dc44a97da9f4da0100805e6b371c0.1343693147.git.paul.eggleton@linux.intel.com \
--to=paul.eggleton@linux.intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox