author | Dario Sestito <darios@symbian.org> |
Thu, 03 Jun 2010 14:05:16 +0100 | |
changeset 274 | becbd829b411 |
child 275 | f914b0494f03 |
permissions | -rw-r--r-- |
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: |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
14 |
# Dumps environment info such as tools version to cmdline or optionally to a Diamonds file |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
15 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
16 |
use strict; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
17 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
18 |
use Getopt::Long; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
19 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
20 |
my $output = "\\output\\logs\\diamonds_envinfo.xml"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
21 |
my $diamonds = 0; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
22 |
my $help = 0; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
23 |
GetOptions(( |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
24 |
'diamonds!' => \$diamonds, |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
25 |
'out=s' => \$output, |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
26 |
'help!' => \$help |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
27 |
)); |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
28 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
29 |
if ($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 |
print "Dumps environment info such as tools version to cmdline or optionally to a Diamonds file\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
32 |
print "Usage: perl envinfo.pl [-d [-o XMLFILE]]\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
33 |
print "\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
34 |
print "-d,--diamonds\tcreate Diamonds file with environment info\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
35 |
print "-o,--out XMLFILE Diamonds file to write to (default \\output\\logs\\diamonds_envinfo.xml)\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
36 |
exit(0); |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
37 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
38 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
39 |
my @environment_info = (); |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
40 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
41 |
# Machine name |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
42 |
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
|
43 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
44 |
# OS Name and Version |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
45 |
my $os_name = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
46 |
my $os_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
47 |
my $os_out = `systeminfo`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
48 |
$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
|
49 |
$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
|
50 |
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
|
51 |
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
|
52 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
53 |
# Perl |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
54 |
my $perl_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
55 |
my $perl_out = `perl -v`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
56 |
$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
|
57 |
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
|
58 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
59 |
# Python |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
60 |
my $python_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
61 |
my $python_out = `python -V 2>&1`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
62 |
$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
|
63 |
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
|
64 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
65 |
# Mercurial |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
66 |
my $hg_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
67 |
my $hg_out = `hg --version`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
68 |
$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
|
69 |
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
|
70 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
71 |
# 7-Zip |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
72 |
my $zip_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
73 |
my $zip_out = `7z`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
74 |
$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
|
75 |
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
|
76 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
77 |
# Raptor |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
78 |
my $sbs_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
79 |
my $sbs_out = `sbs -v`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
80 |
$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
|
81 |
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
|
82 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
83 |
# Metrowerk Compiler |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
84 |
my $mwcc_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
85 |
my $mwcc_out = `mwccsym2 -version`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
86 |
$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
|
87 |
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
|
88 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
89 |
# RVCT 2.2 |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
90 |
my $rvct22_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
91 |
my $rvct22_path = ''; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
92 |
if (defined $ENV{'SBS_RVCT22BIN'}) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
93 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
94 |
$rvct22_path = $ENV{'SBS_RVCT22BIN'}; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
95 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
96 |
elsif (defined $ENV{'RVCT22BIN'}) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
97 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
98 |
$rvct22_path = $ENV{'RVCT22BIN'}; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
99 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
100 |
my $rvct22_cmd = 'armcc 2>&1'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
101 |
$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
|
102 |
my $rvct22_out = `$rvct22_cmd`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
103 |
$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
|
104 |
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
|
105 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
106 |
# RVCT 4.0 |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
107 |
my $rvct40_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
108 |
my $rvct40_path = ''; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
109 |
if (defined $ENV{'SBS_RVCT40BIN'}) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
110 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
111 |
$rvct40_path = $ENV{'SBS_RVCT40BIN'}; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
112 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
113 |
elsif (defined $ENV{'RVCT40BIN'}) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
114 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
115 |
$rvct40_path = $ENV{'RVCT40BIN'}; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
116 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
117 |
my $rvct40_cmd = 'armcc 2>&1'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
118 |
$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
|
119 |
my $rvct40_out = `$rvct40_cmd`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
120 |
$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
|
121 |
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
|
122 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
123 |
# GCCE 4.4.1 |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
124 |
my $gcc441_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
125 |
my $gcc441_path = ''; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
126 |
if (defined $ENV{'SBS_GCCE441BIN'}) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
127 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
128 |
$gcc441_path = $ENV{'SBS_GCCE441BIN'}; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
129 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
130 |
elsif (defined $ENV{'GCCE441BIN'}) |
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 |
$gcc441_path = $ENV{'GCCE441BIN'}; |
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 |
if ($gcc441_path) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
135 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
136 |
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
|
137 |
my $gcc441_out = `$gcc441_cmd`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
138 |
$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
|
139 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
140 |
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
|
141 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
142 |
# Helium |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
143 |
my $helium_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
144 |
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
|
145 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
146 |
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
|
147 |
my $line = ''; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
148 |
while ($line = <VERSION>) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
149 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
150 |
$helium_ver = $1 if ($line =~ /^helium\.version=(.*)/); |
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 |
close(VERSION); |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
153 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
154 |
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
|
155 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
156 |
# java |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
157 |
my $java_ver = 'N.A.'; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
158 |
my $java_out = `java -version 2>&1`; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
159 |
$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
|
160 |
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
|
161 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
162 |
for my $tool_info (@environment_info) |
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 |
print $tool_info->{name} . ": " . $tool_info->{version} . "\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
165 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
166 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
167 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
168 |
# write diamonds file |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
169 |
if ($diamonds) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
170 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
171 |
@environment_info = reverse(@environment_info); |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
172 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
173 |
my $xml_content = <<_EOX; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
174 |
<?xml version=\"1.0\" encoding=\"UTF-8\"?> |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
175 |
<diamonds-build> |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
176 |
<schema>10</schema> |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
177 |
<tools> |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
178 |
_HERE_TOOLS_LINES_ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
179 |
</tools> |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
180 |
</diamonds-build> |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
181 |
_EOX |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
182 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
183 |
my $tools_lines = ''; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
184 |
for my $tool_info (@environment_info) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
185 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
186 |
$tools_lines .= " <tool><name>$tool_info->{name}</name><version>$tool_info->{version}</version></tool>\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
187 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
188 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
189 |
$xml_content =~ s/_HERE_TOOLS_LINES_/$tools_lines/; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
190 |
|
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
191 |
if (open(ENVINFO, ">$output")) |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
192 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
193 |
print ENVINFO $xml_content; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
194 |
close(ENVINFO); |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
195 |
print "Wrote Diamonds file: $output\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
196 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
197 |
else |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
198 |
{ |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
199 |
warn "Could not write to file: $output\n"; |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
200 |
} |
becbd829b411
Add envinfo.pl tool to dump environment info
Dario Sestito <darios@symbian.org>
parents:
diff
changeset
|
201 |
} |