Explorar o código

glibc-external: set LICENSE based on comment in errno.h

JIRA: SB-5005

Signed-off-by: Christopher Larson <kergoth@gmail.com>
Christopher Larson %!s(int64=9) %!d(string=hai) anos
pai
achega
e782e6e06f
Modificáronse 2 ficheiros con 22 adicións e 0 borrados
  1. 2 0
      TODO.md
  2. 20 0
      recipes-external/glibc/glibc-external.bb

+ 2 - 0
TODO.md

@@ -1,3 +1,5 @@
+- Adjust the hardcoded licenses based on version, for now. Better would be if
+  the external toolchain provided license data.
 - Handle relocating debug files based on PACKAGE_DEBUG_SPLIT_STYLE, in
   a general way, as a better way to handle 6d62e6f. Possibly do a regex
   search/replace:

+ 20 - 0
recipes-external/glibc/glibc-external.bb

@@ -24,6 +24,26 @@ PROVIDES += "glibc \
              virtual/libintl \
              virtual/libiconv"
 
+def get_external_libc_license(d):
+    sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT', True)
+    incpath = os.path.join(sysroot, d.getVar('includedir', True)[1:])
+    errnopath = os.path.join(incpath, 'errno.h')
+
+    with open(errnopath, 'rU') as f:
+        text = f.read()
+
+    lictext = """   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version."""
+
+    if lictext in text:
+        return 'LGPL-2.1+'
+
+    return 'UNKNOWN'
+
+LICENSE := "${@get_external_libc_license(d)}"
+
 require recipes-external/glibc/glibc-sysroot-setup.inc
 require recipes-external/glibc/glibc-package-adjusted.inc