summaryrefslogtreecommitdiffstats
path: root/scripts/combo-layer
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 08:02:10 +0100
commit8140c5b7ee1e9a6fb8860ff9e2f9d88ccff48ee6 (patch)
tree4dfd8acc546e4978818a270e8a322be2e71023ad /scripts/combo-layer
parent2dc0b337bc53c94ca60423dd0a39086bb62d36ef (diff)
downloadpoky-8140c5b7ee1e9a6fb8860ff9e2f9d88ccff48ee6.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]. (From OE-Core rev: 65461d7c35fdadb5b008052798731dce19ed187f) 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-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):
263 repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name) 263 repo_patch_dir = os.path.join(os.getcwd(), patch_dir, name)
264 264
265 # Step 2: generate the patch list and store to patch dir 265 # Step 2: generate the patch list and store to patch dir
266 logger.info("generating patches for %s" % name) 266 logger.info("Generating patches from %s..." % name)
267 if dest_dir != ".": 267 if dest_dir != ".":
268 prefix = "--src-prefix=a/%s/ --dst-prefix=b/%s/" % (dest_dir, dest_dir) 268 prefix = "--src-prefix=a/%s/ --dst-prefix=b/%s/" % (dest_dir, dest_dir)
269 else: 269 else:
@@ -337,27 +337,50 @@ def apply_patchlist(conf, repos):
337 repo = conf.repos[name] 337 repo = conf.repos[name]
338 lastrev = repo["last_revision"] 338 lastrev = repo["last_revision"]
339 prevrev = lastrev 339 prevrev = lastrev
340 for line in open(repo['patchlist']): 340
341 patchfile = line.split()[0] 341 # Get non-blank lines from patch list file
342 lastrev = line.split()[1] 342 patchlist = []
343 if os.path.getsize(patchfile) == 0: 343 if os.path.exists(repo['patchlist']) or not conf.interactive:
344 logger.info("(skipping %s - no changes)", lastrev) 344 # Note: we want this to fail here if the file doesn't exist and we're not in
345 else: 345 # interactive mode since the file should exist in this case
346 cmd = "git am --keep-cr -s -p1 %s" % patchfile 346 with open(repo['patchlist']) as f:
347 logger.info("Apply %s" % patchfile ) 347 for line in f:
348 try: 348 line = line.rstrip()
349 runcmd(cmd) 349 if line:
350 except subprocess.CalledProcessError: 350 patchlist.append(line)
351 logger.info('running "git am --abort" to cleanup repo') 351
352 runcmd("git am --abort") 352 if patchlist:
353 logger.error('"%s" failed' % cmd) 353 logger.info("Applying patches from %s..." % name)
354 logger.info("please manually apply patch %s" % patchfile) 354 linecount = len(patchlist)
355 logger.info("Note: if you exit and continue applying without manually applying the patch, it will be skipped") 355 i = 1
356 if not drop_to_shell(): 356 for line in patchlist:
357 if prevrev != repo['last_revision']: 357 patchfile = line.split()[0]
358 conf.update(name, "last_revision", prevrev) 358 lastrev = line.split()[1]
359 sys.exit(0) 359 patchdisp = os.path.relpath(patchfile)
360 prevrev = lastrev 360 if os.path.getsize(patchfile) == 0:
361 logger.info("(skipping %d/%d %s - no changes)" % (i, linecount, patchdisp))
362 else:
363 cmd = "git am --keep-cr -s -p1 %s" % patchfile
364 logger.info("Applying %d/%d: %s" % (i, linecount, patchdisp))
365 try:
366 runcmd(cmd)
367 except subprocess.CalledProcessError:
368 logger.info('Running "git am --abort" to cleanup repo')
369 runcmd("git am --abort")
370 logger.error('"%s" failed' % cmd)
371 logger.info("Please manually apply patch %s" % patchdisp)
372 logger.info("Note: if you exit and continue applying without manually applying the patch, it will be skipped")
373 if not drop_to_shell():
374 if prevrev != repo['last_revision']:
375 conf.update(name, "last_revision", prevrev)
376 sys.exit(0)
377 prevrev = lastrev
378 i += 1
379 else:
380 logger.info("No patches to apply from %s" % name)
381 ldir = conf.repos[name]['local_repo_dir']
382 lastrev = runcmd("git rev-parse HEAD", ldir).strip()
383
361 if lastrev != repo['last_revision']: 384 if lastrev != repo['last_revision']:
362 conf.update(name, "last_revision", lastrev) 385 conf.update(name, "last_revision", lastrev)
363 386