diff options
| author | Aleksandar Nikolic <aleksandar.nikolic@zeiss.com> | 2024-06-11 11:25:56 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-06-12 16:08:32 +0100 |
| commit | cedb7197cc689c2fc87195697efc01ed784dfce7 (patch) | |
| tree | 524cc98c5d898991507b3ea1682ca1d7f164beea /scripts | |
| parent | ecad5180924ad4e73b047c6f2368db6c0bd261c5 (diff) | |
| download | poky-cedb7197cc689c2fc87195697efc01ed784dfce7.tar.gz | |
install-buildtools: remove md5 checksum validation
No need to validate with the md5 checksum, as the file is not even
uploaded to the Yocto release webpage (the download never failed due
to a wrong indentation of an else statement). For validation purposes,
use the sha256 checksum only.
(From OE-Core rev: b740d2f9d40aef1e18c022d1e82b4fb2c5c1fc22)
Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/install-buildtools | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/scripts/install-buildtools b/scripts/install-buildtools index 2218f3ffac..a34474ea84 100755 --- a/scripts/install-buildtools +++ b/scripts/install-buildtools | |||
| @@ -238,19 +238,15 @@ def main(): | |||
| 238 | # Verify checksum | 238 | # Verify checksum |
| 239 | if args.check: | 239 | if args.check: |
| 240 | logger.info("Fetching buildtools installer checksum") | 240 | logger.info("Fetching buildtools installer checksum") |
| 241 | checksum_type = "" | 241 | checksum_type = "sha256sum" |
| 242 | for checksum_type in ["md5sum", "sha256sum"]: | 242 | check_url = "{}.{}".format(buildtools_url, checksum_type) |
| 243 | check_url = "{}.{}".format(buildtools_url, checksum_type) | 243 | checksum_filename = "{}.{}".format(filename, checksum_type) |
| 244 | checksum_filename = "{}.{}".format(filename, checksum_type) | 244 | tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename) |
| 245 | tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename) | 245 | ret = subprocess.call("wget -q -O %s %s" % |
| 246 | ret = subprocess.call("wget -q -O %s %s" % | 246 | (tmpbuildtools_checksum, check_url), shell=True) |
| 247 | (tmpbuildtools_checksum, check_url), shell=True) | 247 | if ret != 0: |
| 248 | if ret == 0: | 248 | logger.error("Could not download file from %s" % check_url) |
| 249 | break | 249 | return ret |
| 250 | else: | ||
| 251 | if ret != 0: | ||
| 252 | logger.error("Could not download file from %s" % check_url) | ||
| 253 | return ret | ||
| 254 | regex = re.compile(r"^(?P<checksum>[0-9a-f]+)\s+(?P<path>.*/)?(?P<filename>.*)$") | 250 | regex = re.compile(r"^(?P<checksum>[0-9a-f]+)\s+(?P<path>.*/)?(?P<filename>.*)$") |
| 255 | with open(tmpbuildtools_checksum, 'rb') as f: | 251 | with open(tmpbuildtools_checksum, 'rb') as f: |
| 256 | original = f.read() | 252 | original = f.read() |
| @@ -263,10 +259,7 @@ def main(): | |||
| 263 | logger.error("Filename does not match name in checksum") | 259 | logger.error("Filename does not match name in checksum") |
| 264 | return 1 | 260 | return 1 |
| 265 | checksum = m.group('checksum') | 261 | checksum = m.group('checksum') |
| 266 | if checksum_type == "md5sum": | 262 | checksum_value = sha256_file(tmpbuildtools) |
| 267 | checksum_value = md5_file(tmpbuildtools) | ||
| 268 | else: | ||
| 269 | checksum_value = sha256_file(tmpbuildtools) | ||
| 270 | if checksum == checksum_value: | 263 | if checksum == checksum_value: |
| 271 | logger.info("Checksum success") | 264 | logger.info("Checksum success") |
| 272 | else: | 265 | else: |
