diff mbox series

spdx: Fix license parsing

Message ID 20230525-spdx-parse-license-v1-1-c5e1f6218487@baylibre.com
State Accepted, archived
Commit 28c704bdf731f1c5012b74e4fdb899622f15a7b1
Headers show
Series spdx: Fix license parsing | expand

Commit Message

Louis Rannou May 25, 2023, 8:53 a.m. UTC
[YOCTO #14890] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=14890#c3

Since spaces in the license name are not mandatory, we need to add spaces around
 `|` and `&` before spliting.

Signed-off-by: Louis Rannou <lrannou@baylibre.com>
---
 meta/classes/create-spdx-2.2.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 0b44b95ab2be378b03e14953fd482ee4c9a19973
change-id: 20230525-spdx-parse-license-e8b0305a8a6d

Best regards,
diff mbox series

Patch

diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass
index 13d13fe1fc..e0f62a43a2 100644
--- a/meta/classes/create-spdx-2.2.bbclass
+++ b/meta/classes/create-spdx-2.2.bbclass
@@ -167,7 +167,7 @@  def convert_license_to_spdx(lic, document, d, existing={}):
 
         return spdx_license
 
-    lic_split = lic.replace("(", " ( ").replace(")", " ) ").split()
+    lic_split = lic.replace("(", " ( ").replace(")", " ) ").replace("|", " | ").replace("&", " & ").split()
 
     return ' '.join(convert(l) for l in lic_split)