diff options
author | Vyacheslav Yurkov <uvv.mail@gmail.com> | 2024-01-16 09:23:21 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-19 12:21:22 +0000 |
commit | 3e579c303ee087e8705a36f4dbec8db4782a6ab4 (patch) | |
tree | 7bfaaf8a2215b4cdb5696d95f5664bec4330e081 /meta/classes | |
parent | d5e2279d21410cc4684a5fc903fa079e7efb1c54 (diff) | |
download | poky-3e579c303ee087e8705a36f4dbec8db4782a6ab4.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.
(From OE-Core rev: 8f6320c0858941b2441e290ef3586b48c2700cd1)
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.bbclass | 9 |
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() { | |||
103 | pathMajor = fetcher.ud[url].parm.get('go_pathmajor') | 103 | pathMajor = fetcher.ud[url].parm.get('go_pathmajor') |
104 | pathMajor = None if not pathMajor else pathMajor.strip('/') | 104 | pathMajor = None if not pathMajor else pathMajor.strip('/') |
105 | 105 | ||
106 | if not repo in modules: | 106 | if not (repo, version) in modules: |
107 | modules[repo] = { "version": version, | 107 | modules[(repo, version)] = { |
108 | "repo_path": os.path.join(import_dir, p), | 108 | "repo_path": os.path.join(import_dir, p), |
109 | "module_path": module_path, | 109 | "module_path": module_path, |
110 | "subdir": subdir, | 110 | "subdir": subdir, |
111 | "pathMajor": pathMajor } | 111 | "pathMajor": pathMajor } |
112 | 112 | ||
113 | for module_key in sorted(modules): | 113 | for module_key, module in modules.items(): |
114 | 114 | ||
115 | # only take the version which is explicitly listed | 115 | # only take the version which is explicitly listed |
116 | # as a dependency in the go.mod | 116 | # as a dependency in the go.mod |
117 | module = modules[module_key] | ||
118 | module_path = module['module_path'] | 117 | module_path = module['module_path'] |
119 | rootdir = module['repo_path'] | 118 | rootdir = module['repo_path'] |
120 | subdir = module['subdir'] | 119 | subdir = module['subdir'] |
@@ -139,7 +138,7 @@ python do_go_vendor() { | |||
139 | dst = os.path.join(vendor_dir, module_path) | 138 | dst = os.path.join(vendor_dir, module_path) |
140 | 139 | ||
141 | bb.debug(1, "cp %s --> %s" % (src, dst)) | 140 | bb.debug(1, "cp %s --> %s" % (src, dst)) |
142 | shutil.copytree(src, dst, symlinks=True, \ | 141 | shutil.copytree(src, dst, symlinks=True, dirs_exist_ok=True, \ |
143 | ignore=shutil.ignore_patterns(".git", \ | 142 | ignore=shutil.ignore_patterns(".git", \ |
144 | "vendor", \ | 143 | "vendor", \ |
145 | "*._test.go")) | 144 | "*._test.go")) |