diff options
-rw-r--r-- | classes/external-toolchain.bbclass | 4 | ||||
-rw-r--r-- | lib/oe/external.py | 17 |
2 files changed, 13 insertions, 8 deletions
diff --git a/classes/external-toolchain.bbclass b/classes/external-toolchain.bbclass index f32295d..e240558 100644 --- a/classes/external-toolchain.bbclass +++ b/classes/external-toolchain.bbclass @@ -79,7 +79,7 @@ python () { expanded = oe.external.expand_paths(search_patterns, mirrors) paths = oe.external.search_sysroots(expanded, sysroots) - if not any(f for p, f in paths): + if not any(f for p, s, f in paths): raise bb.parse.SkipPackage('No files found in external toolchain sysroot for: {}'.format(', '.join(search_patterns))) } @@ -93,7 +93,7 @@ python external_toolchain_do_install () { installdest = d.getVar('D', True) sysroots, mirrors = oe.external.get_file_search_metadata(d) files = oe.external.gather_pkg_files(d) - oe.external.copy_from_sysroots(files, sysroots, mirrors, installdest) + oe.external.copy_from_sysroots(files, sysroots, mirrors, installdest, dest_from_source=bb.utils.to_boolean(d.getVar('EXTERNAL_DEST_FROM_SOURCE') or '0')) if 'do_install_extra' in d: bb.build.exec_func('do_install_extra', d) subprocess.check_call(['chown', '-R', 'root:root', installdest]) diff --git a/lib/oe/external.py b/lib/oe/external.py index e03666c..3a54415 100644 --- a/lib/oe/external.py +++ b/lib/oe/external.py @@ -50,18 +50,23 @@ def gather_pkg_files(d): return files -def copy_from_sysroots(pathnames, sysroots, mirrors, installdest): +def copy_from_sysroots(pathnames, sysroots, mirrors, installdest, *, dest_from_source=False): '''Copy the specified files from the specified sysroots, also checking the specified mirror patterns as alternate paths, to the specified destination.''' import subprocess expanded_pathnames = expand_paths(pathnames, mirrors) searched_paths = search_sysroots(expanded_pathnames, sysroots) - for path, files in searched_paths: + for path, sysroot, files in searched_paths: if not files: bb.debug(1, 'Failed to find `{}`'.format(path)) else: - destdir = oe.path.join(installdest, os.path.dirname(path)) + if not dest_from_source: + destdir = oe.path.join(installdest, os.path.dirname(path)) + else: + files = list(files) + f = files[0] + destdir = oe.path.join(installdest, os.path.relpath(f, sysroot)) bb.utils.mkdirhier(destdir) subprocess.check_call(['cp', '-pPR'] + list(files) + [destdir + '/']) bb.note('Copied `{}` to `{}/`'.format(', '.join(files), destdir)) @@ -98,14 +103,14 @@ def search_sysroots(path_entries, sysroots): check_path = sysroot + os.sep + pathname found_paths = glob.glob(check_path) if found_paths: - yield path, found_paths + yield path, sysroot, found_paths break else: - yield path, None + yield path, sysroot, None def find_sysroot_files(paths, d): sysroots, mirrors = get_file_search_metadata(d) expanded = expand_paths(paths, mirrors) search_results = list(search_sysroots(expanded, sysroots)) - return [v for k, v in search_results] + return [f for p, s, f in search_results] |