bitbake: bblayers/query: Fix using "removeprefix" string method

The minimum Python version required for Yocto 5.0 is 3.8 which causes
failure in poky/bitbake/lib/bblayers/query.py when listing layers by
using command "bitbake-layers show-recipes -f --bare --mc MC" for the
given multiconfig MC.
The reason for that failure is the use of "removeprefix" string method
which got introduced in Python 3.9.
This patch replaces the "removeprefix" method with an equivalent
solution supported by Python 3.8.

(Bitbake rev: 58e5c70a0572ff5994dc181694e05cd5d3ddaf66)

Signed-off-by: Joerg Schmidt <joerg.schmidt@garmin.com>
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
Joerg Schmidt 2025-02-20 08:35:59 -07:00 committed by Steve Sakoman
parent 1cbcbab055
commit 4355f14793

View File

@ -145,7 +145,8 @@ skipped recipes will also be listed, with a " (skipped)" suffix.
skiplist = list(self.tinfoil.cooker.skiplist_by_mc[mc].keys())
if mc:
skiplist = [s.removeprefix(f'mc:{mc}:') for s in skiplist]
mcspec = f'mc:{mc}:'
skiplist = [s[len(mcspec):] if s.startswith(mcspec) else s for s in skiplist]
for fn in skiplist:
recipe_parts = os.path.splitext(os.path.basename(fn))[0].split('_')