From: Ben Soares Date: Tue, 28 May 2019 15:33:06 +0000 (+0100) Subject: JAL-3281 first bit of perl X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Ftask%2FJAL-3281_Automatic_installers_download_table_generation;p=jalview.git JAL-3281 first bit of perl --- diff --git a/utils/install4j/outputs_to_table.pl b/utils/install4j/outputs_to_table.pl new file mode 100755 index 0000000..3b9b9be --- /dev/null +++ b/utils/install4j/outputs_to_table.pl @@ -0,0 +1,33 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + +my @oses = qw(macos windows shell unix jar); + +my $osinstallers = {}; + +while(my $line = ) { + chomp $line; + $line =~ s/#.*//; + my ($id, $os, $name, $file) = split(m/\t/, $line); + next unless $id and $os and $name and $file and (-e $file); + + my $size = -s $file; + my $mbsize; + if ($size > 0) { + $mbsize = sprintf("%.1f",$size/(2**20)); + } + + if ($name =~ m/\bShell\b/) { + $os = "shell"; + } + + + if ($file =~ m/(NETWORK|OFFLINE)/) { + my $type = $1; + $osinstallers->{$os} = {} unless ref($osinstallers->{$os}) eq "HASH"; + $osinstallers->{$os}{$type} = { os => $os, name => $name, file => $file, size => $mbsize }; + } +} +