Add sha256 digest
This commit is contained in:
parent
3964928563
commit
636850a7ba
7
import-tars.perl
Normal file → Executable file
7
import-tars.perl
Normal file → Executable file
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
use Digest::SHA;
|
||||||
|
|
||||||
my $metaext = '';
|
my $metaext = '';
|
||||||
|
|
||||||
|
@ -43,6 +44,10 @@ foreach my $tar_file (@ARGV)
|
||||||
$tar_file =~ m,([^/]+)$,;
|
$tar_file =~ m,([^/]+)$,;
|
||||||
my $tar_name = $1;
|
my $tar_name = $1;
|
||||||
|
|
||||||
|
my $sha = Digest::SHA->new("256");
|
||||||
|
$sha->addfile($tar_file);
|
||||||
|
my $tar_sha256 = $sha->hexdigest;
|
||||||
|
|
||||||
if ($tar_name =~ s/\.(tar\.gz|tgz)$//) {
|
if ($tar_name =~ s/\.(tar\.gz|tgz)$//) {
|
||||||
open(I, '-|', 'gunzip', '-c', $tar_file)
|
open(I, '-|', 'gunzip', '-c', $tar_file)
|
||||||
or die "Unable to gunzip -c $tar_file: $!\n";
|
or die "Unable to gunzip -c $tar_file: $!\n";
|
||||||
|
@ -164,7 +169,7 @@ foreach my $tar_file (@ARGV)
|
||||||
$have_top_dir = 0 if $top_dir ne $1;
|
$have_top_dir = 0 if $top_dir ne $1;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $commit_msg = "Imported from $tar_file.";
|
my $commit_msg = "Imported from $tar_file.\n\nSHA256:$tar_sha256";
|
||||||
my $this_committer_name = $committer_name;
|
my $this_committer_name = $committer_name;
|
||||||
my $this_committer_email = $committer_email;
|
my $this_committer_email = $committer_email;
|
||||||
my $this_author_name = $author_name;
|
my $this_author_name = $author_name;
|
||||||
|
|
Loading…
Reference in a new issue