1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 17:39:31 +00:00

bitbake: fetch2: do not prefix embedded checksums

The fetcher support entries with an embedded checksum like 'sha256sum'
in the SRC_URI. It adds the parameter 'name' as prefix to the checksums
if the parameter is set. This behavior is unexpected and leads to hacks
in fetchers. Fallback to the checksum without the useless prefix and
set the parameter 'name' in the gomod fetcher unconditional.

(Bitbake rev: 7a86c5a20ea2586f1ae240613644e065e7b21683)

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Stefan Herbrechtsmeier
2025-01-07 10:17:56 +01:00
committed by Richard Purdie
parent e040b45ad2
commit d7c6afc9a9
3 changed files with 7 additions and 11 deletions
+6 -3
View File
@@ -1316,20 +1316,23 @@ class FetchData(object):
self.setup = False
def configure_checksum(checksum_id):
checksum_plain_name = "%ssum" % checksum_id
if "name" in self.parm:
checksum_name = "%s.%ssum" % (self.parm["name"], checksum_id)
else:
checksum_name = "%ssum" % checksum_id
setattr(self, "%s_name" % checksum_id, checksum_name)
checksum_name = checksum_plain_name
if checksum_name in self.parm:
checksum_expected = self.parm[checksum_name]
elif checksum_plain_name in self.parm:
checksum_expected = self.parm[checksum_plain_name]
checksum_name = checksum_plain_name
elif self.type not in ["http", "https", "ftp", "ftps", "sftp", "s3", "az", "crate", "gs", "gomod"]:
checksum_expected = None
else:
checksum_expected = d.getVarFlag("SRC_URI", checksum_name)
setattr(self, "%s_name" % checksum_id, checksum_name)
setattr(self, "%s_expected" % checksum_id, checksum_expected)
self.names = self.parm.get("name",'default').split(',')
+1 -4
View File
@@ -119,10 +119,7 @@ class GoMod(Wget):
('https', proxy, '/' + path, None, None, None))
ud.parm['downloadfilename'] = path
# Set name parameter if sha256sum is set in recipe
name = f"{module}@{ud.parm['version']}"
if d.getVarFlag('SRC_URI', name + '.sha256sum'):
ud.parm['name'] = name
ud.parm['name'] = f"{module}@{ud.parm['version']}"
# Set subdir for unpack
ud.parm['subdir'] = os.path.join(moddir, 'cache/download',
-4
View File
@@ -3391,7 +3391,6 @@ class GoModTest(FetcherTest):
fetcher = bb.fetch2.Fetch(urls, self.d)
ud = fetcher.ud[urls[0]]
self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.zip')
self.assertNotIn('name', ud.parm)
fetcher.download()
fetcher.unpack(self.unpackdir)
@@ -3409,7 +3408,6 @@ class GoModTest(FetcherTest):
fetcher = bb.fetch2.Fetch(urls, self.d)
ud = fetcher.ud[urls[0]]
self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.mod')
self.assertNotIn('name', ud.parm)
fetcher.download()
fetcher.unpack(self.unpackdir)
@@ -3442,7 +3440,6 @@ class GoModTest(FetcherTest):
fetcher = bb.fetch2.Fetch(urls, self.d)
ud = fetcher.ud[urls[0]]
self.assertEqual(ud.url, 'https://proxy.golang.org/gopkg.in/ini.v1/%40v/v1.67.0.zip')
self.assertNotIn('name', ud.parm)
fetcher.download()
fetcher.unpack(self.unpackdir)
@@ -3460,7 +3457,6 @@ class GoModTest(FetcherTest):
fetcher = bb.fetch2.Fetch(urls, self.d)
ud = fetcher.ud[urls[0]]
self.assertEqual(ud.url, 'https://proxy.golang.org/go.opencensus.io/%40v/v0.24.0.zip')
self.assertNotIn('name', ud.parm)
fetcher.download()
fetcher.unpack(self.unpackdir)