Skip to content

Commit

Permalink
lib/oe/utils: Make prune_suffix prune a suffix
Browse files Browse the repository at this point in the history
... instead of replacing a substring that could happen more than once and not only when it ends with it. Do the same for the prefix.

See related openembedded/bitbake#24 . There it stops replacing sufixes once first one is matched but not here.

(From OE-Core rev: 3a820c492f674fd464423dbc1ba18e80472e2e4b)

Signed-off-by: Andre Rosa <andre.rosa@lge.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
andre-rosa authored and rpurdie committed Apr 8, 2019
1 parent b996524 commit 4c04360
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions meta/lib/oe/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ def prune_suffix(var, suffixes, d):
# See if var ends with any of the suffixes listed and
# remove it if found
for suffix in suffixes:
if var.endswith(suffix):
var = var.replace(suffix, "")
if suffix and var.endswith(suffix):
var = var[:-len(suffix)]

prefix = d.getVar("MLPREFIX")
if prefix and var.startswith(prefix):
var = var.replace(prefix, "")
var = var[len(prefix):]

return var

Expand Down

0 comments on commit 4c04360

Please sign in to comment.