common/tools/envinfo2diamonds.pl
changeset 1158 739036c00f80
parent 1059 41e4f69f652f
child 1161 3a17ff141d92
equal deleted inserted replaced
1157:06290277aa33 1158:739036c00f80
    16 
    16 
    17 use Getopt::Long;
    17 use Getopt::Long;
    18 
    18 
    19 my $input = "\\output\\logs\\envinfo.txt";
    19 my $input = "\\output\\logs\\envinfo.txt";
    20 my $output = "\\output\\logs\\diamonds_envinfo.xml";
    20 my $output = "\\output\\logs\\diamonds_envinfo.xml";
       
    21 my $bit_output = "\\output\\logs\\bitinfo.txt";
    21 my $help = 0;
    22 my $help = 0;
    22 GetOptions((
    23 GetOptions((
    23 	'in=s' => \$input,
    24 	'in=s' => \$input,
    24 	'out=s' => \$output,
    25 	'out=s' => \$output,
    25 	'help!' => \$help
    26 	'help!' => \$help
    68 my $tools_lines = '';
    69 my $tools_lines = '';
    69 for my $tool_info (@environment_info)
    70 for my $tool_info (@environment_info)
    70 {
    71 {
    71 	$tools_lines .= "   <tool><name>$tool_info->{name}</name><version>$tool_info->{version}</version></tool>\n";
    72 	$tools_lines .= "   <tool><name>$tool_info->{name}</name><version>$tool_info->{version}</version></tool>\n";
    72 }
    73 }
       
    74 my $bit_tools_lines = '';
       
    75 for my $bit_tool_info (@environment_info)
       
    76 {
       
    77 	$bit_tools_lines .= "envinfo\t$tool_info->{name},$tool_info->{version}\n";
       
    78 } 
    73 
    79 
    74 $xml_content =~ s/_HERE_TOOLS_LINES_/$tools_lines/;
    80 $xml_content =~ s/_HERE_TOOLS_LINES_/$tools_lines/;
    75 
    81 
    76 if (open(ENVINFO, ">$output"))
    82 if (open(ENVINFO, ">$output"))
    77 {
    83 {
    81 }
    87 }
    82 else
    88 else
    83 {
    89 {
    84 	warn "Could not write to file: $output\n";
    90 	warn "Could not write to file: $output\n";
    85 }
    91 }
       
    92 
       
    93 if (open(BITINFO, ">>$bit_output"))
       
    94 {
       
    95 	print BITINFO $bit_tools_lines;
       
    96 	close(BITINFO);
       
    97 }