7272from easybuild .tools .build_log import print_error , print_msg , print_warning
7373from easybuild .tools .config import CHECKSUM_PRIORITY_JSON , DEFAULT_ENVVAR_USERS_MODULES
7474from easybuild .tools .config import FORCE_DOWNLOAD_ALL , FORCE_DOWNLOAD_PATCHES , FORCE_DOWNLOAD_SOURCES
75+ from easybuild .tools .config import EASYBUILD_SOURCES_URL # noqa
7576from easybuild .tools .config import build_option , build_path , get_log_filename , get_repository , get_repositorypath
7677from easybuild .tools .config import install_path , log_path , package_path , source_paths
7778from easybuild .tools .environment import restore_env , sanitize_env
105106from easybuild .tools .utilities import remove_unwanted_chars , time2str , trace_msg
106107from easybuild .tools .version import this_is_easybuild , VERBOSE_VERSION , VERSION
107108
108-
109- EASYBUILD_SOURCES_URL = 'https://sources.easybuild.io'
110-
111109DEFAULT_BIN_LIB_SUBDIRS = ('bin' , 'lib' , 'lib64' )
112110
113111MODULE_ONLY_STEPS = [MODULE_STEP , PREPARE_STEP , READY_STEP , POSTITER_STEP , SANITYCHECK_STEP ]
@@ -674,14 +672,16 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
674672 src_fn = os .path .basename (src_path )
675673
676674 # report both MD5 and SHA256 checksums, since both are valid default checksum types
675+ src_checksums = {}
677676 for checksum_type in (CHECKSUM_TYPE_MD5 , CHECKSUM_TYPE_SHA256 ):
678677 src_checksum = compute_checksum (src_path , checksum_type = checksum_type )
678+ src_checksums [checksum_type ] = src_checksum
679679 self .log .info ("%s checksum for %s: %s" , checksum_type , src_path , src_checksum )
680680
681681 # verify checksum (if provided)
682682 self .log .debug ('Verifying checksums for extension source...' )
683683 fn_checksum = self .get_checksum_for (checksums , filename = src_fn , index = 0 )
684- if verify_checksum (src_path , fn_checksum ):
684+ if verify_checksum (src_path , fn_checksum , src_checksums ):
685685 self .log .info ('Checksum for extension source %s verified' , src_fn )
686686 elif build_option ('ignore_checksums' ):
687687 print_warning ("Ignoring failing checksum verification for %s" % src_fn )
@@ -700,12 +700,15 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
700700 ext_src .update ({'patches' : ext_patches })
701701
702702 if verify_checksums :
703+ computed_checksums = {}
703704 for patch in ext_patches :
704705 patch = patch ['path' ]
706+ computed_checksums [patch ] = {}
705707 # report both MD5 and SHA256 checksums,
706708 # since both are valid default checksum types
707709 for checksum_type in (CHECKSUM_TYPE_MD5 , CHECKSUM_TYPE_SHA256 ):
708710 checksum = compute_checksum (patch , checksum_type = checksum_type )
711+ computed_checksums [patch ][checksum_type ] = checksum
709712 self .log .info ("%s checksum for %s: %s" , checksum_type , patch , checksum )
710713
711714 # verify checksum (if provided)
@@ -715,7 +718,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True):
715718 patch_fn = os .path .basename (patch )
716719
717720 checksum = self .get_checksum_for (checksums , filename = patch_fn , index = idx + 1 )
718- if verify_checksum (patch , checksum ):
721+ if verify_checksum (patch , checksum , computed_checksums [ patch ] ):
719722 self .log .info ('Checksum for extension patch %s verified' , patch_fn )
720723 elif build_option ('ignore_checksums' ):
721724 print_warning ("Ignoring failing checksum verification for %s" % patch_fn )
@@ -754,7 +757,9 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
754757 """
755758 srcpaths = source_paths ()
756759
757- update_progress_bar (PROGRESS_BAR_DOWNLOAD_ALL , label = filename )
760+ # We don't account for the checksums file in the progress bar
761+ if filename != 'checksum.json' :
762+ update_progress_bar (PROGRESS_BAR_DOWNLOAD_ALL , label = filename )
758763
759764 if alt_location is None :
760765 location = self .name
@@ -890,8 +895,10 @@ def obtain_file(self, filename, extension=False, urls=None, download_filename=No
890895 source_urls = []
891896 source_urls .extend (self .cfg ['source_urls' ])
892897
893- # add https://sources.easybuild.io as fallback source URL
894- source_urls .append (EASYBUILD_SOURCES_URL + '/' + os .path .join (name_letter , location ))
898+ # Add additional URLs as configured.
899+ for url in build_option ("extra_source_urls" ):
900+ url += "/" + name_letter + "/" + location
901+ source_urls .append (url )
895902
896903 mkdir (targetdir , parents = True )
897904
@@ -2475,7 +2482,7 @@ def check_checksums_for(self, ent, sub='', source_cnt=None):
24752482 checksum_issues = []
24762483
24772484 sources = ent .get ('sources' , [])
2478- patches = ent .get ('patches' , [])
2485+ patches = ent .get ('patches' , []) + ent . get ( 'postinstallpatches' , [])
24792486 checksums = ent .get ('checksums' , [])
24802487 # Single source should be re-wrapped as a list, and checksums with it
24812488 if isinstance (sources , dict ):
@@ -3482,10 +3489,7 @@ def _sanity_check_step_extensions(self):
34823489 """Sanity check on extensions (if any)."""
34833490 failed_exts = []
34843491
3485- if build_option ('skip_extensions' ):
3486- self .log .info ("Skipping sanity check for extensions since skip-extensions is enabled..." )
3487- return
3488- elif not self .ext_instances :
3492+ if not self .ext_instances :
34893493 # class instances for extensions may not be initialized yet here,
34903494 # for example when using --module-only or --sanity-check-only
34913495 self .prepare_for_extensions ()
@@ -3637,7 +3641,10 @@ def xs2str(xs):
36373641
36383642 # also run sanity check for extensions (unless we are an extension ourselves)
36393643 if not extension :
3640- self ._sanity_check_step_extensions ()
3644+ if build_option ('skip_extensions' ):
3645+ self .log .info ("Skipping sanity check for extensions since skip-extensions is enabled..." )
3646+ else :
3647+ self ._sanity_check_step_extensions ()
36413648
36423649 linked_shared_lib_fails = self .sanity_check_linked_shared_libs ()
36433650 if linked_shared_lib_fails :
@@ -3894,12 +3901,13 @@ def update_config_template_run_step(self):
38943901 self .cfg .generate_template_values ()
38953902
38963903 def skip_step (self , step , skippable ):
3897- """Dedice whether or not to skip the specified step."""
3904+ """Decide whether or not to skip the specified step."""
38983905 skip = False
38993906 force = build_option ('force' )
39003907 module_only = build_option ('module_only' ) or self .cfg ['module_only' ]
39013908 sanity_check_only = build_option ('sanity_check_only' )
39023909 skip_extensions = build_option ('skip_extensions' )
3910+ skip_sanity_check = build_option ('skip_sanity_check' )
39033911 skip_test_step = build_option ('skip_test_step' )
39043912 skipsteps = self .cfg ['skipsteps' ]
39053913
@@ -3927,6 +3935,10 @@ def skip_step(self, step, skippable):
39273935 self .log .info ("Skipping %s step because of sanity-check-only mode" , step )
39283936 skip = True
39293937
3938+ elif skip_sanity_check and step == SANITYCHECK_STEP :
3939+ self .log .info ("Skipping %s step as request via skip-sanity-check" , step )
3940+ skip = True
3941+
39303942 elif skip_extensions and step == EXTENSIONS_STEP :
39313943 self .log .info ("Skipping %s step as requested via skip-extensions" , step )
39323944 skip = True
@@ -3937,9 +3949,9 @@ def skip_step(self, step, skippable):
39373949
39383950 else :
39393951 msg = "Not skipping %s step (skippable: %s, skip: %s, skipsteps: %s, module_only: %s, force: %s, "
3940- msg += "sanity_check_only: %s, skip_extensions: %s, skip_test_step: %s)"
3952+ msg += "sanity_check_only: %s, skip_extensions: %s, skip_test_step: %s, skip_sanity_check: %s )"
39413953 self .log .debug (msg , step , skippable , self .skip , skipsteps , module_only , force ,
3942- sanity_check_only , skip_extensions , skip_test_step )
3954+ sanity_check_only , skip_extensions , skip_test_step , skip_sanity_check )
39433955
39443956 return skip
39453957
@@ -4089,7 +4101,7 @@ def run_all_steps(self, run_test_cases):
40894101 Build and install this software.
40904102 run_test_cases (bool): run tests after building (e.g.: make test)
40914103 """
4092- if self .cfg ['stop' ] and self . cfg [ 'stop' ] == 'cfg' :
4104+ if self .cfg ['stop' ] == 'cfg' :
40934105 return True
40944106
40954107 steps = self .get_steps (run_test_cases = run_test_cases , iteration_count = self .det_iter_cnt ())
@@ -4708,7 +4720,7 @@ def make_checksum_lines(checksums, indent_level):
47084720
47094721 # back up easyconfig file before injecting checksums
47104722 ec_backup = back_up_file (ec ['spec' ])
4711- print_msg ("backup of easyconfig file saved to %s... " % ec_backup , log = _log )
4723+ print_msg ("backup of easyconfig file saved to %s" % ec_backup , log = _log )
47124724
47134725 # compute & inject checksums for sources/patches
47144726 print_msg ("injecting %s checksums for sources & patches in %s..." % (checksum_type , ec_fn ), log = _log )
0 commit comments