mirror of
https://git.yoctoproject.org/poky
synced 2026-09-24 22:36:21 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
5d7437ea86
commit
1f4830734a
@@ -657,26 +657,23 @@ def update_recipe(args, config, basepath, workspace):
|
|||||||
existing_patches = oe.recipeutils.get_recipe_patches(rd)
|
existing_patches = oe.recipeutils.get_recipe_patches(rd)
|
||||||
|
|
||||||
removepatches = []
|
removepatches = []
|
||||||
seqpatch_re = re.compile('^[0-9]{4}-')
|
seqpatch_re = re.compile('^([0-9]{4}-)?(.+)')
|
||||||
if not args.no_remove:
|
if not args.no_remove:
|
||||||
# Get all patches from source tree and check if any should be removed
|
# Get all patches from source tree and check if any should be removed
|
||||||
tempdir = tempfile.mkdtemp(prefix='devtool')
|
tempdir = tempfile.mkdtemp(prefix='devtool')
|
||||||
try:
|
try:
|
||||||
GitApplyTree.extractPatches(srctree, initial_rev, tempdir)
|
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:
|
for patch in existing_patches:
|
||||||
# If it's a git sequence named patch, the numbers might not match up
|
basename = seqpatch_re.match(
|
||||||
# since we are starting from a different revision
|
os.path.basename(patch)).group(2)
|
||||||
# This does assume that people are using unique shortlog values, but
|
if basename not in newpatches:
|
||||||
# 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:
|
|
||||||
removepatches.append(patch)
|
removepatches.append(patch)
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(tempdir)
|
shutil.rmtree(tempdir)
|
||||||
|
|||||||
Reference in New Issue
Block a user