summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorVyacheslav Yurkov <uvv.mail@gmail.com>2024-01-16 09:23:20 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-19 11:53:56 +0000
commit16da5d9ad448aafd8b5fd63480727bd1b09ec9f1 (patch)
treec32fecfc6061b77c6ef7af40bc0019b2c299a8ba /meta/classes
parent9f220f61e3e44a650a46ee997b47f1d87b7c4ef0 (diff)
downloadopenembedded-core-16da5d9ad448aafd8b5fd63480727bd1b09ec9f1.tar.gz
classes: go-vendor: Reference local modules
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.mail@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/go-vendor.bbclass18
1 files changed, 17 insertions, 1 deletions
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)
}