JAL-3281 first bit of perl
[jalview.git] / utils / install4j / outputs_to_table.pl
1 #!/usr/bin/env perl
2
3 use strict;
4 use warnings;
5
6 my @oses = qw(macos windows shell unix jar);
7
8 my $osinstallers = {};
9
10 while(my $line = <STDIN>) {
11   chomp $line;
12   $line =~ s/#.*//;
13   my ($id, $os, $name, $file) = split(m/\t/, $line);
14   next unless $id and $os and $name and $file and (-e $file);
15
16   my $size = -s $file;
17   my $mbsize;
18   if ($size > 0) {
19     $mbsize = sprintf("%.1f",$size/(2**20));
20   }
21
22   if ($name =~ m/\bShell\b/) {
23     $os = "shell";
24   }
25
26
27   if ($file =~ m/(NETWORK|OFFLINE)/) {
28     my $type = $1;
29     $osinstallers->{$os} = {} unless ref($osinstallers->{$os}) eq "HASH";
30     $osinstallers->{$os}{$type} = { os => $os, name => $name, file => $file, size => $mbsize };
31   }
32 }
33