diff --git a/classes/external-toolchain.bbclass b/classes/external-toolchain.bbclass index 4434617..1923a23 100644 --- a/classes/external-toolchain.bbclass +++ b/classes/external-toolchain.bbclass @@ -201,6 +201,12 @@ def search_sysroots(path_entries, sysroots): else: yield path, None +def find_sysroot_files(paths, d): + sysroots, mirrors = get_file_search_metadata(d) + expanded = expand_paths(paths, mirrors) + search_results = search_sysroots(expanded, sysroots) + return [v for k, v in search_results] + # Change do_install's CWD to EXTERNAL_TOOLCHAIN for convenience do_install[dirs] = "${D} ${EXTERNAL_TOOLCHAIN}" diff --git a/recipes-external/glibc/glibc-external.bb b/recipes-external/glibc/glibc-external.bb index 29f474f..4c76bc9 100644 --- a/recipes-external/glibc/glibc-external.bb +++ b/recipes-external/glibc/glibc-external.bb @@ -4,12 +4,12 @@ require recipes-core/glibc/glibc-common.inc inherit external-toolchain def get_external_libc_version(d): - sysroot = d.getVar('EXTERNAL_TOOLCHAIN_SYSROOT', True) - libpath = os.path.join(sysroot, 'lib') - if os.path.exists(libpath): - for filename in os.listdir(libpath): - if filename.startswith('libc-'): - return filename[5:-3] + sopattern = os.path.join(d.getVar('base_libdir', True), 'libc-*.so') + found_paths = find_sysroot_files([sopattern], d) + if found_paths: + so_paths = found_paths[0] + soname = os.path.basename(so_paths[0]) + return soname[5:-3] return 'UNKNOWN' @@ -25,20 +25,20 @@ PROVIDES += "glibc \ 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') + errnosearch = os.path.join(d.getVar('includedir', True), 'errno.h') + found = find_sysroot_files([errnosearch], d) + if found: + errno_paths = found[0] + with open(errno_paths[0], 'rU') as f: + text = f.read() - with open(errnopath, 'rU') as f: - text = f.read() - - lictext = """ The GNU C Library is free software; you can redistribute it and/or + 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+' + if lictext in text: + return 'LGPL-2.1+' return 'UNKNOWN'