From d6f5b1247ae1c4b2efa117de0d0f1b7fa8cf6207 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 12 Apr 2016 06:06:20 +0000 Subject: TLOBJ: support sha256, make_container returns sha256, use that git-svn-id: svn://tug.org/texlive/trunk@40424 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLPOBJ.pm | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm') diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index b84ab22e049..0da988c1aae 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -167,7 +167,11 @@ sub from_fh { $self->{$cmd} = $arg; } elsif ($cmd eq 'containermd5' || $cmd eq 'srccontainermd5' || $cmd eq 'doccontainermd5') { - $arg =~ /^[a-f0-9]+$/ or die "Illegal md5 value: $line!"; + $arg =~ /^[a-f0-9]{32}$/ or die "Illegal md5 value: $line!"; + $self->{$cmd} = $arg; + } elsif ($cmd eq 'containersha256' || $cmd eq 'srccontainersha256' + || $cmd eq 'doccontainersha256') { + $arg =~ /^[a-f0-9]{64}$/ or die "Illegal sha256 value: $line!"; $self->{$cmd} = $arg; } elsif ($cmd eq 'name') { $arg =~ /^([-.\w]+)$/ or die("Invalid name: $line!"); @@ -308,12 +312,18 @@ sub writeout { if (defined($self->{'containermd5'})) { print $fd "containermd5 $self->{'containermd5'}\n"; } + if (defined($self->{'containersha256'})) { + print $fd "containersha256 $self->{'containersha256'}\n"; + } if (defined($self->{'doccontainersize'})) { print $fd "doccontainersize $self->{'doccontainersize'}\n"; } if (defined($self->{'doccontainermd5'})) { print $fd "doccontainermd5 $self->{'doccontainermd5'}\n"; } + if (defined($self->{'doccontainersha256'})) { + print $fd "doccontainersha256 $self->{'doccontainersha256'}\n"; + } if (defined($self->{'docfiles'}) && (@{$self->{'docfiles'}})) { print $fd "docfiles size=$self->{'docsize'}\n"; foreach my $f (sort @{$self->{'docfiles'}}) { @@ -337,6 +347,9 @@ sub writeout { if (defined($self->{'srccontainermd5'})) { print $fd "srccontainermd5 $self->{'srccontainermd5'}\n"; } + if (defined($self->{'srccontainersha256'})) { + print $fd "srccontainersha256 $self->{'srccontainersha256'}\n"; + } if (defined($self->{'srcfiles'}) && (@{$self->{'srcfiles'}})) { print $fd "srcfiles size=$self->{'srcsize'}\n"; foreach (sort @{$self->{'srcfiles'}}) { @@ -674,7 +687,7 @@ sub make_container { return (0, 0, ""); } my $size = (stat "$destdir/$containername") [7]; - my $md5 = TeXLive::TLUtils::tlmd5("$destdir/$containername"); + my $sha256 = TeXLive::TLUtils::tlsha256("$destdir/$containername"); # cleaning up unlink("$tlpobjdir/$self->{'name'}.tlpobj"); @@ -683,8 +696,8 @@ sub make_container { rmdir($InfraLocation) if $removetlpkgdir; xchdir($cwd); - debug(" done $containername, size $size, $md5\n"); - return ($size, $md5, "$destdir/$containername"); + debug(" done $containername, size $size, $sha256\n"); + return ($size, $sha256, "$destdir/$containername"); } @@ -1480,8 +1493,11 @@ there are 6 more possible keys: $tlpobj->containermd5 $tlpobj->doccontainermd5 $tlpobj->srccontainermd5 + $tlpobj->containersha256 + $tlpobj->doccontainersha256 + $tlpobj->srccontainersha256 -describing the respective sizes and md5sums in bytes and as hex string, resp. +describing the respective sizes and md5sums/sha256sums in bytes and as hex string, resp. The latter two are only present if src/doc file container splitting is activated for that install medium. @@ -1562,7 +1578,7 @@ is placed into the root of the installation. This is used to distribute packages which can be installed in any arbitrary texmf tree (of other distributions, too). -Return values are the size, the md5sum, and the full name of the container. +Return values are the size, the sha256sum, and the full name of the container. =item C -- cgit v1.2.3