summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorJean-Francois Dagenais <jeff.dagenais@gmail.com>2020-09-23 09:44:06 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-23 20:55:53 +0100
commit20586411649fcad6f0459ce74a581374ab564737 (patch)
treee908d50e0ed04553cdbc8bece048b5a4045d850b /bitbake
parent304d7a08611132ca292aea2484659ccc5b804178 (diff)
downloadpoky-20586411649fcad6f0459ce74a581374ab564737.tar.gz
bitbake: bitbake: siggen: clean_basepath: improve perfo and readability
This change improves performance by reducing runtime about 33% for typical inputs. (using test_clean_basepath_performance) It is also easier to read, and slightly more resilient to future changes since it doesn't mention 'virtual' anymore. (Bitbake rev: 27b53186fa67d281d29b2f8e15bcff8dc2557b8a) Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> Co-Developed-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> Signed-off-by: Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/siggen.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/bitbake/lib/bb/siggen.py b/bitbake/lib/bb/siggen.py
index ad49d1e2aa..1456324a70 100644
--- a/bitbake/lib/bb/siggen.py
+++ b/bitbake/lib/bb/siggen.py
@@ -746,16 +746,26 @@ def list_inline_diff(oldlist, newlist, colors=None):
746 ret.append(item) 746 ret.append(item)
747 return '[%s]' % (', '.join(ret)) 747 return '[%s]' % (', '.join(ret))
748 748
749def clean_basepath(a): 749def clean_basepath(basepath):
750 mc = None 750 basepath, dir, recipe_task = basepath.rsplit("/", 2)
751 if a.startswith("mc:"): 751 cleaned = dir + '/' + recipe_task
752 _, mc, a = a.split(":", 2) 752
753 b = a.rsplit("/", 2)[1] + '/' + a.rsplit("/", 2)[2] 753 if basepath[0] == '/':
754 if a.startswith("virtual:"): 754 return cleaned
755 b = b + ":" + a.rsplit(":", 2)[0] 755
756 if mc: 756 if basepath.startswith("mc:"):
757 b = b + ":mc:" + mc 757 mc, mc_name, basepath = basepath.split(":", 2)
758 return b 758 mc_suffix = ':mc:' + mc_name
759 else:
760 mc_suffix = ''
761
762 # mc stuff now removed from basepath. Whatever was next, if present will be the first
763 # suffix. ':/', recipe path start, marks the end of this. Something like
764 # 'virtual:a[:b[:c]]:/path...' (b and c being optional)
765 if basepath[0] != '/':
766 cleaned += ':' + basepath.split(':/', 1)[0]
767
768 return cleaned + mc_suffix
759 769
760def clean_basepaths(a): 770def clean_basepaths(a):
761 b = {} 771 b = {}