9696from easybuild .tools .package .utilities import package
9797from easybuild .tools .py2vs3 import extract_method_name , string_type
9898from easybuild .tools .repository .repository import init_repository
99- from easybuild .tools .systemtools import check_linked_shared_libs , det_parallelism , get_shared_lib_ext , use_group
99+ from easybuild .tools .systemtools import check_linked_shared_libs , det_parallelism , get_linked_libs_raw
100+ from easybuild .tools .systemtools import get_shared_lib_ext , use_group
100101from easybuild .tools .utilities import INDENT_4SPACES , get_class_for , nub , quote_str
101102from easybuild .tools .utilities import remove_unwanted_chars , time2str , trace_msg
102103from easybuild .tools .version import this_is_easybuild , VERBOSE_VERSION , VERSION
@@ -2374,33 +2375,34 @@ def check_checksums_for(self, ent, sub='', source_cnt=None):
23742375 checksum_issues .append (msg )
23752376
23762377 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
23772381 if isinstance (checksum , dict ):
2378- # sources entry may be a dictionary rather than just a string value with filename
2379- if isinstance (fn , dict ):
2380- filename = fn ['filename' ]
2381- else :
2382- filename = fn
2383- checksum = checksum .get (filename )
2384-
2385- # take into account that we may encounter a tuple of valid SHA256 checksums
2386- # (see https://github.com/easybuilders/easybuild-framework/pull/2958)
2387- if isinstance (checksum , tuple ):
2388- # 1st tuple item may indicate checksum type, must be SHA256 or else it's blatently ignored here
2389- if len (checksum ) == 2 and checksum [0 ] == CHECKSUM_TYPE_SHA256 :
2390- valid_checksums = (checksum [1 ],)
2391- else :
2392- valid_checksums = checksum
2382+ checksums_to_check = checksum .values ()
23932383 else :
2394- valid_checksums = (checksum ,)
2395-
2396- non_sha256_checksums = [c for c in valid_checksums if not is_sha256_checksum (c )]
2397- if non_sha256_checksums :
2398- if all (c is None for c in non_sha256_checksums ):
2399- print_warning ("Found %d None checksum value(s), please make sure this is intended!" %
2400- 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
24012395 else :
2402- msg = "Non-SHA256 checksum(s) found for %s: %s" % (fn , valid_checksums )
2403- 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 )
24042406
24052407 return checksum_issues
24062408
@@ -2875,7 +2877,9 @@ def apply_post_install_patches(self, patches=None):
28752877
28762878 self .log .debug ("Post-install patches to apply: %s" , patches )
28772879 if patches :
2878- self .patch_step (beginpath = self .installdir , patches = patches )
2880+ # self may be inherited from the Bundle easyblock and that patch_step is a no-op
2881+ # To allow postinstallpatches for Bundle, and derived, easyblocks we directly call EasyBlock.patch_step
2882+ EasyBlock .patch_step (self , beginpath = self .installdir , patches = patches )
28792883
28802884 def post_install_step (self ):
28812885 """
@@ -2994,24 +2998,15 @@ def sanity_check_rpath(self, rpath_dirs=None):
29942998 for path in [os .path .join (dirpath , x ) for x in os .listdir (dirpath )]:
29952999 self .log .debug ("Sanity checking RPATH for %s" , path )
29963000
2997- out , ec = run_cmd ("file %s" % path , simple = False , trace = False )
2998- if ec :
2999- fail_msg = "Failed to run 'file %s': %s" % (path , out )
3000- self .log .warning (fail_msg )
3001- fails .append (fail_msg )
3002-
3003- # only run ldd/readelf on dynamically linked executables/libraries
3004- # example output:
3005- # ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), ...
3006- # ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, not stripped
3007- if "dynamically linked" in out :
3001+ out = get_linked_libs_raw (path )
3002+
3003+ if out is None :
3004+ msg = "Failed to determine dynamically linked libraries for %s, "
3005+ msg += "so skipping it in RPATH sanity check"
3006+ self .log .debug (msg , path )
3007+ else :
30083008 # check whether all required libraries are found via 'ldd'
3009- out , ec = run_cmd ("ldd %s" % path , simple = False , trace = False )
3010- if ec :
3011- fail_msg = "Failed to run 'ldd %s': %s" % (path , out )
3012- self .log .warning (fail_msg )
3013- fails .append (fail_msg )
3014- elif not_found_regex .search (out ):
3009+ if not_found_regex .search (out ):
30153010 fail_msg = "One or more required libraries not found for %s: %s" % (path , out )
30163011 self .log .warning (fail_msg )
30173012 fails .append (fail_msg )
@@ -3030,9 +3025,6 @@ def sanity_check_rpath(self, rpath_dirs=None):
30303025 fails .append (fail_msg )
30313026 else :
30323027 self .log .debug ("Output of 'readelf -d %s' checked, looks OK" , path )
3033-
3034- else :
3035- self .log .debug ("%s is not dynamically linked, so skipping it in RPATH sanity check" , path )
30363028 else :
30373029 self .log .debug ("Not sanity checking files in non-existing directory %s" , dirpath )
30383030
0 commit comments