Skip to content

Commit

Permalink
Merge pull request #4624 from Flamefire/checksum-step
Browse files Browse the repository at this point in the history
move verifying of checksums from `source` to `fetch` step, to include it with `--fetch`
  • Loading branch information
boegel authored Sep 9, 2024
2 parents f0a7bba + 0e31ff5 commit 8569344
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
16 changes: 4 additions & 12 deletions easybuild/framework/easyblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4038,15 +4038,6 @@ def ready_step_spec(initial):
return get_step(READY_STEP, "creating build dir, resetting environment", ready_substeps, False,
initial=initial)

source_substeps = [
(False, lambda x: x.checksum_step),
(True, lambda x: x.extract_step),
]

def source_step_spec(initial):
"""Return source step specified."""
return get_step(SOURCE_STEP, "unpacking", source_substeps, True, initial=initial)

install_substeps = [
(False, lambda x: x.stage_install_step),
(False, lambda x: x.make_installdir),
Expand All @@ -4060,6 +4051,7 @@ def install_step_spec(initial):
# format for step specifications: (step_name, description, list of functions, skippable)

# core steps that are part of the iterated loop
extract_step_spec = (SOURCE_STEP, "unpacking", [lambda x: x.extract_step], True)
patch_step_spec = (PATCH_STEP, 'patching', [lambda x: x.patch_step], True)
prepare_step_spec = (PREPARE_STEP, 'preparing', [lambda x: x.prepare_step], False)
configure_step_spec = (CONFIGURE_STEP, 'configuring', [lambda x: x.configure_step], True)
Expand All @@ -4069,9 +4061,9 @@ def install_step_spec(initial):

# part 1: pre-iteration + first iteration
steps_part1 = [
(FETCH_STEP, 'fetching files', [lambda x: x.fetch_step], False),
(FETCH_STEP, 'fetching files', [lambda x: x.fetch_step, lambda x: x.checksum_step], False),
ready_step_spec(True),
source_step_spec(True),
extract_step_spec,
patch_step_spec,
prepare_step_spec,
configure_step_spec,
Expand All @@ -4085,7 +4077,7 @@ def install_step_spec(initial):
# not all parts of all steps need to be rerun (see e.g., ready, prepare)
steps_part2 = [
ready_step_spec(False),
source_step_spec(False),
extract_step_spec,
patch_step_spec,
prepare_step_spec,
configure_step_spec,
Expand Down
13 changes: 12 additions & 1 deletion test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -5497,7 +5497,7 @@ def test_fetch(self):
# which might trip up the dependency resolution (see #4298)
for ec in ('toy-0.0.eb', 'toy-0.0-deps.eb'):
args = [ec, '--fetch']
stdout, stderr = self._run_mock_eb(args, raise_error=True, strip=True, testing=False)
stdout, _ = self._run_mock_eb(args, raise_error=True, strip=True, testing=False)

patterns = [
r"^== fetching files\.\.\.$",
Expand All @@ -5510,6 +5510,17 @@ def test_fetch(self):
regex = re.compile(r"^== creating build dir, resetting environment\.\.\.$")
self.assertFalse(regex.search(stdout), "Pattern '%s' found in: %s" % (regex.pattern, stdout))

# --fetch should also verify the checksums
tmpdir = tempfile.mkdtemp(prefix='easybuild-sources')
write_file(os.path.join(tmpdir, 'toy-0.0.tar.gz'), 'Make checksum check fail')
args = ['--sourcepath=%s:%s' % (tmpdir, self.test_sourcepath), '--fetch', 'toy-0.0.eb']
with self.mocked_stdout_stderr():
pattern = 'Checksum verification for .*/toy-0.0.tar.gz .*failed'
self.assertErrorRegex(EasyBuildError, pattern, self.eb_main, args, do_build=True, raise_error=True)
# We can avoid that failure by ignoring the checksums
args.append('--ignore-checksums')
self.eb_main(args, do_build=True, raise_error=True)

def test_parse_external_modules_metadata(self):
"""Test parse_external_modules_metadata function."""
# by default, provided external module metadata cfg files are picked up
Expand Down

0 comments on commit 8569344

Please sign in to comment.