diff options
author | Aleksandar Nikolic <aleksandar.nikolic@zeiss.com> | 2024-09-25 01:05:15 +0200 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-10-07 05:43:22 -0700 |
commit | 71ef9f9593badb0693115a8f528a22b6c2a09b65 (patch) | |
tree | 9a5b9a1a77125ead50b9bc7c45573f2691321eb5 /scripts | |
parent | e19ef6225430de2a70bdd0e8a84b48e9dfb0b98d (diff) | |
download | poky-71ef9f9593badb0693115a8f528a22b6c2a09b65.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: b331769084996ffeb74007fe6ca7e385edd7a577)
Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit b740d2f9d40aef1e18c022d1e82b4fb2c5c1fc22)
Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
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: |