diff options
author | Frederic Martinsons <frederic.martinsons@gmail.com> | 2023-03-17 09:19:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-30 10:51:54 +0100 |
commit | 2b12c58724d250d1faf24072128e2de75dfe2c15 (patch) | |
tree | 9982e57cac6901bf437e3f682a6eceb8a88a84c0 /bitbake/lib/bb/fetch2/__init__.py | |
parent | d1f3941417d4b2bb56c63e716d750596f8b151a9 (diff) | |
download | poky-2b12c58724d250d1faf24072128e2de75dfe2c15.tar.gz |
bitbake: fetch2: Add checksum capability for crate fetcher
This change brings checksum verification of each crate
in a recipe, e.g
| SRC_URI += " \
| crate://crates.io/aho-corasick/0.7.20 \
| crate://crates.io/atomic-waker/1.1.0 \
| crate://crates.io/cc/1.0.79 \
| "
|
| SRC_URI[aho-corasick.sha256sum] = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac"
| SRC_URI[atomic-waker.sha256sum] = "debc29dde2e69f9e47506b525f639ed42300fc014a3e007832592448fa8e4599"
| SRC_URI[cc.sha256sum] = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
That will require to move the checksum initialization
after the possible call to urldata_init method in order
for the crate fetcher to parse the url.
Another way of doing could have been implementing a decodeurl
method that would have been specific for each fetcher class.
(Bitbake rev: 4920686c13dd66f9bfa4f7dd38d6e955f153eeec)
Signed-off-by: Frederic Martinsons <frederic.martinsons@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 718b9f2958..31729885ab 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -1295,18 +1295,13 @@ class FetchData(object): | |||
1295 | 1295 | ||
1296 | if checksum_name in self.parm: | 1296 | if checksum_name in self.parm: |
1297 | checksum_expected = self.parm[checksum_name] | 1297 | checksum_expected = self.parm[checksum_name] |
1298 | elif self.type not in ["http", "https", "ftp", "ftps", "sftp", "s3", "az"]: | 1298 | elif self.type not in ["http", "https", "ftp", "ftps", "sftp", "s3", "az", "crate"]: |
1299 | checksum_expected = None | 1299 | checksum_expected = None |
1300 | else: | 1300 | else: |
1301 | checksum_expected = d.getVarFlag("SRC_URI", checksum_name) | 1301 | checksum_expected = d.getVarFlag("SRC_URI", checksum_name) |
1302 | 1302 | ||
1303 | setattr(self, "%s_expected" % checksum_id, checksum_expected) | 1303 | setattr(self, "%s_expected" % checksum_id, checksum_expected) |
1304 | 1304 | ||
1305 | for checksum_id in CHECKSUM_LIST: | ||
1306 | configure_checksum(checksum_id) | ||
1307 | |||
1308 | self.ignore_checksums = False | ||
1309 | |||
1310 | self.names = self.parm.get("name",'default').split(',') | 1305 | self.names = self.parm.get("name",'default').split(',') |
1311 | 1306 | ||
1312 | self.method = None | 1307 | self.method = None |
@@ -1328,6 +1323,11 @@ class FetchData(object): | |||
1328 | if hasattr(self.method, "urldata_init"): | 1323 | if hasattr(self.method, "urldata_init"): |
1329 | self.method.urldata_init(self, d) | 1324 | self.method.urldata_init(self, d) |
1330 | 1325 | ||
1326 | for checksum_id in CHECKSUM_LIST: | ||
1327 | configure_checksum(checksum_id) | ||
1328 | |||
1329 | self.ignore_checksums = False | ||
1330 | |||
1331 | if "localpath" in self.parm: | 1331 | if "localpath" in self.parm: |
1332 | # if user sets localpath for file, use it instead. | 1332 | # if user sets localpath for file, use it instead. |
1333 | self.localpath = self.parm["localpath"] | 1333 | self.localpath = self.parm["localpath"] |