envinfo/envinfo.pl
author andy simpson <andrews@symbian.org>
Fri, 15 Oct 2010 16:47:51 +0100
changeset 299 c0fb460d1a21
parent 283 46889a3f0a06
permissions -rw-r--r--
add id for s^4 kits
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
251
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:
254
e7df00ade863 Improve/fix help info
Dario Sestito <darios@symbian.org>
parents: 253
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: 253
diff changeset
    15
# Compare environment info with a baseline
251
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
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    21
my $report;
262
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
    22
my $output = "$ENV{'EPOCROOT'}\\output\\logs\\envinfo.txt";
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
    23
$output =~ s/^\\+/\\/;
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    24
my $compare;
262
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
    25
my $baseline = "$ENV{'EPOCROOT'}\\build_info\\logs\\envinfo.txt";
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
    26
$baseline =~ s/^\\+/\\/;
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    27
my $help = 0;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    28
GetOptions((
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    29
	'report:s' => \$report,
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    30
	'compare:s' => \$compare,
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    31
	'help!' => \$help
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    32
));
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    33
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    34
$output = $report if ($report);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    35
$baseline = $compare if ($compare);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    36
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    37
if ($help)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    38
{
261
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    39
print <<_EOH;
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    40
envinfo
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    41
Dumps environment info such as tools version to cmdline and/or to a file
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    42
Compare info with a baseline
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    43
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    44
Usage: envinfo.pl [options]
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    45
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    46
Options:
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    47
  -h, --help            Show this help message and exit
262
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
    48
  -r,--report [FILE]    Write report to FILE (default %EPOCROOT%\\output\\logs\\envinfo.txt)
261
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    49
  -c,--compare [LOCATION]
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    50
                        Compare environment with info at LOCATION
262
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
    51
                        (default %EPOCROOT%\\build_info\\logs\\envinfo.txt)
261
598059d917c3 Restructure envinfo help
Dario Sestito <darios@symbian.org>
parents: 260
diff changeset
    52
_EOH
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    53
	exit(0);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    54
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
    55
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    56
my $baseline_environment_info = {};
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    57
if (defined $compare)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    58
{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    59
	my $target = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    60
	my $tmp_file = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    61
	# 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: 251
diff changeset
    62
	$target = $baseline if (-f $baseline);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    63
	$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: 251
diff changeset
    64
	$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: 251
diff changeset
    65
	$target = "$baseline\\build_BOM.zip" if (!$target && -f "$baseline\\build_BOM.zip");
253
ad9846216af2 Fix: wrong location for envinfo.txt in zip file. Add more locations to look for envinfo.txt
Dario Sestito <darios@symbian.org>
parents: 252
diff changeset
    66
	$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: 252
diff changeset
    67
	$target = "$baseline\\output\\zips\\release\\build_BOM.zip" if (!$target && -f "$baseline\\output\\zips\\release\\build_BOM.zip");
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    68
	if (!$target)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    69
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    70
		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: 251
diff changeset
    71
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    72
	elsif ($target =~ /\.zip$/)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    73
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    74
		print "Extracting envinfo.txt from $target\n";
253
ad9846216af2 Fix: wrong location for envinfo.txt in zip file. Add more locations to look for envinfo.txt
Dario Sestito <darios@symbian.org>
parents: 252
diff changeset
    75
		my $cmd = "7z e -y $target build_info\\logs\\BOM\\envinfo.txt";
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    76
		my $output = `$cmd 2>&1`;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    77
		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: 251
diff changeset
    78
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    79
			$target = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    80
			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: 251
diff changeset
    81
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    82
		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: 251
diff changeset
    83
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    84
			$target = '';
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    85
			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: 251
diff changeset
    86
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    87
		else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    88
		{
264
802d76cf07f1 Fix: when comparing to zipped baseline the temporary file is not removed
Dario Sestito <darios@symbian.org>
parents: 263
diff changeset
    89
			$tmp_file = "tmp$$.txt";
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    90
			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: 251
diff changeset
    91
			$target = $tmp_file;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    92
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    93
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    94
	
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    95
	if (!$target)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    96
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    97
		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: 251
diff changeset
    98
		$compare = undef; 
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
    99
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   100
	else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   101
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   102
		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: 251
diff changeset
   103
		
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   104
		if (open(BASEINFO, $target))
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   105
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   106
			for my $line (<BASEINFO>)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   107
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   108
				if ($line =~ /([^\t]*)\t([^\t]*)/)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   109
				{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   110
					my $name = $1;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   111
					my $version = $2;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   112
					chomp $name;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   113
					chomp $version;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   114
					$baseline_environment_info->{$name}=$version;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   115
				}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   116
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   117
			close(BASEINFO);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   118
			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: 251
diff changeset
   119
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   120
		else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   121
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   122
			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: 251
diff changeset
   123
			$compare = undef;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   124
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   125
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   126
	
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   127
}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   128
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   129
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   130
my @environment_info = ();
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   131
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   132
# Machine name
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   133
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
   134
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   135
# OS Name and Version
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   136
my $os_name = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   137
my $os_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   138
my $os_out = `systeminfo`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   139
$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
   140
$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
   141
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
   142
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
   143
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   144
# Perl
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   145
my $perl_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   146
my $perl_out = `perl -v`;
283
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   147
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   148
# match: 
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   149
#match This is perl, v5.10.0 built for darwin-thread-multi-2level
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   150
if($perl_out =~ /This is perl, v(\S+)/m)
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   151
{
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   152
	$perl_ver = $1;
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   153
}
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   154
# match:
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   155
# This is perl 5, version 12, subversion 1 (v5.12.1) built for MSWin32-x64-multi-thread
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   156
elsif($perl_out =~ /This is perl.*? \(v(\S+)\)/m)
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   157
{
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   158
	$perl_ver = $1;
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   159
}
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   160
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   161
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
   162
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   163
# Python
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   164
my $python_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   165
my $python_out = `python -V 2>&1`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   166
$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
   167
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
   168
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   169
# Mercurial
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   170
my $hg_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   171
my $hg_out = `hg --version`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   172
$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
   173
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
   174
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   175
# 7-Zip
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   176
my $zip_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   177
my $zip_out = `7z`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   178
$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
   179
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
   180
262
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   181
# EPOCROOT
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   182
my $epocroot_ver = 'N.A.';
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   183
my $epocroot_out = `echo %EPOCROOT%`;
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   184
chomp $epocroot_out;
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   185
$epocroot_ver = $epocroot_out if ($epocroot_out ne '%EPOCROOT%');
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   186
push @environment_info, {name=>'EPOCROOT', version=>$epocroot_ver};
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   187
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   188
# Raptor
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   189
my $sbs_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   190
my $sbs_out = `sbs -v`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   191
$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
   192
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
   193
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   194
# Metrowerk Compiler
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   195
my $mwcc_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   196
my $mwcc_out = `mwccsym2 -version`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   197
$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
   198
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
   199
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   200
# RVCT 2.2
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   201
my $rvct22_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   202
my $rvct22_path = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   203
if (defined $ENV{'SBS_RVCT22BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   204
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   205
	$rvct22_path = $ENV{'SBS_RVCT22BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   206
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   207
elsif (defined $ENV{'RVCT22BIN'})
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
	$rvct22_path = $ENV{'RVCT22BIN'};
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
my $rvct22_cmd = 'armcc 2>&1';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   212
$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
   213
my $rvct22_out = `$rvct22_cmd`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   214
$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
   215
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
   216
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   217
# RVCT 4.0
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   218
my $rvct40_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   219
my $rvct40_path = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   220
if (defined $ENV{'SBS_RVCT40BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   221
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   222
	$rvct40_path = $ENV{'SBS_RVCT40BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   223
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   224
elsif (defined $ENV{'RVCT40BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   225
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   226
	$rvct40_path = $ENV{'RVCT40BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   227
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   228
my $rvct40_cmd = 'armcc 2>&1';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   229
$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
   230
my $rvct40_out = `$rvct40_cmd`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   231
$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
   232
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
   233
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   234
# GCCE 4.4.1
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   235
my $gcc441_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   236
my $gcc441_path = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   237
if (defined $ENV{'SBS_GCCE441BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   238
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   239
	$gcc441_path = $ENV{'SBS_GCCE441BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   240
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   241
elsif (defined $ENV{'GCCE441BIN'})
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   242
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   243
	$gcc441_path = $ENV{'GCCE441BIN'};
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   244
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   245
if ($gcc441_path)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   246
{
260
047e37a8f43f Allow better version reporting for gcc compiler
Dario Sestito <darios@symbian.org>
parents: 254
diff changeset
   247
	my $gcc441_cmd = "$gcc441_path\\arm-none-symbianelf-g++ --version";
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   248
	my $gcc441_out = `$gcc441_cmd`;
260
047e37a8f43f Allow better version reporting for gcc compiler
Dario Sestito <darios@symbian.org>
parents: 254
diff changeset
   249
	$gcc441_ver = $1 if ($gcc441_out =~ /arm-none-symbianelf-g\+\+\ (.*)/);
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   250
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   251
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
   252
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   253
# Helium
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   254
my $helium_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   255
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
   256
{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   257
	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
   258
	my $line = '';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   259
	while ($line = <VERSION>)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   260
	{
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   261
		$helium_ver = $1 if ($line =~ /^helium\.version=(.*)/);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   262
	}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   263
	close(VERSION);
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   264
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   265
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
   266
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   267
# java
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   268
my $java_ver = 'N.A.';
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   269
my $java_out = `java -version 2>&1`;
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   270
$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
   271
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
   272
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   273
# change tabs to spaces
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   274
for my $tool_info (@environment_info)
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   275
{
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   276
	$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: 251
diff changeset
   277
	$tool_info->{version} =~ s/\t/ /g;
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   278
}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   279
262
77dc8956ed66 Add EPOCROOT to the envinfo report
Dario Sestito <darios@symbian.org>
parents: 261
diff changeset
   280
print "\nEnvironment Information:\n";
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   281
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   282
my $cmp_notpresent = 0;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   283
my $cmp_diffver = 0;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   284
for my $tool_info (@environment_info)
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   285
{
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   286
	print " " . $tool_info->{name} . ": " . $tool_info->{version};
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   287
	
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   288
	if (defined $compare &&
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   289
		$tool_info->{name} ne 'Machine' &&
265
9195c2848015 EPOCROOT should not be compared against baseline
Dario Sestito <darios@symbian.org>
parents: 264
diff changeset
   290
		$tool_info->{name} ne 'OS Name' &&
9195c2848015 EPOCROOT should not be compared against baseline
Dario Sestito <darios@symbian.org>
parents: 264
diff changeset
   291
    $tool_info->{name} ne 'EPOCROOT')
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   292
	{
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   293
		print "\t";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   294
		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: 251
diff changeset
   295
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   296
			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: 251
diff changeset
   297
			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: 251
diff changeset
   298
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   299
				print "[ERROR: tool not present]";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   300
				$cmp_notpresent++;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   301
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   302
			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: 251
diff changeset
   303
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   304
				print "[OK]";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   305
			}
263
759aa5329d25 Fix: tools version comparison shows always less recent
Dario Sestito <darios@symbian.org>
parents: 262
diff changeset
   306
			elsif (($tool_info->{version} cmp $baselineversion) < 0)
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   307
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   308
				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: 251
diff changeset
   309
				$cmp_diffver++;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   310
			}
263
759aa5329d25 Fix: tools version comparison shows always less recent
Dario Sestito <darios@symbian.org>
parents: 262
diff changeset
   311
			elsif (($tool_info->{version} cmp $baselineversion) > 0)
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   312
			{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   313
				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: 251
diff changeset
   314
				$cmp_diffver++;
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   315
			}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   316
		}
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   317
	}
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   318
	print "\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   319
}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   320
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   321
print "\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   322
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   323
if (defined $compare)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   324
{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   325
	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: 251
diff changeset
   326
	if ($cmp_notpresent || $cmp_diffver)
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   327
	{
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   328
		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: 251
diff changeset
   329
		print " Tools at different version: $cmp_diffver\n";
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   330
	}
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   331
	else
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   332
	{
252
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   333
		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: 251
diff changeset
   334
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   335
	print "\n";
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   336
}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   337
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   338
# write report file
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   339
if (defined $report)
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   340
{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   341
	if (open(ENVINFO, ">$output"))
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   342
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   343
		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: 251
diff changeset
   344
		{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   345
			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: 251
diff changeset
   346
		}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   347
		close(ENVINFO);
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   348
		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: 251
diff changeset
   349
	}
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   350
	else
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   351
	{
f914b0494f03 Changed envinfo slightly to have comparison of tools version with a baseline
Dario Sestito <darios@symbian.org>
parents: 251
diff changeset
   352
		warn "WARNING: Could not write to file: $output\n";
251
becbd829b411 Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff changeset
   353
	}
283
46889a3f0a06 Bug 3643: Add another regular expression to match new perl version output.
Pat Downey <patd@symbian.org>
parents: 265
diff changeset
   354
}