2828@author: Pavel Grochal (INUITS)
2929"""
3030import os
31- import re
3231from distutils .version import LooseVersion
3332
3433import easybuild .tools .environment as env
35- from easybuild .framework .easyblock import DEFAULT_BIN_LIB_SUBDIRS , EasyBlock
34+ from easybuild .framework .easyblock import EasyBlock
3635from easybuild .framework .easyconfig import CUSTOM
3736from easybuild .tools .build_log import EasyBuildError
38- from easybuild .tools .config import build_option
3937from easybuild .tools .modules import get_software_root , get_software_version
4038from easybuild .tools .run import run_cmd
41- from easybuild .tools .systemtools import get_linked_libs_raw
4239
4340
4441class GoPackage (EasyBlock ):
@@ -134,9 +131,6 @@ def install_step(self):
134131 self .cfg ['preinstallopts' ],
135132 'go' ,
136133 'install' ,
137- # print commands as they are executed,
138- # including downloading and installing of package deps as listed in the go.mod file
139- '-x' ,
140134 self .cfg ['installopts' ],
141135 ])
142136 run_cmd (cmd , log_all = True , log_ok = True , simple = True )
@@ -154,72 +148,4 @@ def sanity_check_step(self):
154148 super (GoPackage , self ).sanity_check_step (custom_paths = custom_paths , custom_commands = custom_commands )
155149
156150 def sanity_check_rpath (self , rpath_dirs = None ):
157- """Sanity check binaries/libraries w.r.t. RPATH linking."""
158-
159- self .log .info ("Checking RPATH linkage for binaries/libraries..." )
160-
161- fails = []
162-
163- # hard reset $LD_LIBRARY_PATH before running RPATH sanity check
164- orig_env = env .unset_env_vars (['LD_LIBRARY_PATH' ])
165-
166- self .log .debug ("$LD_LIBRARY_PATH during RPATH sanity check: %s" , os .getenv ('LD_LIBRARY_PATH' , '(empty)' ))
167- self .log .debug ("List of loaded modules: %s" , self .modules_tool .list ())
168-
169- not_found_regex = re .compile (r'(\S+)\s*\=\>\s*not found' )
170-
171- # List of libraries that should be exempt from the RPATH sanity check;
172- # For example, libcuda.so.1 should never be RPATH-ed by design,
173- # see https://github.com/easybuilders/easybuild-framework/issues/4095
174- filter_rpath_sanity_libs = build_option ('filter_rpath_sanity_libs' )
175- msg = "Ignoring the following libraries if they are not found by RPATH sanity check: %s"
176- self .log .info (msg , filter_rpath_sanity_libs )
177-
178- if rpath_dirs is None :
179- rpath_dirs = self .cfg ['bin_lib_subdirs' ] or self .bin_lib_subdirs ()
180-
181- if not rpath_dirs :
182- rpath_dirs = DEFAULT_BIN_LIB_SUBDIRS
183- self .log .info ("Using default subdirectories for binaries/libraries to verify RPATH linking: %s" ,
184- rpath_dirs )
185- else :
186- self .log .info ("Using specified subdirectories for binaries/libraries to verify RPATH linking: %s" ,
187- rpath_dirs )
188-
189- for dirpath in [os .path .join (self .installdir , d ) for d in rpath_dirs ]:
190- if os .path .exists (dirpath ):
191- self .log .debug ("Sanity checking RPATH for files in %s" , dirpath )
192-
193- for path in [os .path .join (dirpath , x ) for x in os .listdir (dirpath )]:
194- self .log .debug ("Sanity checking RPATH for %s" , path )
195-
196- out = get_linked_libs_raw (path )
197-
198- if out is None :
199- msg = "Failed to determine dynamically linked libraries for %s, "
200- msg += "so skipping it in RPATH sanity check"
201- self .log .debug (msg , path )
202- else :
203- # check whether all required libraries are found via 'ldd'
204- matches = re .findall (not_found_regex , out )
205- if len (matches ) > 0 : # Some libraries are not found via 'ldd'
206- # For each match, check if the library is in the exception list
207- for match in matches :
208- if match in filter_rpath_sanity_libs :
209- msg = "Library %s not found for %s, but ignored "
210- msg += "since it is on the rpath exception list: %s"
211- self .log .info (msg , match , path , filter_rpath_sanity_libs )
212- else :
213- fail_msg = "Library %s not found for %s; " % (match , path )
214- fail_msg += "RPATH linking is enabled, but not implemented for Go packages."
215- fail_msg += "See https://github.com/easybuilders/easybuild-easyconfigs/issues/17516"
216- self .log .warning (fail_msg )
217- fails .append (fail_msg )
218- else :
219- self .log .debug ("Output of 'ldd %s' checked, looks OK" , path )
220- else :
221- self .log .debug ("Not sanity checking files in non-existing directory %s" , dirpath )
222-
223- env .restore_env_vars (orig_env )
224-
225- return fails
151+ super (GoPackage , self ).sanity_check_rpath (rpath_dirs = rpath_dirs , check_readelf_rpath = False )
0 commit comments