diff options
| author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2025-01-07 10:17:56 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-01-08 11:34:04 +0000 |
| commit | d7c6afc9a97407238af814777f9148dedd507192 (patch) | |
| tree | e4abce959656d379fa3fac1e826a293f3a293799 /bitbake | |
| parent | e040b45ad211c773d8e557cc61d91ef73a98993d (diff) | |
| download | poky-d7c6afc9a97407238af814777f9148dedd507192.tar.gz | |
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>
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 9 | ||||
| -rw-r--r-- | bitbake/lib/bb/fetch2/gomod.py | 5 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 4 |
3 files changed, 7 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index f79e278b1c..3d31a8d4aa 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -1316,20 +1316,23 @@ class FetchData(object): | |||
| 1316 | self.setup = False | 1316 | self.setup = False |
| 1317 | 1317 | ||
| 1318 | def configure_checksum(checksum_id): | 1318 | def configure_checksum(checksum_id): |
| 1319 | checksum_plain_name = "%ssum" % checksum_id | ||
| 1319 | if "name" in self.parm: | 1320 | if "name" in self.parm: |
| 1320 | checksum_name = "%s.%ssum" % (self.parm["name"], checksum_id) | 1321 | checksum_name = "%s.%ssum" % (self.parm["name"], checksum_id) |
| 1321 | else: | 1322 | else: |
| 1322 | checksum_name = "%ssum" % checksum_id | 1323 | checksum_name = checksum_plain_name |
| 1323 | |||
| 1324 | setattr(self, "%s_name" % checksum_id, checksum_name) | ||
| 1325 | 1324 | ||
| 1326 | if checksum_name in self.parm: | 1325 | if checksum_name in self.parm: |
| 1327 | checksum_expected = self.parm[checksum_name] | 1326 | checksum_expected = self.parm[checksum_name] |
| 1327 | elif checksum_plain_name in self.parm: | ||
| 1328 | checksum_expected = self.parm[checksum_plain_name] | ||
| 1329 | checksum_name = checksum_plain_name | ||
| 1328 | elif self.type not in ["http", "https", "ftp", "ftps", "sftp", "s3", "az", "crate", "gs", "gomod"]: | 1330 | elif self.type not in ["http", "https", "ftp", "ftps", "sftp", "s3", "az", "crate", "gs", "gomod"]: |
| 1329 | checksum_expected = None | 1331 | checksum_expected = None |
| 1330 | else: | 1332 | else: |
| 1331 | checksum_expected = d.getVarFlag("SRC_URI", checksum_name) | 1333 | checksum_expected = d.getVarFlag("SRC_URI", checksum_name) |
| 1332 | 1334 | ||
| 1335 | setattr(self, "%s_name" % checksum_id, checksum_name) | ||
| 1333 | setattr(self, "%s_expected" % checksum_id, checksum_expected) | 1336 | setattr(self, "%s_expected" % checksum_id, checksum_expected) |
| 1334 | 1337 | ||
| 1335 | self.names = self.parm.get("name",'default').split(',') | 1338 | self.names = self.parm.get("name",'default').split(',') |
diff --git a/bitbake/lib/bb/fetch2/gomod.py b/bitbake/lib/bb/fetch2/gomod.py index 21fbe80f56..6c999e8ba0 100644 --- a/bitbake/lib/bb/fetch2/gomod.py +++ b/bitbake/lib/bb/fetch2/gomod.py | |||
| @@ -119,10 +119,7 @@ class GoMod(Wget): | |||
| 119 | ('https', proxy, '/' + path, None, None, None)) | 119 | ('https', proxy, '/' + path, None, None, None)) |
| 120 | ud.parm['downloadfilename'] = path | 120 | ud.parm['downloadfilename'] = path |
| 121 | 121 | ||
| 122 | # Set name parameter if sha256sum is set in recipe | 122 | ud.parm['name'] = f"{module}@{ud.parm['version']}" |
| 123 | name = f"{module}@{ud.parm['version']}" | ||
| 124 | if d.getVarFlag('SRC_URI', name + '.sha256sum'): | ||
| 125 | ud.parm['name'] = name | ||
| 126 | 123 | ||
| 127 | # Set subdir for unpack | 124 | # Set subdir for unpack |
| 128 | ud.parm['subdir'] = os.path.join(moddir, 'cache/download', | 125 | ud.parm['subdir'] = os.path.join(moddir, 'cache/download', |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index c5ec84dc55..6b8e3e060f 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -3391,7 +3391,6 @@ class GoModTest(FetcherTest): | |||
| 3391 | fetcher = bb.fetch2.Fetch(urls, self.d) | 3391 | fetcher = bb.fetch2.Fetch(urls, self.d) |
| 3392 | ud = fetcher.ud[urls[0]] | 3392 | ud = fetcher.ud[urls[0]] |
| 3393 | self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.zip') | 3393 | self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.zip') |
| 3394 | self.assertNotIn('name', ud.parm) | ||
| 3395 | 3394 | ||
| 3396 | fetcher.download() | 3395 | fetcher.download() |
| 3397 | fetcher.unpack(self.unpackdir) | 3396 | fetcher.unpack(self.unpackdir) |
| @@ -3409,7 +3408,6 @@ class GoModTest(FetcherTest): | |||
| 3409 | fetcher = bb.fetch2.Fetch(urls, self.d) | 3408 | fetcher = bb.fetch2.Fetch(urls, self.d) |
| 3410 | ud = fetcher.ud[urls[0]] | 3409 | ud = fetcher.ud[urls[0]] |
| 3411 | self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.mod') | 3410 | self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.mod') |
| 3412 | self.assertNotIn('name', ud.parm) | ||
| 3413 | 3411 | ||
| 3414 | fetcher.download() | 3412 | fetcher.download() |
| 3415 | fetcher.unpack(self.unpackdir) | 3413 | fetcher.unpack(self.unpackdir) |
| @@ -3442,7 +3440,6 @@ class GoModTest(FetcherTest): | |||
| 3442 | fetcher = bb.fetch2.Fetch(urls, self.d) | 3440 | fetcher = bb.fetch2.Fetch(urls, self.d) |
| 3443 | ud = fetcher.ud[urls[0]] | 3441 | ud = fetcher.ud[urls[0]] |
| 3444 | self.assertEqual(ud.url, 'https://proxy.golang.org/gopkg.in/ini.v1/%40v/v1.67.0.zip') | 3442 | self.assertEqual(ud.url, 'https://proxy.golang.org/gopkg.in/ini.v1/%40v/v1.67.0.zip') |
| 3445 | self.assertNotIn('name', ud.parm) | ||
| 3446 | 3443 | ||
| 3447 | fetcher.download() | 3444 | fetcher.download() |
| 3448 | fetcher.unpack(self.unpackdir) | 3445 | fetcher.unpack(self.unpackdir) |
| @@ -3460,7 +3457,6 @@ class GoModTest(FetcherTest): | |||
| 3460 | fetcher = bb.fetch2.Fetch(urls, self.d) | 3457 | fetcher = bb.fetch2.Fetch(urls, self.d) |
| 3461 | ud = fetcher.ud[urls[0]] | 3458 | ud = fetcher.ud[urls[0]] |
| 3462 | self.assertEqual(ud.url, 'https://proxy.golang.org/go.opencensus.io/%40v/v0.24.0.zip') | 3459 | self.assertEqual(ud.url, 'https://proxy.golang.org/go.opencensus.io/%40v/v0.24.0.zip') |
| 3463 | self.assertNotIn('name', ud.parm) | ||
| 3464 | 3460 | ||
| 3465 | fetcher.download() | 3461 | fetcher.download() |
| 3466 | fetcher.unpack(self.unpackdir) | 3462 | fetcher.unpack(self.unpackdir) |
