PerlAlien / Alien-Build

Build external dependencies for use in CPAN
16 stars 25 forks source link

Only call plugin digest registered hook in extract #405

Open kiwiroy opened 1 year ago

kiwiroy commented 1 year ago

When implementing a dynamic check_digest around hook it is called up to 3 times, depending on the value of Digest attributes check_fetch and check_download. I've seen that $build->extract does most of the rule enforcement of download_rule and thought this could benefit from a change against some low effort subversion such as the around_hook below. By the build stage there shouldn't be any opportunity to update the meta_prop->{digest}

use alienfile;
share {
  plugin Digest => {'*' => [SHA256 => 'x' x 64]};
  meta->around_hook(check_digest => sub { return 1; });
};