@@ -2375,33 +2375,34 @@ def check_checksums_for(self, ent, sub='', source_cnt=None):
23752375 checksum_issues .append (msg )
23762376
23772377 for fn , checksum in zip (sources + patches , checksums ):
2378+
2379+ # a checksum may be specified as a dictionary which maps filename to actual checksum
2380+ # for example when different source files are used for different CPU architectures
23782381 if isinstance (checksum , dict ):
2379- # sources entry may be a dictionary rather than just a string value with filename
2380- if isinstance (fn , dict ):
2381- filename = fn ['filename' ]
2382- else :
2383- filename = fn
2384- checksum = checksum .get (filename )
2385-
2386- # take into account that we may encounter a tuple of valid SHA256 checksums
2387- # (see https://github.com/easybuilders/easybuild-framework/pull/2958)
2388- if isinstance (checksum , tuple ):
2389- # 1st tuple item may indicate checksum type, must be SHA256 or else it's blatently ignored here
2390- if len (checksum ) == 2 and checksum [0 ] == CHECKSUM_TYPE_SHA256 :
2391- valid_checksums = (checksum [1 ],)
2392- else :
2393- valid_checksums = checksum
2382+ checksums_to_check = checksum .values ()
23942383 else :
2395- valid_checksums = (checksum ,)
2396-
2397- non_sha256_checksums = [c for c in valid_checksums if not is_sha256_checksum (c )]
2398- if non_sha256_checksums :
2399- if all (c is None for c in non_sha256_checksums ):
2400- print_warning ("Found %d None checksum value(s), please make sure this is intended!" %
2401- len (non_sha256_checksums ))
2384+ checksums_to_check = [checksum ]
2385+
2386+ for checksum in checksums_to_check :
2387+ # take into account that we may encounter a tuple of valid SHA256 checksums
2388+ # (see https://github.com/easybuilders/easybuild-framework/pull/2958)
2389+ if isinstance (checksum , tuple ):
2390+ # 1st tuple item may indicate checksum type, must be SHA256 or else it's blatently ignored here
2391+ if len (checksum ) == 2 and checksum [0 ] == CHECKSUM_TYPE_SHA256 :
2392+ valid_checksums = (checksum [1 ],)
2393+ else :
2394+ valid_checksums = checksum
24022395 else :
2403- msg = "Non-SHA256 checksum(s) found for %s: %s" % (fn , valid_checksums )
2404- checksum_issues .append (msg )
2396+ valid_checksums = (checksum ,)
2397+
2398+ non_sha256_checksums = [c for c in valid_checksums if not is_sha256_checksum (c )]
2399+ if non_sha256_checksums :
2400+ if all (c is None for c in non_sha256_checksums ):
2401+ print_warning ("Found %d None checksum value(s), please make sure this is intended!" %
2402+ len (non_sha256_checksums ))
2403+ else :
2404+ msg = "Non-SHA256 checksum(s) found for %s: %s" % (fn , valid_checksums )
2405+ checksum_issues .append (msg )
24052406
24062407 return checksum_issues
24072408
0 commit comments