summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorVyacheslav Yurkov <uvv.mail@gmail.com>2024-01-16 09:23:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-01-19 11:53:56 +0000
commit8f6320c0858941b2441e290ef3586b48c2700cd1 (patch)
tree09fa44cdf06a3e1d221b39a02e9cb32b895ffd21 /meta/classes
parent16da5d9ad448aafd8b5fd63480727bd1b09ec9f1 (diff)
downloadopenembedded-core-contrib-8f6320c0858941b2441e290ef3586b48c2700cd1.tar.gz
classes: go-vendor: Handle modules from the same repo
Take into account module version when populating vendor directory, because a module with the same URL but with a different version tag could be used as an indirect dependency. 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.bbclass9
1 files changed, 4 insertions, 5 deletions
diff --git a/meta/classes/go-vendor.bbclass b/meta/classes/go-vendor.bbclass
index b965428dd1..48f4d1041c 100644
--- a/meta/classes/go-vendor.bbclass
+++ b/meta/classes/go-vendor.bbclass
@@ -103,18 +103,17 @@ python do_go_vendor() {
pathMajor = fetcher.ud[url].parm.get('go_pathmajor')
pathMajor = None if not pathMajor else pathMajor.strip('/')
- if not repo in modules:
- modules[repo] = { "version": version,
+ if not (repo, version) in modules:
+ modules[(repo, version)] = {
"repo_path": os.path.join(import_dir, p),
"module_path": module_path,
"subdir": subdir,
"pathMajor": pathMajor }
- for module_key in sorted(modules):
+ for module_key, module in modules.items():
# only take the version which is explicitly listed
# as a dependency in the go.mod
- module = modules[module_key]
module_path = module['module_path']
rootdir = module['repo_path']
subdir = module['subdir']
@@ -139,7 +138,7 @@ python do_go_vendor() {
dst = os.path.join(vendor_dir, module_path)
bb.debug(1, "cp %s --> %s" % (src, dst))
- shutil.copytree(src, dst, symlinks=True, \
+ shutil.copytree(src, dst, symlinks=True, dirs_exist_ok=True, \
ignore=shutil.ignore_patterns(".git", \
"vendor", \
"*._test.go"))