]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/utils: Make prune_suffix prune a suffix
authorAndre Rosa <andre.rosa@lge.com>
Sat, 6 Apr 2019 01:28:25 +0000 (01:28 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 9 Apr 2019 12:44:32 +0000 (13:44 +0100)
... 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>
meta/lib/oe/utils.py

index cedd053d3623f3797b1f09c4f12df19eb4ec31e7..a4fd79ccb217187cb79240f6d4b6643bd85668b1 100644 (file)
@@ -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