common/tools/summary/brag_script.pl
changeset 375 63fdf0583f67
parent 366 cde2244c8ea6
child 377 065183c4417b
equal deleted inserted replaced
366:cde2244c8ea6 375:63fdf0583f67
     6 #
     6 #
     7 # Initial Contributors:
     7 # Initial Contributors:
     8 # Symbian Foundation Ltd - initial contribution.
     8 # Symbian Foundation Ltd - initial contribution.
     9 #
     9 #
    10 # Contributors:
    10 # Contributors:
    11 #
    11 # Arnaud Lenoir
       
    12 # Dario Sestito
    12 # Description:
    13 # Description:
    13 # Generate build summary with BRAG status
    14 # Generate build summary with BRAG status
    14 
    15 
    15 use Getopt::Long;
    16 use Getopt::Long;
    16 
    17 use strict;
       
    18 
       
    19 # Data used for the script
    17 my $buildid = '';
    20 my $buildid = '';
    18 my $basedir = '';
    21 my $basedir = '';
    19 my $help = 0;
    22 my $help = 0;
    20 GetOptions((
    23 GetOptions((
    21 	'buildid=s' => \$buildid,
    24 	'buildid=s' => \$buildid,
    22 	'basedir=s' => \$basedir,
    25 	'basedir=s' => \$basedir,
    23 	'help!' => \$help
    26 	'help!' => \$help
    24 ));
    27 ));
    25 
    28 
       
    29 #---------------------------------------------------------------------------------------
       
    30 # Files locations
       
    31 
       
    32 # Command to build a package build
       
    33 # F:\Dev\mercurial_local\bootstrap>perl build_package.pl --subproj=3k/mw/serviceapi
       
    34 
       
    35 #brag_script.pl location
       
    36 #F:\Dev\mercurial_local\pkgbuild\common\tools\summary
       
    37 # my package log files directory is: F:\fbf_job\serviceapi_3k.T014\output\logs
       
    38 # my platform log files directory is: F:\Dev\fbf_job\platform_MCL.PDK-101\output\logs
       
    39 
       
    40 # F:\fbf_job\serviceapi_3k.T014\output\logs
       
    41 # console_bootstrap_d+.txt	empty file
       
    42 # console_sfbuildall_d+.txt	empty file
       
    43 # serviceapi_3k.T014_ant_env.log
       
    44 
       
    45 # F:\fbf_project\serviceapi\sf-config
       
    46 # console_sfbuildall_32428.txt
       
    47 # console_sfprep_32428.txt
       
    48 # console_sfsummary_32428.txt
       
    49 
       
    50 # F:\Dev\fbf_job\platform_MCL.PDK-101\output\logs
       
    51 # platform_MCL.PDK-101_ant_env.log
       
    52 # in _ant_env.log
       
    53 # Do a search for env.ANT_CMD_LINE_ARGS to find out the type of build done as armv5, winscw, ...
       
    54 
       
    55 #---------------------------------------------------------------------------------------
       
    56 
       
    57 
       
    58 # If no parameters entered or help selected, display help
    26 $help = 1 if (!$buildid or !$basedir);
    59 $help = 1 if (!$buildid or !$basedir);
    27 
    60 
    28 if ($help)
    61 if ($help)
    29 {
    62 {
    30 	print "Generate build summary with BRAG status\n";
    63 	print "Generate build summary with BRAG status\n";
    31 	print "Usage: perl brag_script.pl --buildid=ID --basedir=DIR\n";
    64 	print "Usage: perl brag_script.pl --buildid=ID --basedir=DIR\n";
       
    65 	print "Typical command line from script location: <perl brag_script.pl --buildid=serviceapi_3k.T014 --basedir=F:\\fbf_job>\n";
    32 	exit(0);
    66 	exit(0);
    33 }
    67 }
    34 
    68 # End section related to help
       
    69 
       
    70 # Determine build number
    35 $buildid =~ /^([^_]*)_([^.]*)\./;
    71 $buildid =~ /^([^_]*)_([^.]*)\./;
    36 my $project = $1;
    72 my $project = $1;
    37 my $codeline = $2;
    73 my $codeline = $2;
    38 
    74 
       
    75 # Define variable logdir
    39 my $logdir = "$basedir\\$buildid\\output\\logs";
    76 my $logdir = "$basedir\\$buildid\\output\\logs";
    40 
    77 
       
    78 # General data information
       
    79 print "\$builid = $buildid\n";
       
    80 print "\$basedir = $basedir\n";
       
    81 print "\$logdir = $logdir\n";
       
    82 print "\$project = $project\n";
       
    83 print "\$codeline = $codeline\n";
       
    84 
       
    85 open(BUILDSUMMARYHTML, ">$logdir\\build_summary.html");	# !!!!! First time we are accessing the file build_summary.html, therefore create it or replace it, AFTR THAT WE NEED TO APPEND IT ONLY!!!!!
       
    86 
       
    87 print BUILDSUMMARYHTML "#********** build_summary.html **********#<br/><br/><br/>";
       
    88 
       
    89 close(BUILDSUMMARYHTML); # Close file build_summary.html
       
    90 
       
    91 # *****************************************************************************
       
    92 # Construction "GENERAL STATUS" page in build_summary.html
       
    93 # *****************************************************************************
       
    94 
       
    95 # Fill html file with buildir data
       
    96 open(BUILDSUMMARYHTML, ">>$logdir\\build_summary.html"); # Open build_summary.html in APPEND MODE!
       
    97 
       
    98 print BUILDSUMMARYHTML "<br/>#************************************************#<br/><br/>";
       
    99 print BUILDSUMMARYHTML "<br/>#********** GENERAL STATUS starts here **********#<br/><br/>";
       
   100 print BUILDSUMMARYHTML "buildid_val=$buildid<br/>";
       
   101 print BUILDSUMMARYHTML "basedir_val=$basedir<br/>";
       
   102 print BUILDSUMMARYHTML "logdir_val=$logdir<br/>";
       
   103 print BUILDSUMMARYHTML "project_val=$project<br/>";
       
   104 print BUILDSUMMARYHTML "codeline_val=$codeline<br/>";
       
   105 
       
   106 # Calculate the number of files in the directory
    41 opendir(DIR, $logdir);
   107 opendir(DIR, $logdir);
    42 my @dir_content = readdir(DIR);
   108 my @dir_content = readdir(DIR);
    43 close(DIR);
   109 close(DIR);
    44 #my @asSimilarDirs = grep(/^$sBaseName(\.|$)/, @asDirs);
   110 my $nbfilesinlogdir = scalar(@dir_content);
    45 
   111 print BUILDSUMMARYHTML "nbfilesinlogdir_val=$nbfilesinlogdir<br/>";
    46 my $nfiles = scalar(@dir_content);
   112 
    47 
   113 # Define what we tried to build (target, winscw, armv5, TOOLS2, platform, package, ...)
    48 
   114 # Information in the file buildid_ant_env.log that can be found in the log directory
    49 open(FILE, ">$logdir\\build_summary.html");
   115 
    50 print FILE "<html><body>build summary<br/>build id: $buildid<br/>log files: $nfiles</body></html>";
   116 # F:\Dev\fbf_job\platform_MCL.PDK-101\output\logs
    51 close(FILE);
   117 # platform_MCL.PDK-101_ant_env.log
    52 
   118 # in _ant_env.log
       
   119 # Do a search for env.ANT_CMD_LINE_ARGS to find out the type of build done as armv5, winscw, ...
       
   120 
       
   121 # Declare any variable that will need to be used globaly otherwise can't be used only between the curly brackets!
       
   122 my $antenvlog = "";
       
   123 
       
   124 #print "$logdir\\$buildid\_ant\_env\.log\n"; # Test to find out that _ and . need backslash up front to work
       
   125 my $antenvlogfile = "$logdir\\$buildid\_ant\_env\.log";
       
   126 print "$antenvlogfile\n";
       
   127 open (ANTENVLOG, "<$antenvlogfile");
       
   128 {
       
   129 	local $/=undef; # Technic used to get a file in one unique string accessible via a variable
       
   130 	$antenvlog = <ANTENVLOG>;	
       
   131 }
       
   132 close(ANTENVLOG); # Close file $buildid_ant_env.log
       
   133 
       
   134 # List of data to extract from the file $buildid_ant_env.log
       
   135 #Fri Aug 14 17:04:54 BST 2009 on the second line of the file
       
   136 #base_release.getenv_options=-I tools
       
   137 #bom.log=\\\\v800008\\Builds01\\SF_builds\\platform\\builds\\MCL\\platform_MCL.PDK-101/logs/platform_MCL.PDK-101_bom.xml
       
   138 #build.family=platform or package		->DONE!!
       
   139 #build.id=platform_MCL.PDK-101			->1st thing done in this script!!
       
   140 #build.name=platform or serviceapi		->DONE!!
       
   141 #build.number=PDK-101					->DONE!!
       
   142 #build.version=MCL.PDK-101				->DONE!!
       
   143 #core.build.version=MCL					->DONE!!
       
   144 #diamonds.host=v800002.ad-sfpd.intra	->DONE!!
       
   145 #env.ANT_CMD_LINE_ARGS=-Dhelium.dir "C\:\\Symbian\\Tools\\PDT_1.0\\helium" sf-build -Dbuild.drive m\: -Dsf.spec.job.codeline MCL -Dsf.spec.job.number PDK-101 -Dsf.project.location f\:\\\\Dev\\maintools\\build\\config\\foundation -Dsf.spec.job.rootdir f\:\\\\Dev\\fbf_job -Dsf.spec.sbs.config winscw_udeb.whatlog -Dsf.spec.test.sendpkg.enable false
       
   146 #env.COMPUTERNAME=UK-ARNAUDL			->DONE!!
       
   147 #env.USERNAME=arnaudl					->DONE!!
       
   148 #publish.dir=\\\\v800008\\Builds01\\SF_builds\\platform\\builds\\MCL\\platform_MCL.PDK-101		->DONE!!
       
   149 #sf.spec.sbs.config=winscw				->DONE!!
       
   150 #sbs.config=armv5						->DONE!!
       
   151 #sf.spec.baseline.enable=true			->DONE!!
       
   152 #sf.spec.baseline.getenv_options=-I tools
       
   153 #sf.spec.bccheck.baseline.s60.version=5.1	->DONE!!
       
   154 #sf.spec.bccheck.enable=false			->DONE!!
       
   155 #sf.spec.build.target=all				->DONE!!
       
   156 #sf.spec.build.testcode.enable=false	->DONE!!
       
   157 #sf.spec.job.codeline=MCL				->Information already available under another name
       
   158 #sf.spec.job.number=PDK-101				->Information already available under another name
       
   159 #sf.spec.sourcesync.enable=true			->DONE!!
       
   160 #sf.spec.test.epocroot=D\:\\ATS3\\winscw_smoketest
       
   161 #sf.spec.test.host.name=v800005			->DONE!!
       
   162 #sf.spec.toolsbaseline.getenv_options=-i emu
       
   163 #user.country=GB						->Any use????
       
   164 
       
   165 
       
   166 # Data extraction
       
   167 # Type of Line to read is: "env.COMPUTERNAME=UK-ARNAUDL" with a end of line \\n character
       
   168 
       
   169 # env.COMPUTERNAME=UK-ARNAUDL
       
   170 if ($antenvlog =~ /env\.COMPUTERNAME=([^=]*)\n/)
       
   171 {
       
   172 	print "Computer name is: $1\n";
       
   173 	print BUILDSUMMARYHTML "computername_val=$1<br/>";
       
   174 }
       
   175 else
       
   176 {
       
   177 	print "Computer name is unknown\n";
       
   178 	print BUILDSUMMARYHTML "computername_val=?<br/>";
       
   179 }
       
   180 
       
   181 #env.USERNAME=arnaudl
       
   182 if ($antenvlog =~ /env\.USERNAME=([^=]*)\n/)
       
   183 {
       
   184 	print "User name is: $1\n";
       
   185 	print BUILDSUMMARYHTML "username_val=$1<br/>";
       
   186 }
       
   187 else
       
   188 {
       
   189 	print "user name is unknown\n";
       
   190 	print BUILDSUMMARYHTML "username_val=?<br/>";
       
   191 }
       
   192 
       
   193 #build.family=platform or package
       
   194 if ($antenvlog =~ /build\.family=([^=]*)\n/)
       
   195 {
       
   196 	print "Build family is: $1\n";
       
   197 	print BUILDSUMMARYHTML "buildfamily_val=$1<br/>";
       
   198 }
       
   199 else
       
   200 {
       
   201 	print "Build family is unknow\n";
       
   202 	print BUILDSUMMARYHTML "buildfamily_val=?<br/>";
       
   203 }
       
   204 
       
   205 #build.name=platform or serviceapi
       
   206 if ($antenvlog =~ /build\.name=([^=]*)\n/)
       
   207 {
       
   208 	print "Build name is: $1\n";
       
   209 	print BUILDSUMMARYHTML "buildname_val=$1<br/>";
       
   210 }
       
   211 else
       
   212 {
       
   213 	print "Build name is unknow\n";
       
   214 	print BUILDSUMMARYHTML "buildname_val=?<br/>";
       
   215 }
       
   216 
       
   217 #diamonds.host=v800002.ad-sfpd.intra - Define the server used
       
   218 if ($antenvlog =~ /diamonds\.host=([^=]*)\n/)
       
   219 {
       
   220 	print "Build server used is: $1\n";
       
   221 	print BUILDSUMMARYHTML "buildserver_val=$1<br/>";
       
   222 }
       
   223 else
       
   224 {
       
   225 	print "Build server used is unknown\n";
       
   226 	print BUILDSUMMARYHTML "buildserver_val=?<br/>";
       
   227 }
       
   228 
       
   229 #build.version=MCL.PDK-101
       
   230 if ($antenvlog =~ /build\.version=([^=]*)\n/)
       
   231 {
       
   232 	print "Build version is: $1\n";
       
   233 	print BUILDSUMMARYHTML "buildversion_val=$1<br/>";
       
   234 }
       
   235 else
       
   236 {
       
   237 	print "Build version is unknown\n";
       
   238 	print BUILDSUMMARYHTML "buildversion_val=?<br/>";
       
   239 }
       
   240 
       
   241 #build.number=PDK-101
       
   242 if ($antenvlog =~ /build\.number=([^=]*)\n/)
       
   243 {
       
   244 	print "Build number is: $1\n";
       
   245 	print BUILDSUMMARYHTML "buildnumber_val=$1<br/>";
       
   246 }
       
   247 else
       
   248 {
       
   249 	print "Build number is unknown\n";
       
   250 	print BUILDSUMMARYHTML "buildnumber_val=?<br/>";
       
   251 }
       
   252 
       
   253 #core.build.version=MCL
       
   254 if ($antenvlog =~ /core\.build\.version=([^=]*)\n/)
       
   255 {
       
   256 	print "Core build version is: $1\n";
       
   257 	print BUILDSUMMARYHTML "corebuildversion_val=$1<br/>";
       
   258 }
       
   259 else
       
   260 {
       
   261 	print "Core build version is unknown\n";
       
   262 	print BUILDSUMMARYHTML "corebuildversion_val=?<br/>";
       
   263 }
       
   264 
       
   265 #publish.dir=\\\\v800008\\Builds01\\SF_builds\\platform\\builds\\MCL\\platform_MCL.PDK-101
       
   266 if ($antenvlog =~ /publish\.dir=([^=]*)\n/)
       
   267 {
       
   268 	print "Publish directory is: $1\n";
       
   269 	print BUILDSUMMARYHTML "publishdir_val=$1<br/>";
       
   270 }
       
   271 else
       
   272 {
       
   273 	print "Publish directory is unknown\n";
       
   274 	print BUILDSUMMARYHTML "publishdir_val=?<br/>";
       
   275 }
       
   276 
       
   277 #sf.spec.baseline.enable=true
       
   278 if ($antenvlog =~ /sf\.spec\.baseline\.enable=([^=]*)\n/)
       
   279 {
       
   280 	print "Baseline retrieval enabled?:: $1\n";
       
   281 	print BUILDSUMMARYHTML "baselineretrievalen_val=$1<br/>";
       
   282 }
       
   283 else
       
   284 {	
       
   285 	print "Baseline retrieval status is unknown\n";
       
   286 	print BUILDSUMMARYHTML "baselineretrievalen_val=?<br/>";
       
   287 }
       
   288 
       
   289 #sf.spec.sourcesync.enable=true
       
   290 if ($antenvlog =~ /sf\.spec\.sourcesync\.enable=([^=]*)\n/)
       
   291 {
       
   292 	print "Source code sync enabled?: $1\n";
       
   293 	print BUILDSUMMARYHTML "sourcecodesyncen_val=$1<br/>";
       
   294 }
       
   295 else
       
   296 {	
       
   297 	print "Source code sync status is unknown\n";
       
   298 	print BUILDSUMMARYHTML "sourcecodesyncen_val=?<br/>";
       
   299 }
       
   300 
       
   301 #sf.spec.build.testcode.enable=false
       
   302 # Smoke tests????? SALT tests????
       
   303 if ($antenvlog =~ /sf\.spec\.build\.testcode\.enable=([^=]*)\n/)
       
   304 {
       
   305 	print "Tests execution enabled?: $1\n";
       
   306 	print BUILDSUMMARYHTML "testexecutionen_val=$1<br/>";
       
   307 }
       
   308 else
       
   309 {	
       
   310 	print "Tests execution status is unknown\n";
       
   311 	print BUILDSUMMARYHTML "testexecutionen_val=?<br/>";
       
   312 }
       
   313 
       
   314 #sf.spec.test.host.name=v800005
       
   315 if ($antenvlog =~ /sf\.spec\.test\.host\.name=([^=]*)\n/)
       
   316 {
       
   317 	print "Tests host server is: $1\n";
       
   318 	print BUILDSUMMARYHTML "testhostserver_val=$1<br/>";
       
   319 }
       
   320 else
       
   321 {	
       
   322 	print "Tests host server is unknown\n";
       
   323 	print BUILDSUMMARYHTML "testhostserver_val=?<br/>";
       
   324 }
       
   325 
       
   326 #sf.spec.bccheck.enable=false
       
   327 if ($antenvlog =~ /sf\.spec\.bccheck\.enable=([^=]*)\n/)
       
   328 {
       
   329 	print "BCC check enabled?: $1\n";
       
   330 	print BUILDSUMMARYHTML "bccchecken_val=$1<br/>";
       
   331 }
       
   332 else
       
   333 {	
       
   334 	print "BCC check status is unknown\n";
       
   335 	print BUILDSUMMARYHTML "bccchecken_val=?<br/>";
       
   336 }
       
   337 
       
   338 #sf.spec.bccheck.baseline.s60.version=5.1
       
   339 if ($antenvlog =~ /sf\.spec\.bccheck\.baseline\.s60\.version=([^=]*)\n/)
       
   340 {
       
   341 	print "BCC check S60 baseline version used is: $1\n";
       
   342 	print BUILDSUMMARYHTML "bccchecks60baselinever_val=$1<br/>";
       
   343 }
       
   344 else
       
   345 {	
       
   346 	print "BCC check S60 baseline version used is unknown\n";
       
   347 	print BUILDSUMMARYHTML "bccchecks60baselinever_val=?<br/>";
       
   348 }
       
   349 
       
   350 
       
   351 #sbs.config=armv5 possible values are armv5 (default) and winscw
       
   352 if ($antenvlog =~ /sbs\.config=([^=]*)\n/)
       
   353 {
       
   354 	print "SBS config is: $1\n";
       
   355 	print BUILDSUMMARYHTML "sbsconfig_val=$1<br/>";
       
   356 }
       
   357 else
       
   358 {	
       
   359 	print "SBS config is unknown\n";
       
   360 	print BUILDSUMMARYHTML "sbsconfig_val=?<br/>";
       
   361 }
       
   362 
       
   363 #sf.spec.sbs.config=winscw
       
   364 if ($antenvlog =~ /sf\.spec\.sbs\.config=([^=]*)\n/)
       
   365 {
       
   366 	print "Specific SBS config is: $1\n";
       
   367 	print BUILDSUMMARYHTML "specsbsconfig_val=$1<br/>";
       
   368 }
       
   369 else
       
   370 {	
       
   371 	print "Specific SBS config is unknown\n";
       
   372 	print BUILDSUMMARYHTML "specsbsconfig_val=?<br/>";
       
   373 }
       
   374 
       
   375 #sf.spec.build.target=all
       
   376 if ($antenvlog =~ /sf\.spec\.build\.target=([^=]*)\n/)
       
   377 {
       
   378 	print "specific build target is: $1\n";
       
   379 	print BUILDSUMMARYHTML "specificbuildtarget_val=$1<br/>";
       
   380 }
       
   381 else
       
   382 {	
       
   383 	print "specific build target is: unknown\n";
       
   384 	print BUILDSUMMARYHTML "specificbuildtarget_val=?<br/>";
       
   385 }
       
   386 
       
   387 # Extract data to define the type build done
       
   388 # Find out what is expected to be done and what has been actually done.
       
   389 # name="WINS" abldTarget="wins" description="MSVC Compiler"
       
   390 # name="WINS_REL" abldTarget="wins urel" description="MSVC Compiler"
       
   391 # name="WINS_DEB" abldTarget="wins udeb" description="MSVC Compiler"
       
   392 # name="WINSCW" abldTarget="winscw" description="CodeWarrior Compiler"
       
   393 # name="WINSCW_REL" abldTarget="winscw urel" description="CodeWarrior Compiler"
       
   394 # name="WINSCW_DEB" abldTarget="winscw udeb" description="CodeWarrior Compiler"
       
   395 # name="TOOLS" abldTarget="tools" description="MSVC Compiler for Tools"
       
   396 # name="TOOLS_REL" abldTarget="tools rel" description="MSVC Compiler for Tools Release mode only"
       
   397 # name="TOOLS2" abldTarget="tools2" description="MinGW GCC Compiler for Tools"
       
   398 # name="TOOLS2_REL" abldTarget="tools2 rel" description="MinGW GCC Compiler for Tools Release mode only"
       
   399 # name="ARMV5" abldTarget="armv5" description="RVCT Compiler"
       
   400 # name="ARMV5_REL" abldTarget="armv5 urel" description="RVCT Compiler"
       
   401 # name="ARMV5_DEB" abldTarget="armv5 udeb" description="RVCT Compiler"
       
   402 
       
   403 
       
   404 #-------------
       
   405 # End data extraction from the file $buildid_ant_env.log
       
   406 #-------------
       
   407 
       
   408 print BUILDSUMMARYHTML "<br/>#********** GENERAL STATUS ends here **********#<br/><br/>";
       
   409 
       
   410 close(BUILDSUMMARYHTML); # Close file build_summary.html
       
   411 
       
   412 # *****************************************************************************
       
   413 # Construction "SUMMARISE" page in build_summary.html
       
   414 # *****************************************************************************
       
   415 
       
   416 # Build info - Describe the completion of the diffrent steps in the build process
       
   417 
       
   418 # Fill html file with buildir data
       
   419 open(BUILDSUMMARYHTML, ">>$logdir\\build_summary.html"); # Open build_summary.html in APPEND MODE!
       
   420 
       
   421 # Indicates beginning of the SUMMARISE section in the file
       
   422 print BUILDSUMMARYHTML "<br/>#*******************************************#<br/><br/>";
       
   423 print BUILDSUMMARYHTML "<br/>#********** SUMMARISE starts here **********#<br/><br/>";
       
   424 
       
   425 #{ # Used for local $/=undef
       
   426 #local $/=undef; # indicates that the file will be put in one variable as one string
       
   427 #
       
   428 ## Find the string "BUILD SUCCESSFUL" in the file console_bootstrap_\d+\.txt
       
   429 ## 1st open file
       
   430 #open (CONSOLEBOOTSTRAP, "<$logdir\\console_bootstrap_\d+\.txt");
       
   431 #
       
   432 #my $searchconsolebootstrap= <CONSOLEBOOTSTRAP>; # Copy the full file in one string because of /$=undef
       
   433 #
       
   434 #if ($searchconsolebootstrap =~ /BUILD SUCCESSFUL/){
       
   435 #	print "Found string BUILD SUCCESSFUL\n";	
       
   436 #	print BUILDSUMMARYHTML "BuildSuccessful_val=Yes<br/>";
       
   437 #	}
       
   438 #	else {
       
   439 #		print "Can't Find string BUILD SUCCESSFUL\n";
       
   440 #		print BUILDSUMMARYHTML "BuildSuccessful_val=No<br/>";
       
   441 #		}
       
   442 #
       
   443 #close (CONSOLEBOOTSTRAP); # Close file console_bootstrap_\d+\.txt
       
   444 ## End - Find the string "BUILD SUCCESSFUL" in the file console_bootstrap_\d+\.txt
       
   445 #
       
   446 ## Check all the intermediate steps of the build process
       
   447 ## 1st open file console_sfbuildall_\d+\.txt
       
   448 #open (CONSOLESFBUILDALL, "<$logdir\\console_sfbuildall_\d+\.txt");
       
   449 #
       
   450 #my $searchconsolesfbuildall= <CONSOLESFBUILDALL>; # Copy the full file in one string because of /$=undef
       
   451 #
       
   452 #if ($searchconsolesfbuildall =~ /x/){
       
   453 #	print "Found string x\n";	
       
   454 #	print BUILDSUMMARYHTML "x=Yes<br/>";
       
   455 #	}
       
   456 #	else {
       
   457 #		print "Can't Find string x\n";
       
   458 #		print BUILDSUMMARYHTML "x=No<br/>";
       
   459 #		}
       
   460 #
       
   461 #close (CONSOLESFBUILDALL); # Close file console_sfbuildall_\d+\.txt
       
   462 #} # End use for local $/=undef
       
   463 
       
   464 # Declare any variable that will need to be used globaly otherwise can't be used only between the curly brackets!
       
   465 my $targettimeslog = "";
       
   466 
       
   467 { # Used for local $/=undef
       
   468 local $/=undef; # indicates that the file will be put in one variable as one string
       
   469 
       
   470 # The file targetTimesLog.csv contains all the information relative to the build process including time needed for each steps (generated by helium script)
       
   471 # This file is available whatever the build we want to do (platform or package)
       
   472 my $targettimeslogfile = "$logdir\\targetTimesLog\.csv";
       
   473 print "$targettimeslogfile\n";
       
   474 open (TARGETTIMESLOG, "<$targettimeslogfile");
       
   475 {
       
   476 	local $/=undef; # Technic used to get a file in one unique string accessible via a variable
       
   477 	$targettimeslog = <TARGETTIMESLOG>;
       
   478 }
       
   479 close (TARGETTIMESLOG); # Close file targetTimesLog.csv
       
   480 } # End use for local $/=undef
       
   481 
       
   482 # Extract useful data from the file targettimeslog.csv
       
   483 # step, time in second to do the operation
       
   484 
       
   485 # For sure
       
   486 #"^preparation-getenv:$" - the baseline retrieval starts
       
   487 #preparation-getenv,1417
       
   488 if ($targettimeslog =~ /(preparation-getenv[^,]*),(\d+[^,]*)\n/)
       
   489 {
       
   490 	print "Baseline retrieval started: OK \$1= $1, \$2= $2\n";
       
   491 	print BUILDSUMMARYHTML "baselineretrievalstarted_val=yes<br/>baselineretrievalstarted_duration=$2<br/>";
       
   492 }
       
   493 else
       
   494 {	
       
   495 	print "Baseline retrieval started: NOK \$1= $1, \$2= $2\n";
       
   496 	print BUILDSUMMARYHTML "baselineretrievalstarted_val=no<br/>baselineretrievalstarted_duration=?<br/>";
       
   497 }
       
   498 
       
   499 #"^\s+[exec] .+: done fetching environment$" - the baseline retrieval ends
       
   500 #????
       
   501 
       
   502 #"^sf-prebuild-0:$" - the source code sync starts
       
   503 #sf-prebuild-0,363
       
   504 if ($targettimeslog =~ /(sf-prebuild[^,]*),(\d+[^,]*)\n/)
       
   505 {
       
   506 	print "Source code sync started: OK \$1= $1, \$2= $2\n";
       
   507 	print BUILDSUMMARYHTML "sourcecodestarted_val=yes<br/>sourcecodestarted_duration=$2<br/>";
       
   508 }
       
   509 else
       
   510 {	
       
   511 	print "Source code sync started: NOK \$1= $1, \$2= $2\n";
       
   512 	print BUILDSUMMARYHTML "sourcecodestarted_val=no<br/>sourcecodestarted_duration=?<br/>";
       
   513 }
       
   514 
       
   515 #"^sf-unpack-rnd:$" - source code sync ends
       
   516 #sf-unpack-rnd,20
       
   517 if ($targettimeslog =~ /(sf-unpack[^,]*),(\d+[^,]*)\n/)
       
   518 {
       
   519 	print "Source code sync ended: OK \$1= $1, \$2= $2\n";
       
   520 	print BUILDSUMMARYHTML "sourcecodeended_val=yes<br/>sourcecodeended_duration=$2<br/>";
       
   521 }
       
   522 else
       
   523 {	
       
   524 	print "Source code sync ended: NOK \$1= $1, \$2= $2\n";
       
   525 	print BUILDSUMMARYHTML "sourcecodeended_val=no<br/>sourcecodeended_duration=?<br/>";
       
   526 }
       
   527 
       
   528 #"^sf-compile:$" - compilation starts
       
   529 #sf-compile,3
       
   530 if ($targettimeslog =~ /(sf-compile[^,]*),(\d+[^,]*)\n/)
       
   531 {
       
   532 	print "Compilation startd: OK \$1= $1, \$2= $2\n";
       
   533 	print BUILDSUMMARYHTML "commpilationstarted_val=yes<br/>commpilationstarted_duration=$2<br/>";
       
   534 }
       
   535 else
       
   536 {	
       
   537 	print "Compilation startd: NOK \$1= $1, \$2= $2\n";
       
   538 	print BUILDSUMMARYHTML "commpilationstarted_val=no<br/>commpilationstarted_duration=?<br/>";
       
   539 }
       
   540 
       
   541 #"^sf-postbuild:$" - compilation ends
       
   542 #sf-postbuild,0
       
   543 if ($targettimeslog =~ /(sf-postbuild[^,]*),(\d+[^,]*)\n/)
       
   544 {
       
   545 	print "Compilation ended: OK \$1= $1, \$2= $2\n";
       
   546 	print BUILDSUMMARYHTML "compilationended_val=yes<br/>compilationended_duration=$2<br/>";
       
   547 }
       
   548 else
       
   549 {	
       
   550 	print "Compilation ended: NOK \$1= $1, \$2= $2\n";
       
   551 	print BUILDSUMMARYHTML "compilationended_val=no<br/>compilationended_duration=?<br/>";
       
   552 }
       
   553 
       
   554 #"^sf-run-analysis:$" - analysis starts
       
   555 #sf-run-analysis-raptor,1
       
   556 if ($targettimeslog =~ /(sf-run-analysis-raptor[^,]*),(\d+[^,]*)\n/)
       
   557 {
       
   558 	print "Analysis started: OK \$1= $1, \$2= $2\n";
       
   559 	print BUILDSUMMARYHTML "analysisstarted_val=yes<br/>analysisstarted_duration=$2<br/>";
       
   560 }
       
   561 else
       
   562 {	
       
   563 	print "Analysis started: NOK \$1= $1, \$2= $2\n";
       
   564 	print BUILDSUMMARYHTML "analysisstarted_val=no<br/>analysisstarted_duration=?<br/>";
       
   565 }
       
   566 
       
   567 # Maybe????????
       
   568 
       
   569 #"^sf-zip-logs:$" - analysis ends
       
   570 #sf-zip-content,8
       
   571 #?????
       
   572 
       
   573 
       
   574 #"^publish:$" - publication starts
       
   575 #????
       
   576 
       
   577 #"\[copy\] Copying \d+ files to \\\\v800008\\Builds01\\SF_builds\\" - publication ends
       
   578 #????
       
   579 
       
   580 #BRAG
       
   581 #sf-summary,5
       
   582 #?????
       
   583 
       
   584 # End - Check all the intermediate steps of the build process
       
   585 
       
   586 
       
   587 # Indicates end of the SUMMARISE section in the file
       
   588 print BUILDSUMMARYHTML "<br/>#********** SUMMARISE ends here **********#<br/><br/>";
       
   589 
       
   590 close(BUILDSUMMARYHTML); # Close build_summary.html
       
   591 
       
   592 
       
   593 # End - Build info - Describe the completion of the diffrent steps in the build process
       
   594 
       
   595 
       
   596 # *****************************************************************************
       
   597 # Construction "DATA BREAKDOWN" page in build_summary.html
       
   598 # *****************************************************************************
       
   599 
       
   600 # Hyperlink to log files
       
   601 open(BUILDSUMMARYHTML, ">>$logdir\\build_summary.html"); # Open build_summary.html in APPEND MODE!
       
   602 
       
   603 # Indicates beginning of DATA BREAKDOWN section in the file
       
   604 print BUILDSUMMARYHTML "<br/>#************************************************#<br/><br/>";
       
   605 print BUILDSUMMARYHTML "<br/>#********** DATA BREAKDOWN starts here **********#<br/><br/>";
       
   606 
       
   607 
       
   608 # Get tree for the directory where the log files are (bishare probably the best place???)
       
   609 # Should be already exported there, but maybe in a zip file)
       
   610 # Extract each file with directory, then create a hyperlink to that file to make sure that user can click on the link and open the file!
       
   611 
       
   612 
       
   613 #ex: platform_MCL.PDK-101_summary.log.xml
       
   614 #######print FILE "buildid_summary.log.xml=<a class ="hoverlink" href ="file://///$logdir/$buildid_summary.log.xml">$buildid_summary.log.xml<br>";                        
       
   615 
       
   616 # example of html hyperlink
       
   617 #<a class ="hoverlink" href ="file://///builds01/devbuilds/MasterSF/logs/MSF00159_Symbian_OS_vtb92sf/MSF00159_Symbian_OS_vtb92sf.summary.html#AdvisoryNotesByComponent_Scan for S60 distribution policy files">Scan for S60 distribution policy files (1162) <br></a></td>                        
       
   618 #<a class ="hoverlink" href ="file://///builds01/devbuilds/MasterSF/MSF00159_Symbian_OS_vtb92sf/logs/GT.summary.html#errorsByComponent_SBS: Error">SBS: Error (4) <br></a></td>
       
   619 #<a class ="hoverlink" href ="file://///builds01/devbuilds/MasterSF/MSF00159_Symbian_OS_vtb92sf/logs/MSF00159_Symbian_OS_vtb92sf_cbr.summary.html#AdvisoryNotesByOverall_Total">Total (1) <br></a></td>
       
   620 #<a class ="hoverlink" href="file://///builds01/devbuilds/MasterSF/logs/MSF00159_Symbian_OS_vtb92sf/AutoSmokeTest/EMULATOR/WINSCW/Test Summary Report.htm">WINSCW ( EMULATOR ) </a></td><td>
       
   621 
       
   622 # All log files hyperlink have been created, close build_summary.html
       
   623 
       
   624 
       
   625 # Indicates end of DATA BREAKDOWN section in the file
       
   626 print BUILDSUMMARYHTML "<br/>#********** DATA BREAKDOWN ends here **********#<br/><br/>";
       
   627 print BUILDSUMMARYHTML "<br/>#********** summary_build.html ends here ******#<br/><br/>";
       
   628 
       
   629 close(BUILDSUMMARYHTML); # Close file build_summary.html
       
   630 
       
   631 
       
   632 
       
   633 # *****************************************************************************
       
   634 # Final step, copy build_summary.html to \\bishare drive
       
   635 # *****************************************************************************
       
   636 
       
   637 # Copy html file to bishare
    53 my $copy_cmd = "copy $logdir\\build_summary.html \\\\bishare\\sf_builds\\$project\\builds\\$codeline\\$buildid";
   638 my $copy_cmd = "copy $logdir\\build_summary.html \\\\bishare\\sf_builds\\$project\\builds\\$codeline\\$buildid";
    54 print "Exec: $copy_cmd\n";
   639 print "Exec: $copy_cmd\n";
    55 system($copy_cmd);
   640 system($copy_cmd);
    56 
   641 
    57 
   642