Skip to content

Commit d2cfb88

Browse files
authored
Merge pull request #4806 from Flamefire/nosource-checksum-fix
Fix `check_checksums` when `nosource: True` is used.
2 parents 3a82615 + 0efd939 commit d2cfb88

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

easybuild/framework/easyblock.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2783,7 +2783,8 @@ def check_checksums(self):
27832783
# take into account that extension may be a 2-tuple with just name/version
27842784
ext_opts = ext[2] if len(ext) == 3 else {}
27852785
# only a single source per extension is supported (see source_tmpl)
2786-
res = self.check_checksums_for(ext_opts, sub="of extension %s" % ext_name, source_cnt=1)
2786+
source_cnt = 1 if not ext_opts.get('nosource') else 0
2787+
res = self.check_checksums_for(ext_opts, sub="of extension %s" % ext_name, source_cnt=source_cnt)
27872788
checksum_issues.extend(res)
27882789

27892790
return checksum_issues

test/framework/easyconfig.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4197,10 +4197,10 @@ def test_check_sha256_checksums(self):
41974197
# re-test with right checksum in place
41984198
toy_sha256 = '44332000aa33b99ad1e00cbd1a7da769220d74647060a10e807b916d73ea27bc'
41994199
test_ec_txt = checksums_regex.sub('checksums = ["%s"]' % toy_sha256, toy_ec_txt)
4200-
test_ec_txt = re.sub(r'patches = \[(.|\n)*\]', '', test_ec_txt)
4200+
passing_test_ec_txt = re.sub(r'patches = \[(.|\n)*\]', '', test_ec_txt)
42014201

42024202
test_ec = os.path.join(self.test_prefix, 'toy-0.0-ok.eb')
4203-
write_file(test_ec, test_ec_txt)
4203+
write_file(test_ec, passing_test_ec_txt)
42044204
ecs, _ = parse_easyconfigs([(test_ec, False)])
42054205
ecs = [ec['ec'] for ec in ecs]
42064206

@@ -4236,6 +4236,15 @@ def test_check_sha256_checksums(self):
42364236
regex = re.compile(r"Non-SHA256 checksum\(s\) found for toy-0.0.tar.gz:.*not_really_a_sha256_checksum")
42374237
self.assertTrue(regex.match(res[0]), "Pattern '%s' found in: %s" % (regex.pattern, res[0]))
42384238

4239+
# Extension with nosource: True
4240+
test_ec_txt = passing_test_ec_txt + "exts_list = [('bar', '0.0', { 'nosource': True })]"
4241+
toy_sha256 = '44332000aa33b99ad1e00cbd1a7da769220d74647060a10e807b916d73ea27bc'
4242+
test_ec = os.path.join(self.test_prefix, 'toy-0.0-nosource.eb')
4243+
write_file(test_ec, test_ec_txt)
4244+
ecs, _ = parse_easyconfigs([(test_ec, False)])
4245+
ecs = [ec['ec'] for ec in ecs]
4246+
self.assertEqual(check_sha256_checksums(ecs), [])
4247+
42394248
def test_deprecated(self):
42404249
"""Test use of 'deprecated' easyconfig parameter."""
42414250
topdir = os.path.dirname(os.path.abspath(__file__))

0 commit comments

Comments
 (0)