aboutsummaryrefslogtreecommitdiffstats
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:12:00 +0100
commitaff88bcebe335b0277df660ac22eeed28d65da44 (patch)
treeba1d5dba02d52493d99f1daba6025dceaade23b4 /scripts
parent17206934822aab31d93318bffea8099bf9965112 (diff)
downloadopenembedded-core-contrib-aff88bcebe335b0277df660ac22eeed28d65da44.tar.gz
devtool: simplify the logic of determining patches to be removed
A slight simplification of the code. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
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):
existing_patches = oe.recipeutils.get_recipe_patches(rd)
removepatches = []
- seqpatch_re = re.compile('^[0-9]{4}-')
+ seqpatch_re = re.compile('^([0-9]{4}-)?(.+)')
if not args.no_remove:
# Get all patches from source tree and check if any should be removed
tempdir = tempfile.mkdtemp(prefix='devtool')
try:
GitApplyTree.extractPatches(srctree, initial_rev, tempdir)
- newpatches = os.listdir(tempdir)
+ # Strip numbering from patch names. If it's a git sequence
+ # named patch, the numbers might not match up since we are
+ # starting from a different revision This does assume that
+ # people are using unique shortlog values, but they ought to be
+ # anyway...
+ newpatches = [seqpatch_re.match(fname).group(2) for fname in
+ os.listdir(tempdir)]
for patch in existing_patches:
- # If it's a git sequence named patch, the numbers might not match up
- # since we are starting from a different revision
- # This does assume that people are using unique shortlog values, but
- # they ought to be anyway...
- patchfile = os.path.basename(patch)
- if seqpatch_re.search(patchfile):
- for newpatch in newpatches:
- if seqpatch_re.search(newpatch) and patchfile[5:] == newpatch[5:]:
- break
- else:
- removepatches.append(patch)
- elif patchfile not in newpatches:
+ basename = seqpatch_re.match(
+ os.path.basename(patch)).group(2)
+ if basename not in newpatches:
removepatches.append(patch)
finally:
shutil.rmtree(tempdir)