]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/lsb: Make sure the distro ID is always lowercased
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Fri, 27 Sep 2019 10:33:52 +0000 (12:33 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 27 Sep 2019 12:37:23 +0000 (13:37 +0100)
In commit 8689e561 (lib/oe/lsb: attempt to ensure consistent distro id
regardless of source), the distro ID returned by
oe.lsb.distro_identifier() was lowercased, but only if a release
version is also present.

This changes the code to always lowercase the distro ID, including the
default distro ID "unknown", which is used if no other ID can be
identified.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/lsb.py

index 4f2b419edce574d272013814bca7569130f0c5ee..43e46380d7b8c71a60d6dd329fe2fabac7ab4927 100644 (file)
@@ -110,12 +110,12 @@ def distro_identifier(adjust_hook=None):
     if adjust_hook:
         distro_id, release = adjust_hook(distro_id, release)
     if not distro_id:
-        return "Unknown"
-    # Filter out any non-alphanumerics
-    distro_id = re.sub(r'\W', '', distro_id)
+        return "unknown"
+    # Filter out any non-alphanumerics and convert to lowercase
+    distro_id = re.sub(r'\W', '', distro_id).lower()
 
     if release:
-        id_str = '{0}-{1}'.format(distro_id.lower(), release)
+        id_str = '{0}-{1}'.format(distro_id, release)
     else:
         id_str = distro_id
     return id_str.replace(' ','-').replace('/','-')