Skip to content

Commit bd0858c

Browse files
author
ocaisa
authored
Merge pull request easybuilders#2579 from boegel/fix_checksums_exts_check
skip checksum check for extensions that are specified only by name
2 parents ebdd1da + a2104ee commit bd0858c

4 files changed

Lines changed: 26 additions & 17 deletions

File tree

easybuild/framework/easyblock.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,11 +1726,15 @@ def check_checksums(self):
17261726

17271727
# also check checksums for extensions
17281728
for ext in self.cfg['exts_list']:
1729-
ext_name = ext[0]
1730-
# take into account that extension may be a 2-tuple with just name/version
1731-
ext_opts = ext[2] if len(ext) == 3 else {}
1732-
# only a single source per extension is supported (see source_tmpl)
1733-
checksum_issues.extend(self.check_checksums_for(ext_opts, sub="of extension %s" % ext_name, source_cnt=1))
1729+
# just skip extensions for which only a name is specified
1730+
# those are just there to check for things that are in the "standard library"
1731+
if not isinstance(ext, basestring):
1732+
ext_name = ext[0]
1733+
# take into account that extension may be a 2-tuple with just name/version
1734+
ext_opts = ext[2] if len(ext) == 3 else {}
1735+
# only a single source per extension is supported (see source_tmpl)
1736+
res = self.check_checksums_for(ext_opts, sub="of extension %s" % ext_name, source_cnt=1)
1737+
checksum_issues.extend(res)
17341738

17351739
return checksum_issues
17361740

test/framework/easyconfigs/test_ecs/t/toy/toy-0.0-gompi-1.3.12-test.eb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ exts_default_options = {
2525
}
2626

2727
exts_list = [
28+
'ls', # extension that is part of "standard library"
2829
('bar', '0.0', {
2930
'buildopts': " && gcc bar.c -o anotherbar",
3031
'checksums': ['f3676716b610545a4e8035087f5be0a0248adee0abb3930d3edb76d498ae91e7'], # checksum for

test/framework/options.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3535,7 +3535,8 @@ def test_inject_checksums(self):
35353535
self.assertEqual(ec['patches'], ['toy-0.0_fix-silly-typo-in-printf-statement.patch'])
35363536
self.assertEqual(ec['checksums'], [toy_source_sha256, toy_patch_sha256])
35373537
self.assertEqual(ec['exts_default_options'], {'source_urls': ['http://example.com/%(name)s']})
3538-
self.assertEqual(ec['exts_list'][0], ('bar', '0.0', {
3538+
self.assertEqual(ec['exts_list'][0], 'ls')
3539+
self.assertEqual(ec['exts_list'][1], ('bar', '0.0', {
35393540
'buildopts': " && gcc bar.c -o anotherbar",
35403541
'checksums': [
35413542
bar_tar_gz_sha256,
@@ -3546,7 +3547,7 @@ def test_inject_checksums(self):
35463547
'toy_ext_param': "mv anotherbar bar_bis",
35473548
'unknowneasyconfigparameterthatshouldbeignored': 'foo',
35483549
}))
3549-
self.assertEqual(ec['exts_list'][1], ('barbar', '0.0', {
3550+
self.assertEqual(ec['exts_list'][2], ('barbar', '0.0', {
35503551
'checksums': ['a33100d1837d6d54edff7d19f195056c4bd9a4c8d399e72feaf90f0216c4c91c'],
35513552
}))
35523553

@@ -3562,7 +3563,7 @@ def test_inject_checksums(self):
35623563

35633564
# if any checksums are present already, it doesn't matter if they're wrong (since they will be replaced)
35643565
ectxt = read_file(test_ec)
3565-
for chksum in ec['checksums'] + [c for e in ec['exts_list'] for c in e[2]['checksums']]:
3566+
for chksum in ec['checksums'] + [c for e in ec['exts_list'][1:] for c in e[2]['checksums']]:
35663567
ectxt = ectxt.replace(chksum, chksum[::-1])
35673568
write_file(test_ec, ectxt)
35683569

test/framework/sandbox/easybuild/easyblocks/generic/toy_extension.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,25 @@ def extra_options():
4747

4848
def run(self):
4949
"""Build toy extension."""
50-
super(Toy_Extension, self).run(unpack_src=True)
51-
EB_toy.configure_step(self.master, name=self.name)
52-
EB_toy.build_step(self.master, name=self.name, buildopts=self.cfg['buildopts'])
50+
if self.src:
51+
super(Toy_Extension, self).run(unpack_src=True)
52+
EB_toy.configure_step(self.master, name=self.name)
53+
EB_toy.build_step(self.master, name=self.name, buildopts=self.cfg['buildopts'])
5354

54-
if self.cfg['toy_ext_param']:
55-
run_cmd(self.cfg['toy_ext_param'])
55+
if self.cfg['toy_ext_param']:
56+
run_cmd(self.cfg['toy_ext_param'])
5657

57-
EB_toy.install_step(self.master, name=self.name)
58+
EB_toy.install_step(self.master, name=self.name)
5859

59-
return self.module_generator.set_environment('TOY_EXT_%s' % self.name.upper(), self.name)
60+
return self.module_generator.set_environment('TOY_EXT_%s' % self.name.upper(), self.name)
6061

6162
def sanity_check_step(self, *args, **kwargs):
6263
"""Custom sanity check for toy extensions."""
6364
self.log.info("Loaded modules: %s", self.modules_tool.list())
6465
custom_paths = {
65-
'files': ['bin/%s' % self.name, 'lib/lib%s.a' % self.name],
66-
'dirs': [],
66+
'files': [],
67+
'dirs': ['.'], # minor hack to make sure there's always a non-empty list
6768
}
69+
if self.src:
70+
custom_paths['files'].extend(['bin/%s' % self.name, 'lib/lib%s.a' % self.name])
6871
return super(Toy_Extension, self).sanity_check_step(custom_paths=custom_paths)

0 commit comments

Comments
 (0)