build_package.pl
changeset 52 511dcb217499
parent 51 5db037fb1000
child 53 ae4992ce7268
equal deleted inserted replaced
51:5db037fb1000 52:511dcb217499
    32 #my $sSourcesFile = '';
    32 #my $sSourcesFile = '';
    33 #my $sModelFile = '';
    33 #my $sModelFile = '';
    34 my $sFbfConfigRepo="\\\\bishare\\mercurial_development\\oss\\FCL\\interim\\fbf\\configs\\default";
    34 my $sFbfConfigRepo="\\\\bishare\\mercurial_development\\oss\\FCL\\interim\\fbf\\configs\\default";
    35 my $sFbfConfigDir = '';
    35 my $sFbfConfigDir = '';
    36 my $nCmdLineNumber;
    36 my $nCmdLineNumber;
    37 my $bProduction = 0;
       
    38 my $sDiamondsTag = '';
    37 my $sDiamondsTag = '';
    39 my $bHudson = 0;
    38 my $bHudson = 0;
    40 my $bPublish = 1;
    39 my $bPublish = 1;
    41 my %hHlmDefines = ();
    40 my %hHlmDefines = ();
    42 my $bHelp = 0;
    41 my $bHelp = 0;
    47 	'projectdir=s' => \$sFbfProjectDir,
    46 	'projectdir=s' => \$sFbfProjectDir,
    48 	'subproj=s' => \$sSubProject,
    47 	'subproj=s' => \$sSubProject,
    49 	#'sources=s' => \$sSourcesFile,
    48 	#'sources=s' => \$sSourcesFile,
    50 	#'model=s' => \$sModelFile,
    49 	#'model=s' => \$sModelFile,
    51 	'number=s' => \$nCmdLineNumber,
    50 	'number=s' => \$nCmdLineNumber,
    52 	'production!' => \$bProduction,
       
    53 	'tag=s' => \$sDiamondsTag,
    51 	'tag=s' => \$sDiamondsTag,
    54 	'hudson!' => \$bHudson,
    52 	'hudson!' => \$bHudson,
    55 	'publish!' => \$bPublish,
    53 	'publish!' => \$bPublish,
    56 	'define=s' => \%hHlmDefines,
    54 	'define=s' => \%hHlmDefines,
    57 	'help!' => \$bHelp
    55 	'help!' => \$bHelp
    68 	#print "\t--sources=FILE ...\n";
    66 	#print "\t--sources=FILE ...\n";
    69 	#print "\t--model=FILE ...\n";
    67 	#print "\t--model=FILE ...\n";
    70 	print "\t--configrepo=REPO[#REV] Use repository REPO at revision REV for the config (instead of \\\\bishare\\mercurial_internal\\fbf\\config\\default)\n";
    68 	print "\t--configrepo=REPO[#REV] Use repository REPO at revision REV for the config (instead of \\\\bishare\\mercurial_internal\\fbf\\config\\default)\n";
    71 	print "\t--configdir=DIR Use DIR location for the config (exclusive with --configrepo).\n";
    69 	print "\t--configdir=DIR Use DIR location for the config (exclusive with --configrepo).\n";
    72 	print "\t--number=N Force build number to N\n";
    70 	print "\t--number=N Force build number to N\n";
    73 	print "\t--production Tag this build as 'production' (default: 'test') and use nnn numbering (default: Tnnn)\n";
    71 	print "\t--tag=TAG Apply Diamonds tag TAG to this build\n";
    74 	print "\t--tag=TAG Apply Diamonds tag TAG to this build (exclusive with --production)\n";
       
    75 	print "\t--hudson Checks that there is at least NUMBER_OF_PROCESSORS X 10 GB available on the working drive\n";
    72 	print "\t--hudson Checks that there is at least NUMBER_OF_PROCESSORS X 10 GB available on the working drive\n";
    76 	print "\t--nopublish Use \\numbers_test.txt for numbers and disable publishing\n";
    73 	print "\t--nopublish Use \\numbers_test.txt for numbers and disable publishing\n";
    77 	print "\t--define ATTRIBUTE=VALUE Pass -D statements to the Helium Framework\n";
    74 	print "\t--define ATTRIBUTE=VALUE Pass -D statements to the Helium Framework\n";
    78 	exit(0);
    75 	exit(0);
    79 }
    76 }
    80 
    77 
    81 if ($sSubProject and $sSubProject !~ m,^([^/]+)/[^/]+/([^/]+)$,)
    78 if ($sSubProject and $sSubProject !~ m,^([^/]+)/[^/]+/([^/]+)$,)
    82 {
    79 {
    83 	print "ERROR: Option --subproj must be in the format codeline/layer/package (e.g. MCL/os/boardsupport)\n";
    80 	print "ERROR: Option --subproj must be in the format codeline/layer/package (e.g. MCL/os/boardsupport)\n";
    84 	exit(0);
       
    85 }
       
    86 
       
    87 if ($bProduction and $sDiamondsTag)
       
    88 {
       
    89 	print "ERROR: Options --production and --tag are mutually exclusive.\n";
       
    90 	exit(0);
    81 	exit(0);
    91 }
    82 }
    92 
    83 
    93 #if (!$sFbfProjectRepo and !$sFbfProjectDir and (!$sSourcesFile or !$sModelFile))
    84 #if (!$sFbfProjectRepo and !$sFbfProjectDir and (!$sSourcesFile or !$sModelFile))
    94 #{
    85 #{
   132 {
   123 {
   133 	$sHlmDefineOpt .= "-D$_=$hHlmDefines{$_} ";
   124 	$sHlmDefineOpt .= "-D$_=$hHlmDefines{$_} ";
   134 }
   125 }
   135 
   126 
   136 my $sTestBuildOpt = "";
   127 my $sTestBuildOpt = "";
   137 $sTestBuildOpt = "-Dsf.spec.publish.diamonds.tag=production" if ( $bProduction );
       
   138 $sTestBuildOpt = "-Dsf.spec.publish.diamonds.tag=$sDiamondsTag" if ( $sDiamondsTag );
   128 $sTestBuildOpt = "-Dsf.spec.publish.diamonds.tag=$sDiamondsTag" if ( $sDiamondsTag );
   139 my $sNoPublishOpt = "";
   129 my $sNoPublishOpt = "";
   140 $sNoPublishOpt = "-Dsf.spec.publish.enable=false" if ( !$bPublish );
   130 $sNoPublishOpt = "-Dsf.spec.publish.enable=false" if ( !$bPublish );
   141 $sNUMBERS_FILE = "$sWORKING_DRIVE\\numbers_test.txt" if ( !$bPublish );
   131 $sNUMBERS_FILE = "$sWORKING_DRIVE\\numbers_test.txt" if ( !$bPublish );
   142 
   132 
   210 	{
   200 	{
   211 		# key = hash of the rev.0 of the package project repo
   201 		# key = hash of the rev.0 of the package project repo
   212 		my $sRevZeroHash = get_rev_zero_hash($sFbfProjectRepo);
   202 		my $sRevZeroHash = get_rev_zero_hash($sFbfProjectRepo);
   213 		$sJobNumberKey = $sRevZeroHash;
   203 		$sJobNumberKey = $sRevZeroHash;
   214 	}
   204 	}
   215 	$sJobNumberKey .= ".T" if (!$bProduction);
       
   216 	$nUnformattedNumber = get_job_number($sJobNumberKey);
   205 	$nUnformattedNumber = get_job_number($sJobNumberKey);
   217 }
   206 }
   218 my $nJobNumber = sprintf("%.3d", $nUnformattedNumber);
   207 my $nJobNumber = sprintf("%.3d", $nUnformattedNumber);
   219 $nJobNumber = "T$nJobNumber" if (!$bProduction);
       
   220 print "For build key $sJobNumberKey got assigned number \"$nJobNumber\"\n";
   208 print "For build key $sJobNumberKey got assigned number \"$nJobNumber\"\n";
   221 
   209 
   222 # check that $sLETTERS_FILE exists, otherwise create it
   210 # check that $sLETTERS_FILE exists, otherwise create it
   223 if (!-f "$sWORKING_DRIVE\\$sLETTERS_FILE")
   211 if (!-f "$sWORKING_DRIVE\\$sLETTERS_FILE")
   224 {
   212 {