Create symlinks for local modules, which are usually not referenced in the SRC_URI, but still expected to be found in the vendor directory during the build.
Signed-off-by: Vyacheslav Yurkov <uvv.m...@gmail.com> --- meta/classes/go-vendor.bbclass | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/meta/classes/go-vendor.bbclass b/meta/classes/go-vendor.bbclass index 2426bddfba..b965428dd1 100644 --- a/meta/classes/go-vendor.bbclass +++ b/meta/classes/go-vendor.bbclass @@ -169,6 +169,7 @@ python do_go_vendor() { fetched_paths.remove('.') vendored_paths = set() + replaced_paths = dict() with open(modules_txt_src) as f: for line in f: if not line.startswith("#"): @@ -182,6 +183,15 @@ python do_go_vendor() { vendored_paths.add(topdir) topdir = os.path.dirname(topdir) + else: + replaced_module = line.split("=>") + if len(replaced_module) > 1: + # This module has been replaced, use a local path + # we parse the line that has a pattern "# module-name [module-version] => local-path + actual_path = replaced_module[1].strip() + vendored_name = replaced_module[0].split()[1] + bb.debug(1, "added vendored name %s for actual path %s" % (vendored_name, actual_path)) + replaced_paths[vendored_name] = actual_path for path in fetched_paths: if path not in vendored_paths: @@ -189,7 +199,13 @@ python do_go_vendor() { if os.path.exists(realpath): shutil.rmtree(realpath) - # Create a symlink the the actual directory + for vendored_name, replaced_path in replaced_paths.items(): + symlink_target = os.path.join(source_dir, *['src', go_import, replaced_path]) + symlink_name = os.path.join(vendor_dir, vendored_name) + bb.debug(1, "vendored name %s, symlink name %s" % (vendored_name, symlink_name)) + os.symlink(symlink_target, symlink_name) + + # Create a symlink to the actual directory os.symlink(vendor_dir, linkname) } -- 2.35.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#193825): https://lists.openembedded.org/g/openembedded-core/message/193825 Mute This Topic: https://lists.openembedded.org/mt/103758365/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-