Skip to content

Commit 8569344

Browse files
authored
Merge pull request #4624 from Flamefire/checksum-step
move verifying of checksums from `source` to `fetch` step, to include it with `--fetch`
2 parents f0a7bba + 0e31ff5 commit 8569344

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

easybuild/framework/easyblock.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,15 +4038,6 @@ def ready_step_spec(initial):
40384038
return get_step(READY_STEP, "creating build dir, resetting environment", ready_substeps, False,
40394039
initial=initial)
40404040

4041-
source_substeps = [
4042-
(False, lambda x: x.checksum_step),
4043-
(True, lambda x: x.extract_step),
4044-
]
4045-
4046-
def source_step_spec(initial):
4047-
"""Return source step specified."""
4048-
return get_step(SOURCE_STEP, "unpacking", source_substeps, True, initial=initial)
4049-
40504041
install_substeps = [
40514042
(False, lambda x: x.stage_install_step),
40524043
(False, lambda x: x.make_installdir),
@@ -4060,6 +4051,7 @@ def install_step_spec(initial):
40604051
# format for step specifications: (step_name, description, list of functions, skippable)
40614052

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

40704062
# part 1: pre-iteration + first iteration
40714063
steps_part1 = [
4072-
(FETCH_STEP, 'fetching files', [lambda x: x.fetch_step], False),
4064+
(FETCH_STEP, 'fetching files', [lambda x: x.fetch_step, lambda x: x.checksum_step], False),
40734065
ready_step_spec(True),
4074-
source_step_spec(True),
4066+
extract_step_spec,
40754067
patch_step_spec,
40764068
prepare_step_spec,
40774069
configure_step_spec,
@@ -4085,7 +4077,7 @@ def install_step_spec(initial):
40854077
# not all parts of all steps need to be rerun (see e.g., ready, prepare)
40864078
steps_part2 = [
40874079
ready_step_spec(False),
4088-
source_step_spec(False),
4080+
extract_step_spec,
40894081
patch_step_spec,
40904082
prepare_step_spec,
40914083
configure_step_spec,

test/framework/options.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5497,7 +5497,7 @@ def test_fetch(self):
54975497
# which might trip up the dependency resolution (see #4298)
54985498
for ec in ('toy-0.0.eb', 'toy-0.0-deps.eb'):
54995499
args = [ec, '--fetch']
5500-
stdout, stderr = self._run_mock_eb(args, raise_error=True, strip=True, testing=False)
5500+
stdout, _ = self._run_mock_eb(args, raise_error=True, strip=True, testing=False)
55015501

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

5513+
# --fetch should also verify the checksums
5514+
tmpdir = tempfile.mkdtemp(prefix='easybuild-sources')
5515+
write_file(os.path.join(tmpdir, 'toy-0.0.tar.gz'), 'Make checksum check fail')
5516+
args = ['--sourcepath=%s:%s' % (tmpdir, self.test_sourcepath), '--fetch', 'toy-0.0.eb']
5517+
with self.mocked_stdout_stderr():
5518+
pattern = 'Checksum verification for .*/toy-0.0.tar.gz .*failed'
5519+
self.assertErrorRegex(EasyBuildError, pattern, self.eb_main, args, do_build=True, raise_error=True)
5520+
# We can avoid that failure by ignoring the checksums
5521+
args.append('--ignore-checksums')
5522+
self.eb_main(args, do_build=True, raise_error=True)
5523+
55135524
def test_parse_external_modules_metadata(self):
55145525
"""Test parse_external_modules_metadata function."""
55155526
# by default, provided external module metadata cfg files are picked up

0 commit comments

Comments
 (0)