summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/standard.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-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)