summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-07-31 01:06:24 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-07-31 07:57:07 +0100
commit65461d7c35fdadb5b008052798731dce19ed187f (patch)
treec1aa8abfca5b45fbd031d83db0c749dee4c4bbc2 /scripts
parentc82b28982c4f630c130c827a7da3ac0454cd93b6 (diff)
downloadopenembedded-core-contrib-65461d7c35fdadb5b008052798731dce19ed187f.tar.gz
combo-layer: improve patch list handling and output
* Ignore blank lines in patch list * Don't fail in interactive mode if patch list is deleted * Show patch counter * Show relative path for patches * Print headings before applying patch list for each component Also change to using a "with" block to read the patch list so it gets closed properly when we're finished. Fixes [YOCTO #2455]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/combo-layer67
1 files changed, 45 insertions, 22 deletions
diff --git a/scripts/combo-layer b/scripts/combo-layer
index 4025b72a87..40e63b9ede 100755
--- a/scripts/combo-layer
+++ b/scripts/combo-layer
@@ -263,7 +263,7 @@ def action_update(conf, args):
repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name)
# Step 2: generate the patch list and store to patch dir
- logger.info("generating patches for %s" % name)
+ logger.info("Generating patches from %s..." % name)
if dest_dir != ".":
prefix = "--src-prefix=a/%s/ --dst-prefix=b/%s/" % (dest_dir, dest_dir)
else:
@@ -337,27 +337,50 @@ def apply_patchlist(conf, repos):
repo = conf.repos[name]
lastrev = repo["last_revision"]
prevrev = lastrev
- for line in open(repo['patchlist']):
- patchfile = line.split()[0]
- lastrev = line.split()[1]
- if os.path.getsize(patchfile) == 0:
- logger.info("(skipping %s - no changes)", lastrev)
- else:
- cmd = "git am --keep-cr -s -p1 %s" % patchfile
- logger.info("Apply %s" % patchfile )
- try:
- runcmd(cmd)
- except subprocess.CalledProcessError:
- logger.info('running "git am --abort" to cleanup repo')
- runcmd("git am --abort")
- logger.error('"%s" failed' % cmd)
- logger.info("please manually apply patch %s" % patchfile)
- logger.info("Note: if you exit and continue applying without manually applying the patch, it will be skipped")
- if not drop_to_shell():
- if prevrev != repo['last_revision']:
- conf.update(name, "last_revision", prevrev)
- sys.exit(0)
- prevrev = lastrev
+
+ # Get non-blank lines from patch list file
+ patchlist = []
+ if os.path.exists(repo['patchlist']) or not conf.interactive:
+ # Note: we want this to fail here if the file doesn't exist and we're not in
+ # interactive mode since the file should exist in this case
+ with open(repo['patchlist']) as f:
+ for line in f:
+ line = line.rstrip()
+ if line:
+ patchlist.append(line)
+
+ if patchlist:
+ logger.info("Applying patches from %s..." % name)
+ linecount = len(patchlist)
+ i = 1
+ for line in patchlist:
+ patchfile = line.split()[0]
+ lastrev = line.split()[1]
+ patchdisp = os.path.relpath(patchfile)
+ if os.path.getsize(patchfile) == 0:
+ logger.info("(skipping %d/%d %s - no changes)" % (i, linecount, patchdisp))
+ else:
+ cmd = "git am --keep-cr -s -p1 %s" % patchfile
+ logger.info("Applying %d/%d: %s" % (i, linecount, patchdisp))
+ try:
+ runcmd(cmd)
+ except subprocess.CalledProcessError:
+ logger.info('Running "git am --abort" to cleanup repo')
+ runcmd("git am --abort")
+ logger.error('"%s" failed' % cmd)
+ logger.info("Please manually apply patch %s" % patchdisp)
+ logger.info("Note: if you exit and continue applying without manually applying the patch, it will be skipped")
+ if not drop_to_shell():
+ if prevrev != repo['last_revision']:
+ conf.update(name, "last_revision", prevrev)
+ sys.exit(0)
+ prevrev = lastrev
+ i += 1
+ else:
+ logger.info("No patches to apply from %s" % name)
+ ldir = conf.repos[name]['local_repo_dir']
+ lastrev = runcmd("git rev-parse HEAD", ldir).strip()
+
if lastrev != repo['last_revision']:
conf.update(name, "last_revision", lastrev)