I hope I don't drag you too much into this ;-), yet I adore the generality
of the proposed structure!
(think in functional language terms, this can be very elegantly expressed
;-)


On Fri, Nov 29, 2013 at 4:31 PM, Kenneth Hoste <notifications@github.com>wrote:

> In easybuild/tools/filetools.py:
>
> > @@ -226,6 +236,62 @@ def download_file(filename, url, path):
> >      return None
> >
> >
> > +def compute_checksum(path, checksum_type='md5'):
> > +    """
> > +    Compute checksum of specified file.
> > +
> > +    @param path: Path of file to compute checksum for
> > +    @param checksum_type: Type of checksum ('adler32', 'crc32', 'md5' (default), 'sha1')
> > +    """
> > +    checksum_functions = {
> > +        'adler32': lambda x: '0x%s' % zlib.adler32(x),
> > +        'crc32': lambda x: '0x%s' % binascii.crc32(x),
> > +        'md5': lambda x: md5.md5(x).hexdigest(),
> > +        'sha1': lambda x: sha.sha(x).hexdigest(),
>
> Hmm, I guess it would make sense, but right now the current support does
> not allow combining multiple checksums, i.e. it's one checksum per file. It
> may not be too hard to get that supported too though; basically just accept
> a list of tuples instead of a single tuple as well, e.g.:
>
> checksum = [[('md5', 'afe95929'), ('size', '123456')], ('md5', '491abed')]
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/hpcugent/easybuild-framework/pull/774/files#r8003877>
> .
>