From 2755f65eba832a51da2717da3e1081f8ea22dfa1 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 21 Dec 2024 18:44:07 +0100 Subject: [PATCH] resolve template values when getting checksums for extensions --- easybuild/framework/easyblock.py | 2 +- test/framework/easyconfig.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/easybuild/framework/easyblock.py b/easybuild/framework/easyblock.py index 0080ac0a27..c806f36247 100644 --- a/easybuild/framework/easyblock.py +++ b/easybuild/framework/easyblock.py @@ -614,7 +614,7 @@ def collect_exts_file_info(self, fetch_files=True, verify_checksums=True): template_values.update(template_constant_dict(ext_src)) source_urls = resolve_template(ext_options.get('source_urls', []), template_values) - checksums = ext_options.get('checksums', []) + checksums = resolve_template(ext_options.get('checksums', []), template_values) download_instructions = resolve_template(ext_options.get('download_instructions'), template_values) diff --git a/test/framework/easyconfig.py b/test/framework/easyconfig.py index b1eb2fc7db..61a6b183be 100644 --- a/test/framework/easyconfig.py +++ b/test/framework/easyconfig.py @@ -494,8 +494,11 @@ def test_exts_list(self): "checksums": [ # SHA256 checksum for source (gzip-1.4.eb) "6a5abcab719cefa95dca4af0db0d2a9d205d68f775a33b452ec0f2b75b6a3a45", - # SHA256 checksum for 'patch' (toy-0.0.eb) - "177b34bcdfa1abde96f30354848a01894ebc9c24913bc5145306cd30f78fc8ad", + # SHA256 checksum for 'patch' (toy-0.0.eb); + # using dict value with key that has a template value, + # to make sure that works as expected... + {"toy-0.%(version_minor)s.eb": + "177b34bcdfa1abde96f30354848a01894ebc9c24913bc5145306cd30f78fc8ad"}, ], }), # Can use templates in name and version @@ -519,7 +522,8 @@ def test_exts_list(self): self.assertEqual(exts_sources[1]['version'], '2.0') self.assertEqual(exts_sources[1]['options'], { 'checksums': ['6a5abcab719cefa95dca4af0db0d2a9d205d68f775a33b452ec0f2b75b6a3a45', - '177b34bcdfa1abde96f30354848a01894ebc9c24913bc5145306cd30f78fc8ad'], + {'toy-0.%(version_minor)s.eb': + '177b34bcdfa1abde96f30354848a01894ebc9c24913bc5145306cd30f78fc8ad'}], 'patches': [('toy-0.0.eb', '.')], 'source_tmpl': 'gzip-1.4.eb', 'source_urls': [('http://example.com', 'suffix')],