summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2024-09-12 23:06:14 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-09-17 12:17:28 +0100
commitf29065127900568085746a4b2dff452a67abea7b (patch)
treec42a452e56a30ef899e29661b90cafa0884b9c29
parentd141a3f1ef04bb35dd84c78034f431d9c26830b8 (diff)
downloadpoky-f29065127900568085746a4b2dff452a67abea7b.tar.gz
bitbake: fetch2/gomod: Support URIs with only a hostname
When calculating the module name for a gomod URI with only a hostname, e.g.: gomod://go.opencensus.io;version=v0.24.0;sha256sum=203a767d7f8e7c1ebe5588220ad168d1e15b14ae70a636de7ca9a4a88a7e0d0c the non-existing path would actually be treated as "/", which resulted in a trailing slash being added to the module name preventing the unpack method from correctly locating the go.mod file. (Bitbake rev: f0e02e1de4d649e647e4ab61341042dd38d0eeb0) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/gomod.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/gomod.py b/bitbake/lib/bb/fetch2/gomod.py
index 1b532d03ff..21fbe80f56 100644
--- a/bitbake/lib/bb/fetch2/gomod.py
+++ b/bitbake/lib/bb/fetch2/gomod.py
@@ -103,7 +103,9 @@ class GoMod(Wget):
103 if 'version' not in ud.parm: 103 if 'version' not in ud.parm:
104 raise MissingParameterError('version', ud.url) 104 raise MissingParameterError('version', ud.url)
105 105
106 module = ud.host + ud.path 106 module = ud.host
107 if ud.path != '/':
108 module += ud.path
107 ud.parm['module'] = module 109 ud.parm['module'] = module
108 110
109 # Set URL and filename for wget download 111 # Set URL and filename for wget download
@@ -174,7 +176,9 @@ class GoModGit(Git):
174 if 'version' not in ud.parm: 176 if 'version' not in ud.parm:
175 raise MissingParameterError('version', ud.url) 177 raise MissingParameterError('version', ud.url)
176 178
177 module = ud.host + ud.path 179 module = ud.host
180 if ud.path != '/':
181 module += ud.path
178 ud.parm['module'] = module 182 ud.parm['module'] = module
179 183
180 # Set host, path and srcrev for git download 184 # Set host, path and srcrev for git download