From 61e1143d502ef80da44657be8486c07a115ee56a Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Tue, 28 May 2019 16:33:06 +0100 Subject: [PATCH] JAL-3281 first bit of perl --- utils/install4j/outputs_to_table.pl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 utils/install4j/outputs_to_table.pl 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 }; + } +} + -- 1.7.10.2