Skip to content

Commit

Permalink
be even more careful when determining easyconfig parameter values in …
Browse files Browse the repository at this point in the history
…Bundle constructor, to avoid trouble with unresolved templates
  • Loading branch information
boegel committed Dec 19, 2024
1 parent 88d0a81 commit 1973cbb
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions easybuild/easyblocks/generic/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def __init__(self, *args, **kwargs):
check_for_sources = getattr(self, 'check_for_sources', True)
# list of sources for bundle itself *must* be empty (unless overridden by subclass)
if check_for_sources:
if self.cfg['sources']:
if self.cfg.get_ref('sources'):
raise EasyBuildError("List of sources for bundle itself must be empty, found %s", self.cfg['sources'])
if self.cfg['patches']:
if self.cfg.get_ref('patches'):
raise EasyBuildError("List of patches for bundle itself must be empty, found %s", self.cfg['patches'])

# copy EasyConfig instance before we make changes to it
Expand Down Expand Up @@ -187,29 +187,31 @@ def __init__(self, *args, **kwargs):
else:
raise EasyBuildError("No sources specification for component %s v%s", comp_name, comp_version)

if comp_cfg['checksums']:
src_cnt = len(comp_cfg['sources'])
comp_checksums = comp_cfg.get_ref('checksums')
if comp_checksums:
src_cnt = len(comp_sources)

# add per-component checksums for sources to list of checksums
self.cfg.update('checksums', comp_cfg['checksums'][:src_cnt])
self.cfg.update('checksums', comp_checksums[:src_cnt])

# add per-component checksums for patches to list of checksums for patches
checksums_patches.extend(comp_cfg['checksums'][src_cnt:])
checksums_patches.extend(comp_checksums[src_cnt:])

if comp_cfg['patches']:
self.cfg.update('patches', comp_cfg['patches'])
comp_patches = comp_cfg.get_ref('patches')
if comp_patches:
self.cfg.update('patches', comp_patches)

self.comp_cfgs.append(comp_cfg)

self.cfg.update('checksums', checksums_patches)

self.cfg.enable_templating = True

# restore general sanity checks if using component-specific sanity checks
if self.cfg['sanity_check_components'] or self.cfg['sanity_check_all_components']:
self.cfg['sanity_check_paths'] = self.backup_sanity_paths
self.cfg['sanity_check_commands'] = self.backup_sanity_cmds

self.cfg.enable_templating = True

def check_checksums(self):
"""
Check whether a SHA256 checksum is available for all sources & patches (incl. extensions).
Expand Down

0 comments on commit 1973cbb

Please sign in to comment.