Browse Source

utils: Make prune_suffix prune a suffix

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.

Signed-off-by: Andre Rosa <andre.rosa@lge.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Andre Rosa 5 years ago
parent
commit
57e765e38c
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lib/bb/utils.py

+ 2 - 2
lib/bb/utils.py

@@ -722,8 +722,8 @@ 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):
-            return var.replace(suffix, "")
+        if suffix and var.endswith(suffix):
+            return var[:-len(suffix)]
     return var
 
 def mkdirhier(directory):