To avoid scanning templates multiple times, because
symbolic links were included, use find to scan only
directories below srcpkgs and collect their
srcpkgs/<dir>/template files.
Previously, xbps-src would try to find checksums in template files
and not purge those found but it actually ignored everything that
had the checksums specified on multiple lines.
The reason for this is that the bash 'read' builtin reads until it
finds a newline, and if you specify multiple checksums on multiple
lines rather than on one line it would ignore all but the first.
Fix this by replacing newlines with spaces, so that it can properly
read all checksums into an array.
To catch all SHA256 hashes from a template, even the ones which
are used only under certain preconditions, use grep [0-9a-f]{64} to
find all hashes in a template.
The may be some false positives which does not hurt the intended
purpose to purge obsolete distfiles.
Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
When sourcing templates to get $checksum there are templates
calling msg_error(). This is not relevant for this function,
thus define a local dummy msg_error() to ignore these cases.