summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-05-21 18:04:01 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-18 09:14:04 +0100
commit1f4830734ae7c69095238e3a8a5bf8c448f64985 (patch)
treeae95dcb6849a65b39faa7109ce12352cd39c3a08 /scripts
parent5d7437ea86960b4428ff13c57a90543cab140702 (diff)
downloadpoky-1f4830734ae7c69095238e3a8a5bf8c448f64985.tar.gz
devtool: simplify the logic of determining patches to be removed
A slight simplification of the code. (From OE-Core rev: aff88bcebe335b0277df660ac22eeed28d65da44) Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/devtool/standard.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index c8ba2474b1..aa95e6eeaf 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -657,26 +657,23 @@ def update_recipe(args, config, basepath, workspace):
657 existing_patches = oe.recipeutils.get_recipe_patches(rd) 657 existing_patches = oe.recipeutils.get_recipe_patches(rd)
658 658
659 removepatches = [] 659 removepatches = []
660 seqpatch_re = re.compile('^[0-9]{4}-') 660 seqpatch_re = re.compile('^([0-9]{4}-)?(.+)')
661 if not args.no_remove: 661 if not args.no_remove:
662 # Get all patches from source tree and check if any should be removed 662 # Get all patches from source tree and check if any should be removed
663 tempdir = tempfile.mkdtemp(prefix='devtool') 663 tempdir = tempfile.mkdtemp(prefix='devtool')
664 try: 664 try:
665 GitApplyTree.extractPatches(srctree, initial_rev, tempdir) 665 GitApplyTree.extractPatches(srctree, initial_rev, tempdir)
666 newpatches = os.listdir(tempdir) 666 # Strip numbering from patch names. If it's a git sequence
667 # named patch, the numbers might not match up since we are
668 # starting from a different revision This does assume that
669 # people are using unique shortlog values, but they ought to be
670 # anyway...
671 newpatches = [seqpatch_re.match(fname).group(2) for fname in
672 os.listdir(tempdir)]
667 for patch in existing_patches: 673 for patch in existing_patches:
668 # If it's a git sequence named patch, the numbers might not match up 674 basename = seqpatch_re.match(
669 # since we are starting from a different revision 675 os.path.basename(patch)).group(2)
670 # This does assume that people are using unique shortlog values, but 676 if basename not in newpatches:
671 # they ought to be anyway...
672 patchfile = os.path.basename(patch)
673 if seqpatch_re.search(patchfile):
674 for newpatch in newpatches:
675 if seqpatch_re.search(newpatch) and patchfile[5:] == newpatch[5:]:
676 break
677 else:
678 removepatches.append(patch)
679 elif patchfile not in newpatches:
680 removepatches.append(patch) 677 removepatches.append(patch)
681 finally: 678 finally:
682 shutil.rmtree(tempdir) 679 shutil.rmtree(tempdir)