toolsandutils/productionbldtools/package.pl
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 #!perl
       
     2 
       
     3 # package.pl
       
     4 
       
     5 # Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     6 # All rights reserved.
       
     7 # This component and the accompanying materials are made available
       
     8 # under the terms of "Eclipse Public License v1.0"
       
     9 # which accompanies this distribution, and is available
       
    10 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    11 #
       
    12 # Initial Contributors:
       
    13 # Nokia Corporation - initial contribution.
       
    14 #
       
    15 # Contributors:
       
    16 #
       
    17 # Description:
       
    18 # Version Info:
       
    19 # Version 001: initial version
       
    20 # Version 002: Typhoon: InstallCustKit.pl added for CustKit 
       
    21 # Version 003: Typhoon: calls GenerateLicenseeBuild.exe before building
       
    22 # Version 004: Typhoon: auto-generates packages before building; 
       
    23 # produces differences between this report & previous build's
       
    24 # calls script to produce CustKit as ZIPs
       
    25 # Version 005: Typhoon: calls docplugintool script 
       
    26 # Version 006: Typhoon: Master Codeline
       
    27 # Version 007: Master Codeline
       
    28 # Version 007: Master Codeline - beech/cedar split & DocPlugInTool removed
       
    29 # Version 008: Master Codeline - custkit.txt generation removed
       
    30 # 
       
    31 #
       
    32 
       
    33 
       
    34 
       
    35 use Cwd;
       
    36 use File::Basename;
       
    37 use File::Path;
       
    38 
       
    39 use FindBin;                # where does this script live?
       
    40 use lib $FindBin::Bin;      # use this directory for libraries, to find...
       
    41 use KitStandardLocations;
       
    42 
       
    43 my $PlatformProductToolsDir = $FindBin::Bin;
       
    44 $PlatformProductToolsDir =~ s/common/$Platform/i;    # change "common" to platform name in path to tools directory
       
    45 unshift (@INC, $PlatformProductToolsDir);            # add this to the @INC list of library paths
       
    46 require KitPlatformSpecific;                         # and read the platform-specific definitions
       
    47 require AllKitsRebaseline;
       
    48 require BuildKit;
       
    49 require TestKit;
       
    50 require MakeCustKitZips;
       
    51 
       
    52 # ------------------------------ Global variables ----------------------------
       
    53 
       
    54 my $Company = "Symbian";
       
    55 
       
    56 
       
    57 my $BuildNumber = $ARGV[0];
       
    58 $Kit_ID = $BuildNumber;
       
    59 
       
    60 my $pkgSrcDefDevKitDir = "$DevKitPath\\$SrcDefDir";
       
    61 my $pkgSrcDefCustKitDir ="$CustKitPath\\$SrcDefDir";
       
    62 
       
    63 my $outputCustKitZipsDir =  "$ProductPath\\_PACKAGES\\CustKit_Zips";
       
    64 my $outputInternalZipsDir = "$ProductPath\\generated";
       
    65 
       
    66 
       
    67 my $KitBuilderSrcDir =    "$SourceDir\\common\\generic\\tools\\CustKits\\KitBuilder";
       
    68 my $KitBuilderBldDir =    "$OutputDir\\techview\\epoc32\\tools\\CustKits\\KitBuilder";
       
    69 my $NavigationPagesDir =  "$SourceDir\\common\\generic\\tools\\CustKits\\NavigationPages";
       
    70 
       
    71 
       
    72 my $sourceListDevKit =  "DevKit.srcdef";
       
    73 my $sourceListCustKit = "CustKit.srcdef";
       
    74 
       
    75 
       
    76 my $buildPkg =     "$OutputDir\\generic\\epoc32\\tools\\buildpkg";
       
    77 my $createPkgSrc = "$OutputDir\\generic\\epoc32\\tools\\createpkgsrc";
       
    78 my $diff =         "$OutputDir\\generic\\epoc32\\gcc\\bin\\diff";
       
    79 
       
    80 my $scriptFile =     "InstallCustKit.pl";
       
    81 my $scriptFileZips = "InstallCustKitZIPs.pl";
       
    82 my $scriptHelpFile = "ReadMe_First.txt";
       
    83 
       
    84 
       
    85 
       
    86 # ----------------- Start of main() ------------------------
       
    87 
       
    88 open STDERR, ">&STDOUT" ;
       
    89 select STDOUT; $| = 1;
       
    90 select STDERR; $| = 1;
       
    91 
       
    92 my $time=localtime;
       
    93 print "===  Build process for Kit $Kit_ID started at $time\n";
       
    94 
       
    95 
       
    96 # get the drive we're running on - use for various parameters later on
       
    97 my $initialDir = cwd();
       
    98 $initialDir =~ m/^(\w:)/ ;
       
    99 my $initialDrive = $1;
       
   100 
       
   101 
       
   102 my $CommonProductToolsDir = $FindBin::Bin;
       
   103 $CommonProductToolsDir =~ s|/|\\|g;
       
   104 $PlatformProductToolsDir =~ s|/|\\|g;
       
   105 
       
   106 
       
   107 # Generate a list of available files
       
   108 print "** generate .lis files\n";
       
   109 my $logsPath = "$ProductPath\\generated\\logs";		# ensure we can create log files
       
   110 (mkpath $logsPath or print "WARNING:  Couldn't create directory for logs\n") if (! -d $logsPath);
       
   111 chdir("$OutputDir\\generic");
       
   112 system("perl $CommonProductToolsDir\\bfrc\\listdir.pl --files epoc32 > $logsPath\\GT.lis");
       
   113 chdir("$OutputDir\\techview");
       
   114 system("perl $CommonProductToolsDir\\bfrc\\listdir.pl --files epoc32 > $logsPath\\TechView.lis");
       
   115 
       
   116 
       
   117 
       
   118 # run tools to produce up-to-date packages and compare to previous build's package definitions
       
   119 print "** RebaselineAndCompare()\n";
       
   120 RebaselineAndCompare();
       
   121 
       
   122 
       
   123 
       
   124 # generate the licencee list of restricted files
       
   125 print "** LicenceeRestrictionsList\n";
       
   126 LicenceeRestrictionsList();
       
   127 
       
   128 
       
   129 
       
   130 # build the packages into Kits
       
   131 print "** BuildKits()\n";
       
   132 BuildKit::BuildKit();
       
   133 
       
   134 
       
   135 
       
   136 # produce CustKit as a set of ZIPs, with script and HTML navigation pages
       
   137 # print "** CustKit as ZIPs\n";
       
   138 # CustKitAsZips();
       
   139 
       
   140 
       
   141 
       
   142 # produce kit report and difference between this report & previous build's
       
   143 TestKit::TestKit();
       
   144 system ("$diff --text --speed-large-files $ENV{'PublishLocation'}\\$ENV{'Type'}\\$ENV{'Previousbuildnumber'}\\logs\\KitReport.txt $ENV{'LogsDir'}\\KitReport.txt > $ENV{'LogsDir'}\\KitReportDiffs.txt");
       
   145 
       
   146 
       
   147 
       
   148 $time=localtime;
       
   149 print "===  Build process for Kit $Kit_ID ended at $time\n";
       
   150 
       
   151 
       
   152 
       
   153 
       
   154 
       
   155 # ----------------- Start of LicenceeRestrictionsList() ------------------------
       
   156 sub LicenceeRestrictionsList()
       
   157 {
       
   158 	my $PackageDefs_copy = "\\PackageDefinitions_copy";
       
   159 	mkdir $KitBuilderBldDir."\\".$PackageDefs_copy, 0777 ;
       
   160 	system("xcopy  $pkgDefDevKitDir  $KitBuilderBldDir$PackageDefs_copy /E /Z /I /Q"); 
       
   161 	system("del $KitBuilderBldDir\\$PackageDefs_copy /F /Q");
       
   162 }
       
   163 
       
   164 
       
   165 
       
   166 # ----------------- Start of RebaselineAndCompare() ------------------------
       
   167 sub RebaselineAndCompare()
       
   168 {
       
   169 	chdir($CommonProductToolsDir) or die "Unable to change to $CommonProductToolsDir\n";
       
   170 	AllKitsRebaseline::AllKitsRebaseline("$ProductPath\\generated");
       
   171 
       
   172 }
       
   173 
       
   174 
       
   175 # ----------------- Start of CustKitAsZips() ------------------------
       
   176 sub CustKitAsZips()
       
   177 {
       
   178 	chdir($PlatformProductToolsDir) or die "Unable to change to $PlatformProductToolsDir\n";
       
   179 	MakeCustKitZIPs::MakeCustKitZIPs ($pkgDefCustKitDir, $pkgDefDevKitDir, $outputCustKitZipsDir, "$ProductPath\\generated", $outputInternalZipsDir);
       
   180 	system("copy ".$PlatformProductToolsDir."\\".$scriptFileZips." ".$outputCustKitZipsDir);
       
   181 	system("xcopy ".$NavigationPagesDir." ".$outputCustKitZipsDir." /S /I /Q") ;
       
   182 	system("del ".$outputCustKitZipsDir."\\distribution.policy /F /Q") ;
       
   183 }