envinfo/envinfo.pl
author Dario Sestito <darios@symbian.org>
Mon, 07 Jun 2010 12:44:01 +0100
changeset 277 e7df00ade863
parent 276 ad9846216af2
child 286 047e37a8f43f
permissions -rw-r--r--
Improve/fix help info
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     2
# This component and the accompanying materials are made available
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     4
# which accompanies this distribution, and is available
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     6
#
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     7
# Initial Contributors:
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     8
# Symbian Foundation Ltd - initial contribution.
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
     9
#
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    10
# Contributors:
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    11
# Dario Sestito <darios@symbian.org>
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    12
#
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    13
# Description:
277
e7df00ade863 Improve/fix help info
Dario Sestito <darios@symbian.org>
parents: 276
diff changeset
    14
# Dumps environment info such as tools version to cmdline and/or to a file.
e7df00ade863 Improve/fix help info
Dario Sestito <darios@symbian.org>
parents: 276
diff changeset
    15
# Compare environment info with a baseline
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    16
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    17
use strict;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    18
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    19
use Getopt::Long;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    20
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    21
my $report;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    22
my $output = "\\output\\logs\\envinfo.txt";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    23
my $compare;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    24
my $baseline = "\\build_info\\logs\\envinfo.txt";
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    25
my $help = 0;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    26
GetOptions((
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    27
	'report:s' => \$report,
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    28
	'compare:s' => \$compare,
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    29
	'help!' => \$help
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    30
));
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    32
$output = $report if ($report);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    33
$baseline = $compare if ($compare);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    34
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    35
if ($help)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    36
{
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    37
	print "Dumps environment info such as tools version to cmdline and/or to a file\n";
277
e7df00ade863 Improve/fix help info
Dario Sestito <darios@symbian.org>
parents: 276
diff changeset
    38
	print "Compare info with a baseline\n";
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    39
	print "Usage: perl envinfo.pl [OPTIONS]\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    40
	print "where OPTIONS are:\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    41
	print "-r,--report [FILE]\tCreate report file (default \\output\\logs\\envinfo.txt)\n";
277
e7df00ade863 Improve/fix help info
Dario Sestito <darios@symbian.org>
parents: 276
diff changeset
    42
	print "-c,--compare [LOCATION]\tCompare environment with info at LOCATION (default \\build_info\\logs\\envinfo.txt)\n";
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    43
	exit(0);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    44
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    45
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    46
my $baseline_environment_info = {};
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    47
if (defined $compare)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    48
{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    49
	my $target = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    50
	my $tmp_file = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    51
	# understand where we should get the info from
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    52
	$target = $baseline if (-f $baseline);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    53
	$target = "$baseline\\envinfo.txt" if (!$target && -f "$baseline\\envinfo.txt");
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    54
	$target = "$baseline\\build_info\\logs\\envinfo.txt" if (!$target && -f "$baseline\\build_info\\logs\\envinfo.txt");
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    55
	$target = "$baseline\\build_BOM.zip" if (!$target && -f "$baseline\\build_BOM.zip");
276
ad9846216af2 Fix: wrong location for envinfo.txt in zip file. Add more locations to look for envinfo.txt
Dario Sestito <darios@symbian.org>
parents: 275
diff changeset
    56
	$target = "$baseline\\output\\logs\\envinfo.txt" if (!$target && -f "$baseline\\output\\logs\\envinfo.txt");
ad9846216af2 Fix: wrong location for envinfo.txt in zip file. Add more locations to look for envinfo.txt
Dario Sestito <darios@symbian.org>
parents: 275
diff changeset
    57
	$target = "$baseline\\output\\zips\\release\\build_BOM.zip" if (!$target && -f "$baseline\\output\\zips\\release\\build_BOM.zip");
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    58
	if (!$target)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    59
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    60
		warn "WARNING: Can't find envinfo.txt from location '$baseline'\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    61
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    62
	elsif ($target =~ /\.zip$/)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    63
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    64
		print "Extracting envinfo.txt from $target\n";
276
ad9846216af2 Fix: wrong location for envinfo.txt in zip file. Add more locations to look for envinfo.txt
Dario Sestito <darios@symbian.org>
parents: 275
diff changeset
    65
		my $cmd = "7z e -y $target build_info\\logs\\BOM\\envinfo.txt";
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    66
		my $output = `$cmd 2>&1`;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    67
		if ($output =~ /is not recognized as an internal or external command/)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    68
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    69
			$target = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    70
			warn "WARNING: You need to have 7z in the PATH if you want to do comparison against a compressed baseline\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    71
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    72
		elsif ($output =~ /No files to process/)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    73
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    74
			$target = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    75
			warn "WARNING: The compressed baseline doesn't seem to contain an envinfo.txt file\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    76
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    77
		else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    78
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    79
			my $tmp_file = "tmp$$.txt";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    80
			system("ren envinfo.txt $tmp_file"); 
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    81
			$target = $tmp_file;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    82
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    83
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    84
	
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    85
	if (!$target)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    86
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    87
		warn "WARNING: Will not do comparison\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    88
		$compare = undef; 
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    89
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    90
	else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    91
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    92
		print "Will compare environment info to $target\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    93
		
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    94
		if (open(BASEINFO, $target))
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    95
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    96
			for my $line (<BASEINFO>)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    97
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    98
				if ($line =~ /([^\t]*)\t([^\t]*)/)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
    99
				{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   100
					my $name = $1;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   101
					my $version = $2;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   102
					chomp $name;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   103
					chomp $version;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   104
					$baseline_environment_info->{$name}=$version;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   105
				}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   106
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   107
			close(BASEINFO);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   108
			unlink $tmp_file if ($tmp_file);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   109
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   110
		else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   111
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   112
			warn "WARNING: Could not open file $target for reading. Will not do comparison\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   113
			$compare = undef;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   114
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   115
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   116
	
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   117
}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   118
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   119
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   120
my @environment_info = ();
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   121
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   122
# Machine name
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   123
push @environment_info, {name=>'Machine', version=>$ENV{'COMPUTERNAME'}};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   124
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   125
# OS Name and Version
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   126
my $os_name = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   127
my $os_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   128
my $os_out = `systeminfo`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   129
$os_name = $1 if ($os_out =~ /^OS Name:\s+(.*)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
$os_ver = $1 if ($os_out =~ /^OS Version:\s+(.*)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
push @environment_info, {name=>'OS Name', version=>$os_name};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
push @environment_info, {name=>'OS Version', version=>$os_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   134
# Perl
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
my $perl_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
my $perl_out = `perl -v`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
$perl_ver = $1 if ($perl_out =~ /This is perl, v(\S+)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
push @environment_info, {name=>'Perl', version=>$perl_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   140
# Python
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   141
my $python_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   142
my $python_out = `python -V 2>&1`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   143
$python_ver = $1 if ($python_out =~ /^Python\s+(\S+)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
push @environment_info, {name=>'Python', version=>$python_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
# Mercurial
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   147
my $hg_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   148
my $hg_out = `hg --version`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   149
$hg_ver = $1 if ($hg_out =~ /^Mercurial Distributed SCM \(version ([^)]+)\)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   150
push @environment_info, {name=>'Mercurial', version=>$hg_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   151
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   152
# 7-Zip
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   153
my $zip_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   154
my $zip_out = `7z`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   155
$zip_ver = $1 if ($zip_out =~ /^7-Zip\s+(\S+)\s+Copyright/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   156
push @environment_info, {name=>'7-Zip', version=>$zip_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   157
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   158
# Raptor
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   159
my $sbs_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   160
my $sbs_out = `sbs -v`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
$sbs_ver = $1 if ($sbs_out =~ /^sbs version (.*)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   162
push @environment_info, {name=>'sbs', version=>$sbs_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
# Metrowerk Compiler
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
my $mwcc_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
my $mwcc_out = `mwccsym2 -version`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   167
$mwcc_ver = $1 if ($mwcc_out =~ /^Version (.*)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   168
push @environment_info, {name=>'mwccsym2', version=>$mwcc_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
# RVCT 2.2
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
my $rvct22_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
my $rvct22_path = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   173
if (defined $ENV{'SBS_RVCT22BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   174
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
	$rvct22_path = $ENV{'SBS_RVCT22BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
elsif (defined $ENV{'RVCT22BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   179
	$rvct22_path = $ENV{'RVCT22BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   180
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   181
my $rvct22_cmd = 'armcc 2>&1';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   182
$rvct22_cmd = "$rvct22_path\\$rvct22_cmd" if ($rvct22_path);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   183
my $rvct22_out = `$rvct22_cmd`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   184
$rvct22_ver = $1 if ($rvct22_out =~ m#ARM/Thumb C/C\+\+ Compiler, RVCT2.2 (.*)#m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   185
push @environment_info, {name=>'RVCT2.2', version=>$rvct22_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   186
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   187
# RVCT 4.0
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
my $rvct40_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
my $rvct40_path = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
if (defined $ENV{'SBS_RVCT40BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   192
	$rvct40_path = $ENV{'SBS_RVCT40BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   193
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
elsif (defined $ENV{'RVCT40BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
	$rvct40_path = $ENV{'RVCT40BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   198
my $rvct40_cmd = 'armcc 2>&1';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   199
$rvct40_cmd = "$rvct40_path\\$rvct40_cmd" if ($rvct40_path);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
my $rvct40_out = `$rvct40_cmd`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
$rvct40_ver = $1 if ($rvct40_out =~ m#ARM C/C\+\+ Compiler, RVCT4.0 (.*)#m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
push @environment_info, {name=>'RVCT4.0', version=>$rvct40_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
# GCCE 4.4.1
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
my $gcc441_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
my $gcc441_path = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
if (defined $ENV{'SBS_GCCE441BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   208
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   209
	$gcc441_path = $ENV{'SBS_GCCE441BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   210
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   211
elsif (defined $ENV{'GCCE441BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   213
	$gcc441_path = $ENV{'GCCE441BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   215
if ($gcc441_path)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   216
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
	my $gcc441_cmd = "$gcc441_path\\arm-none-symbianelf-g++ -dumpversion";
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
	my $gcc441_out = `$gcc441_cmd`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
	$gcc441_ver = "4.4.1" if ($gcc441_out =~ /4.4.1/);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
push @environment_info, {name=>'GCC4.4.1', version=>$gcc441_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
# Helium
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
my $helium_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
if ($ENV{'HELIUM_HOME'} && -f "$ENV{'HELIUM_HOME'}\\config\\version.txt")
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
	open(VERSION, "$ENV{'HELIUM_HOME'}\\config\\version.txt");
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
	my $line = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
	while ($line = <VERSION>)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   230
	{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
		$helium_ver = $1 if ($line =~ /^helium\.version=(.*)/);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   232
	}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   233
	close(VERSION);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
push @environment_info, {name=>'helium', version=>$helium_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
# java
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
my $java_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
my $java_out = `java -version 2>&1`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
$java_ver = $1 if ($java_out =~ /^java version (.*)/m);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
push @environment_info, {name=>'java', version=>$java_ver};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   243
# change tabs to spaces
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
for my $tool_info (@environment_info)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
{
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   246
	$tool_info->{name} =~ s/\t/ /g;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   247
	$tool_info->{version} =~ s/\t/ /g;
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   248
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   249
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   250
print "\nTools breakdown\n";
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   251
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   252
my $cmp_notpresent = 0;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   253
my $cmp_diffver = 0;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   254
for my $tool_info (@environment_info)
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
{
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   256
	print " " . $tool_info->{name} . ": " . $tool_info->{version};
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   257
	
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   258
	if (defined $compare &&
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   259
		$tool_info->{name} ne 'Machine' &&
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   260
		$tool_info->{name} ne 'OS Name')
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
	{
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   262
		print "\t";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   263
		if (defined $baseline_environment_info->{$tool_info->{name}})
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   264
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   265
			my $baselineversion = $baseline_environment_info->{$tool_info->{name}};
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   266
			if ($tool_info->{version} eq 'N.A.' && $baselineversion ne 'N.A.')
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   267
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   268
				print "[ERROR: tool not present]";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   269
				$cmp_notpresent++;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   270
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   271
			elsif ($tool_info->{version} eq $baselineversion || $baselineversion eq 'N.A.')
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   272
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   273
				print "[OK]";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   274
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   275
			elsif ($tool_info->{version} cmp $baselineversion < 0)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   276
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   277
				print "[WARNING: less recent than baseline]";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   278
				$cmp_diffver++;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   279
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   280
			elsif ($tool_info->{version} cmp $baselineversion > 0)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   281
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   282
				print "[WARNING: more recent than baseline]";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   283
				$cmp_diffver++;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   284
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   285
		}
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   286
	}
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   287
	print "\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   288
}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   289
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   290
print "\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   291
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   292
if (defined $compare)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   293
{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   294
	print "Summary of comparison to baseline:\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   295
	if ($cmp_notpresent || $cmp_diffver)
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   296
	{
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   297
		print " Tools not present or not found in the expected location: $cmp_notpresent\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   298
		print " Tools at different version: $cmp_diffver\n";
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   299
	}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   300
	else
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   301
	{
275
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   302
		print " All tools seem to match the baseline :-)\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   303
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   304
	print "\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   305
}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   306
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   307
# write report file
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   308
if (defined $report)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   309
{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   310
	if (open(ENVINFO, ">$output"))
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   311
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   312
		for my $tool_info (@environment_info)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   313
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   314
			print ENVINFO "$tool_info->{name}\t$tool_info->{version}\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   315
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   316
		close(ENVINFO);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   317
		print "Wrote report file: $output\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   318
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   319
	else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   320
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 274
diff changeset
   321
		warn "WARNING: Could not write to file: $output\n";
274
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   322
	}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   323
}