@@ -179,8 +179,7 @@ highly recommended.
179179If checksums are provided, the checksum of the corresponding source
180180files and patches is verified to match.
181181
182- The ` checksums ` easyconfig parameter is usually defined as a list of
183- strings.
182+ The ` checksums ` easyconfig parameter is a list usually containing strings.
184183
185184Until EasyBuild v3.3.0, only MD5 checksums could be provided through a
186185list of strings. Since EasyBuild v3.3.0, the checksum type is determined
@@ -204,6 +203,66 @@ example:
204203checksums = [(' sha512' , ' f962008105639f58e9a4455c8057933ab0a5e2f43db8340ae1e1afe6dc2d24105bfca3b2e1f79cb242495ca4eb363c9820d8cea6084df9d62c4c3e5211d99266' )]
205204```
206205
206+ It is also possible to specify alternative checksums using a tuple of
207+ checksum elements where any match is sufficient (logical OR).
208+ This is helpful when the release was updated with changes that don't affect the behavior of the software in any way
209+ (e.g. only doc changes).
210+
211+ ``` python
212+ checksums = [(' 0123456789...abcdef' , ' fedcba...9876543210' )]
213+ ```
214+
215+ The opposite is also possible:
216+ A list instead of a tuple denotes that ** all** checksums must match (logical AND).
217+ In both cases each element can also be a type-value-tuple:
218+
219+ ``` python
220+ checksums = [[(' sha256' , ' 0123456789...abcdef' ), ' fedcba...9876543210' ]]
221+ ```
222+
223+ Finally, a checksum can be specified as a dictionary mapping filenames to checksums, removing any ambiguity.
224+ This style is used by EasyBuild with ` eb --inject-checksums ` when 2 or more source files are specified,
225+ and is particularly useful when the source file is specified using a template value like ` %(arch)s ` .
226+ Especially when many source files and patches are used this also directly documents the file each checksum is for.
227+ Again, elements (values) can be strings or type-value-tuples.
228+ For example:
229+
230+ ``` python
231+ checksums = [{
232+ ' src_x86_64.tgz' : ' 0123456789...abcdef' ,
233+ ' src_aarch64.tgz' : (' sha256' , ' fedcba...9876543210' ),
234+ }]
235+ ```
236+
237+ Of course this can be combined with the logical AND/OR semantics using lists or tuples:
238+
239+ ``` python
240+ checksums = [{
241+ ' src_x86_64.tgz' : (' 0123456789...abcdef' , ' fedcba...9876543210' ), # Match either one
242+ ' src_aarch64.tgz' : [(' sha256' , ' 9876543210...fedcba' ), ' abcdef...0123456789' ], # Match both
243+ }]
244+ ```
245+
246+ When the checksum cannot be specified for a file
247+ (e.g. when using a git clone instead of an archive),
248+ a value of ` None ` can be used to skip the checksum check.
249+ This is possible in the list of checksums as well as a value in a dictionary, e.g.:
250+
251+ ``` python
252+ checksums = [
253+ None , # No checksum for first source file
254+ ' 0123456789...abcdef' , # checksum for 2nd file
255+ {
256+ ' third_file_x86_64.tgz' : ' fedcba...9876543210' ,
257+ ' third_file_aarch64.tgz' : None ,
258+ },
259+ ]
260+ ```
261+
262+ Note that not having an entry in the dict for a file will raise an error
263+ while a value of ` None ` will skip the checksum verification for that file.
264+ But even in the latter case the ` --enforce_checksums ` option will raise an error.
265+
207266##### Adding or replacing checksums using ` --inject-checksums ` {: #inject_checksums }
208267
209268Using the ` --inject-checksums ` command line option, you can let
@@ -430,7 +489,7 @@ cannot be automated. Reasons for this include:
430489You can use the ` download_instructions ` parameter to specify steps for
431490the user to do. This parameter takes string value and prints it whenever
432491build fails because any file needed was not found. If
433- ` download_instructions ` is not specified, Easybuild prints the default
492+ ` download_instructions ` is not specified, EasyBuild prints the default
434493message stating the paths that were tested.
435494
436495``` python
0 commit comments