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
@@ -973,7 +974,7 @@ def gen_builddir(self):
973974 if not self .cfg .get ('cleanupoldbuild' , False ):
974975 uniq_builddir = builddir
975976 suff = 0
976- while ( os .path .isdir (uniq_builddir ) ):
977+ while os .path .isdir (uniq_builddir ):
977978 uniq_builddir = "%s.%d" % (builddir , suff )
978979 suff += 1
979980 builddir = uniq_builddir
@@ -2875,7 +2876,9 @@ def apply_post_install_patches(self, patches=None):
28752876
28762877 self .log .debug ("Post-install patches to apply: %s" , patches )
28772878 if patches :
2878- self .patch_step (beginpath = self .installdir , patches = patches )
2879+ # self may be inherited from the Bundle easyblock and that patch_step is a no-op
2880+ # To allow postinstallpatches for Bundle, and derived, easyblocks we directly call EasyBlock.patch_step
2881+ EasyBlock .patch_step (self , beginpath = self .installdir , patches = patches )
28792882
28802883 def post_install_step (self ):
28812884 """
@@ -2994,24 +2997,15 @@ def sanity_check_rpath(self, rpath_dirs=None):
29942997 for path in [os .path .join (dirpath , x ) for x in os .listdir (dirpath )]:
29952998 self .log .debug ("Sanity checking RPATH for %s" , path )
29962999
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 :
3000+ out = get_linked_libs_raw (path )
3001+
3002+ if out is None :
3003+ msg = "Failed to determine dynamically linked libraries for %s, "
3004+ msg += "so skipping it in RPATH sanity check"
3005+ self .log .debug (msg , path )
3006+ else :
30083007 # 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 ):
3008+ if not_found_regex .search (out ):
30153009 fail_msg = "One or more required libraries not found for %s: %s" % (path , out )
30163010 self .log .warning (fail_msg )
30173011 fails .append (fail_msg )
@@ -3030,9 +3024,6 @@ def sanity_check_rpath(self, rpath_dirs=None):
30303024 fails .append (fail_msg )
30313025 else :
30323026 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 )
30363027 else :
30373028 self .log .debug ("Not sanity checking files in non-existing directory %s" , dirpath )
30383029
0 commit comments