bldsystemtools/commonbldutils/PC_P4Table.pm
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 # Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 # All rights reserved.
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Nokia Corporation - initial contribution.
       
    10 #
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # Script generates PC and Perforce table when called from
       
    15 # BuildLaunch.xml file.
       
    16 # 
       
    17 #
       
    18 
       
    19 #!/usr/bin/perl -w
       
    20 package PC_P4Table;
       
    21 use strict;
       
    22 use Time::Local;
       
    23 
       
    24 my $iBuildLaunchFileLocation;
       
    25 my $iLinkPathLocation = "http://IntWeb/bitr/review_release.php";
       
    26 my $iBuildLaunchFileFound    = "1";
       
    27 my $iClientSpecFileLocation = "";
       
    28 
       
    29 my @gProduct_Clientinfo = (
       
    30 			['7.0s','Symbian_OS_v7.0'],
       
    31 			['7.0e','Symbian_OS_v7.0_enhance'],
       
    32 			['7.0','Symbian_OS_v7.0'],
       
    33 			['8.0a','Symbian_OS_8.0'],
       
    34 			['8.1a','Symbian_OS_v8.1'],
       
    35 			['8.1b','Symbian_OS_v8.1'],
       
    36 			['9.1','master'],
       
    37 			['9.2','master'],
       
    38 			['9.3','master'],
       
    39 			['Future','master'],
       
    40 			['9.4','master'],
       
    41 			['9.5','master'],
       
    42 			['9.6','master'],
       
    43 			['tb92','master'],
       
    44                         ['tb101sf','master']
       
    45 		   );
       
    46 
       
    47 #####################################################################
       
    48 #Sub-Routine Name:getbuildloc
       
    49 #Inputs          :Product version
       
    50 #Outputs         :Returns log directory Location for product
       
    51 #Description     :
       
    52 #####################################################################
       
    53 sub getbuildloc
       
    54   {
       
    55   my $iProducts = shift;
       
    56   my $i = 0;
       
    57    
       
    58   while($i < $#gProduct_Clientinfo+1)
       
    59 	{
       
    60 	 if ($iProducts eq $gProduct_Clientinfo[$i][0])
       
    61 	    {
       
    62 	    return $gProduct_Clientinfo[$i][1];
       
    63 	    }	    
       
    64 	 $i++;
       
    65 	}
       
    66 	 
       
    67   return("Logs location not Found for product");
       
    68  } 
       
    69 		   
       
    70 		   
       
    71 # outline style sheet internally  
       
    72 my $gStyleSheet = " \n
       
    73 
       
    74                 <style type=\"text/css\">                    
       
    75                     h1,h2,h3
       
    76                     {
       
    77                         font-family: \"lucida calligraphy\", arial, 'sans serif'; 
       
    78                     }
       
    79 
       
    80                     p,table,li,
       
    81                     {
       
    82                         font-family: \"lucida calligraphy\", arial, 'sans serif'; 
       
    83                         margin-left: 8pt;
       
    84                     }
       
    85 
       
    86                     body
       
    87                     {
       
    88                         background-color:#fffaf0;
       
    89                     }
       
    90 
       
    91                     p,li,th,td
       
    92                     {
       
    93                         font-size: 10pt;
       
    94                         vertical-align:top;
       
    95                     }
       
    96 
       
    97                     h1,h2,h3,hr {color:#483d8b;}
       
    98 
       
    99                     table {border-style:outset}
       
   100                     li {list-style: square;}
       
   101 
       
   102                     a.hoverlink:link {color: #0000ff; text-decoration: none}
       
   103                     a.hoverlink:visited {color: #0000ff; text-decoration: none}
       
   104                     a.hoverlink:hover {text-decoration: underline}
       
   105                 </style>";
       
   106 
       
   107 
       
   108 ##########################################################################
       
   109 #
       
   110 # Name    :  setBrowserFriendlyLinks()
       
   111 # Synopsis:  Re-formats UNC path to file, with a Opera/Fire-Fox friendly
       
   112 #            version. Lotus Notes may cause problems though.
       
   113 # Inputs  :  UNC Path scalar
       
   114 # Outputs :  Scalar
       
   115 #
       
   116 ##########################################################################
       
   117 sub setBrowserFriendlyLinks {
       
   118     my ($iOldLink) = @_;
       
   119     
       
   120     $iOldLink =~ s/\\/\//g;  # swap backslashes to fwd slashes
       
   121     return "file:///".$iOldLink;
       
   122 }
       
   123 ##########################################################################
       
   124 #
       
   125 # Name	   : getBuildTime
       
   126 # Synopsis : Create a string containing the build timestamp
       
   127 # Inputs   : None
       
   128 # Outputs  : GMT timestamp
       
   129 ##########################################################################
       
   130 sub getBuildTime
       
   131 {
       
   132 	my $time = gmtime(time);	# Get current GMT time
       
   133 	$time .= " GMT";			# Append GMT marker
       
   134 	return $time;				# Return it
       
   135 }
       
   136 
       
   137 ##########################################################################
       
   138 #
       
   139 # Name    :  generateHTMLSummary()
       
   140 # Synopsis:  Creates an HTML report for the specified build.
       
   141 # Inputs  :  Scalar containing the build snapshot and product type
       
   142 # Outputs :  HTML report, published in current working dir
       
   143 ##########################################################################
       
   144 sub generateHTMLSummary {
       
   145     
       
   146     my ($iSnapshot, $iProduct,$iChangeList, $iClientSpec) = @_;
       
   147     my $iLogLocation = getbuildloc( $iProduct );
       
   148     $iClientSpec =~ s/\/\/cedar/\/cedar/g;
       
   149     my $iBuildLaunchFileLocation = "\\Builds01\\devbuilds\\$iLogLocation\\$iSnapshot\_Symbian_OS_v$iProduct\\logs\\BuildLaunch.xml";
       
   150 
       
   151     open (SUMMARY, "+> $iSnapshot"."_"."$iProduct"."PC_Perforce_report.html") or die "ERROR:Can't open file : $!";
       
   152        
       
   153     my $html_start = "\n
       
   154                     <HTML>
       
   155                     <HEAD>" .
       
   156                     $gStyleSheet .
       
   157                     "<TITLE>" . "$iSnapshot "."$iProduct ". "PC and Perforce Reference</TITLE>
       
   158                     <BODY BGCOLOR=\"FFFFFF\">
       
   159 
       
   160                     </HEAD>
       
   161                     <BODY>".
       
   162 		    
       
   163                     "<TABLE width=\"100%\" border =\"1\" cellpadding=\"0\" cellspacing=\"0\">" .
       
   164 		    " <tr bgcolor=\"#006699\" align=\"top\"><th colspan=\"2\"> <font color=\"#ffffff\">PC and Perforce Reference for $iProduct</font></th> </tr>".
       
   165 		    " <tr align=\"top\"><td colspan=\"2\">
       
   166 		    
       
   167 		    <font size=\"2\"><p>
       
   168                         [ <a class =\"hoverlink\" href = \"" . $iLinkPathLocation."\">  External Builds Info</a>  ]
       
   169                         "."\n </p>
       
   170                     </font>
       
   171 		    </td> </tr>".
       
   172 			"\n
       
   173 			<tr>
       
   174 			<th bgcolor=\"#006699\" align =\"left\" width=\"300\"> <font color=\"#ffffff\">BuildMachineName</font></th>" .
       
   175 			"<td align = \"left\">".`hostname`."" ."</td>".
       
   176 		        "</tr>\n".
       
   177 			"\n
       
   178 			<tr>
       
   179 			<th bgcolor=\"#006699\" align =\"left\"> <font color=\"#ffffff\">ClientSpec</font></th>" .
       
   180 			"<td align = \"left\">$iClientSpec </td>
       
   181                         ".
       
   182 		        "</tr>\n".
       
   183 			"\n
       
   184 			<tr>
       
   185 			<th bgcolor=\"#006699\" align =\"left\"> <font color=\"#ffffff\">Perforce Changelist</font></th>" .
       
   186 			"<td align = \"left\">$iChangeList </td>" .
       
   187 		        "</tr>\n".
       
   188 			"\n
       
   189 			<tr>
       
   190 			<th bgcolor=\"#006699\" align =\"left\"> <font color=\"#ffffff\">Build Start Time</font></th>" .
       
   191 			"<td align = \"left\">".getBuildTime()."" ."</td>".
       
   192 		        "</tr>\n".
       
   193 		    "</table>
       
   194                       </BODY>
       
   195                       </html>
       
   196                       ";
       
   197                       
       
   198                       
       
   199     print SUMMARY $html_start;
       
   200     
       
   201     close SUMMARY;
       
   202 }