summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Rosa <andre.rosa@lge.com>2019-04-06 01:28:25 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-09 13:44:32 +0100
commit610ac84170f8a91cc3321edfc336a9e39f24ebe3 (patch)
tree236b5c7566c64b6e7575c46db46c3a10db2beb16
parent52657215bcffc022821395950cf3236250370223 (diff)
downloadopenembedded-core-610ac84170f8a91cc3321edfc336a9e39f24ebe3.tar.gz
lib/oe/utils: Make prune_suffix prune a suffix
... 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 https://github.com/openembedded/bitbake/pull/24 . There it stops replacing sufixes once first one is matched but not here. Signed-off-by: Andre Rosa <andre.rosa@lge.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index cedd053d36..a4fd79ccb2 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -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