hooks/do-fetch/00-distfiles.sh: contents checksum

Add support for contents checksums. This is meant to be used for tarballs
like the ones coming from https://*.googlesource.com/ which on every download
change their outer checksum due to being packaged with different date/time
stamps or similar.

If such a distfile still contains the same files as the author of a template
found, then the checksum of its contents can be specified by prepending a
commercial at (@) to the corresponding checksum="..." line.

Depending on the format of the distfile its entire contents will then be
piped into sha256sum and the resulting digest is verified against what
follows after the @.
This commit is contained in:
Jürgen Buchmüller 2018-03-02 23:07:30 +01:00
parent 95fd1e8401
commit c1fd6c389e
2 changed files with 124 additions and 13 deletions

View file

@ -419,6 +419,13 @@ Example:
separated by blanks. Please note that the order must be the same than
was used in `${distfiles}`. Example `checksum="kkas00xjkjas"`
If a distfile changes its checksum for every download because it is packaged
on the fly on the server, like e.g. snapshot tarballs from any of the
`https://*.googlesource.com/` sites, the checksum of the `archive contents`
can be specified by prepending a commercial at (@).
For tarballs you can find the contents checksum by using the command
`tar xf <tarball.ext> --to-stdout | sha256sum`.
- `wrksrc` The directory name where the package sources are extracted, by default
set to `${pkgname}-${version}`.