Skip to content

Commit

Permalink
creatensis.pl: check md5sums
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 25, 2014
1 parent 29e9272 commit af17dbf
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions ms-windows/osgeo4w/creatensis.pl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

pod2usage(1) if $help;

my $wgetopt = $verbose ? "" : "-q";
my $wgetopt = $verbose ? "" : "-nv";

unless(-f "nsis/System.dll") {
mkdir "nsis", 0755 unless -d "nsis";
Expand All @@ -70,21 +70,29 @@
my %file;
my %lic;
my %sdesc;
my %md5;
my $package;

system "wget $wgetopt -O setup.ini -c $root$archpath/$ininame";
die "download of setup.ini failed" if $?;
open F, "setup.ini" || die "setup.ini not found";
while(<F>) {
my $file;
my $md5;

chop;
if(/^@ (\S+)/) {
$package = $1;
} elsif( /^requires: (.*)$/ ) {
@{$dep{$package}} = split / /, $1;
} elsif( /^install:\s+(\S+)\s+/) {
$file{$package} = $1 unless exists $file{$package};
} elsif( /^license:\s+(\S+)\s+/) {
$lic{$package} = $1 unless exists $lic{$package};
} elsif( ($file,$md5) = /^install:\s+(\S+)\s+.*\s+(\S+)$/) {
$file{$package} = $file unless exists $file{$package};
$file =~ s/^.*\///;
$md5{$file} = $md5 unless exists $md5{$file};
} elsif( ($file,$md5) = /^license:\s+(\S+)\s+.*\s+(\S+)$/) {
$lic{$package} = $file unless exists $lic{$package};
$file =~ s/^.*\///;
$md5{$file} = $md5 unless exists $md5{$file};
} elsif( /^sdesc:\s*"(.*)"\s*$/) {
$sdesc{$package} = $1 unless exists $sdesc{$package};
}
Expand Down Expand Up @@ -145,6 +153,28 @@ sub getDeps {
print "Downloading $file [$f]...\n" if $verbose;
system "wget $wgetopt -c $f";
die "download of $f failed" if $?;

if( exists $md5{$file} ) {
my $md5;
open F, "md5sum $file|";
while(<F>) {
if( /^(\S+)\s+$file$/ ) {
$md5 = $1;
}
}
close F;

die "No md5sum of $p determined" unless defined $md5;
if( $md5 eq $md5{$file} ) {
print "md5sum of $file verified.\n" if $verbose;
} else {
die "md5sum mismatch for $file [$md5 vs $md5{$file{$p}}]"
}
}
else
{
die "md5sum for $file not found.\n";
}
}
}

Expand Down Expand Up @@ -398,7 +428,7 @@ sub getDeps {
$cmd .= " QGIS-Installer.nsi";

system $cmd;
die "running nsis failed" if $?;
die "running nsis failed [$cmd]" if $?;

open P, ">osgeo4w/binary$archpostfix-$version";
print P $binary;
Expand Down

0 comments on commit af17dbf

Please sign in to comment.