build_package.pl
changeset 29 b9212509f335
parent 28 bf45384632b0
child 31 7d05cbb136ad
equal deleted inserted replaced
28:bf45384632b0 29:b9212509f335
    29 my $sFbfProjectRepo = '';
    29 my $sFbfProjectRepo = '';
    30 my $sFbfProjectDir = '';
    30 my $sFbfProjectDir = '';
    31 my $sFbfConfigRepo="\\\\bishare\\mercurial_internal\\fbf\\configs\\pkgbuild";
    31 my $sFbfConfigRepo="\\\\bishare\\mercurial_internal\\fbf\\configs\\pkgbuild";
    32 my $sFbfConfigDir = '';
    32 my $sFbfConfigDir = '';
    33 my $nCmdLineNumber;
    33 my $nCmdLineNumber;
    34 my $bTestBuild = 0;
    34 my $bProduction = 0;
    35 my $bPublish = 1;
    35 my $bPublish = 1;
    36 GetOptions((
    36 GetOptions((
    37 	'configrepo:s' => \$sFbfConfigRepo,
    37 	'configrepo:s' => \$sFbfConfigRepo,
    38 	'configdir:s' => \$sFbfConfigDir,
    38 	'configdir:s' => \$sFbfConfigDir,
    39 	'projectrepo:s' => \$sFbfProjectRepo,
    39 	'projectrepo:s' => \$sFbfProjectRepo,
    40 	'projectdir:s' => \$sFbfProjectDir,
    40 	'projectdir:s' => \$sFbfProjectDir,
    41 	'number:s' => \$nCmdLineNumber,
    41 	'number:s' => \$nCmdLineNumber,
    42 	'testbuild!' => \$bTestBuild,
    42 	'production!' => \$bProduction,
    43 	'publish!' => \$bPublish
    43 	'publish!' => \$bPublish
    44 ));
    44 ));
    45 
    45 
    46 if (!$sFbfProjectRepo and !$sFbfProjectDir)
    46 if (!$sFbfProjectRepo and !$sFbfProjectDir)
    47 {
    47 {
    50 	print "\t--projectrepo=REPO[#REV] Use repository REPO at revision REV for the project.\n";
    50 	print "\t--projectrepo=REPO[#REV] Use repository REPO at revision REV for the project.\n";
    51 	print "\t--projectdir=DIR Use DIR location for the project (exclusive with --projectrepo). Option --nopublish is required.\n";
    51 	print "\t--projectdir=DIR Use DIR location for the project (exclusive with --projectrepo). Option --nopublish is required.\n";
    52 	print "\t--configrepo=REPO[#REV] Use repository REPO at revision REV for the config (instead of \\\\bishare\\mercurial_internal\\fbf\\config\\pkgbuild)\n";
    52 	print "\t--configrepo=REPO[#REV] Use repository REPO at revision REV for the config (instead of \\\\bishare\\mercurial_internal\\fbf\\config\\pkgbuild)\n";
    53 	print "\t--configdir=DIR Use DIR location for the config (exclusive with --configrepo). Option --nopublish is required.\n";
    53 	print "\t--configdir=DIR Use DIR location for the config (exclusive with --configrepo). Option --nopublish is required.\n";
    54 	print "\t--number=N Force build number to N\n";
    54 	print "\t--number=N Force build number to N\n";
    55 	print "\t--testbuild Set category to package.test and use Tnnn numbering\n";
    55 	print "\t--production Tag this build as 'production' (default: 'test') and use nnn numbering (default: Tnnn)\n";
    56 	print "\t--nopublish Use d:\\numbers_test.txt for numbers and disable publishing\n";
    56 	print "\t--nopublish Use d:\\numbers_test.txt for numbers and disable publishing\n";
    57 	exit(0);
    57 	exit(0);
    58 }
    58 }
    59 
    59 
    60 if ($sFbfProjectDir and $bPublish)
    60 if ($sFbfProjectDir and $bPublish)
    81 	$sFbfConfigRepo = $1;
    81 	$sFbfConfigRepo = $1;
    82 	$sFbfConfigRev = $2;
    82 	$sFbfConfigRev = $2;
    83 }
    83 }
    84 
    84 
    85 my $sTestBuildOpt = "";
    85 my $sTestBuildOpt = "";
    86 $sTestBuildOpt = "-Dsf.spec.publish.diamonds.category=package.test" if ( $bTestBuild );
    86 $sTestBuildOpt = "-Dsf.spec.publish.diamonds.tag=production" if ( $bProduction );
    87 my $sNoPublishOpt = "";
    87 my $sNoPublishOpt = "";
    88 $sNoPublishOpt = "-Dsf.spec.publish.enable=false" if ( !$bPublish );
    88 $sNoPublishOpt = "-Dsf.spec.publish.enable=false" if ( !$bPublish );
    89 $sNUMBERS_FILE = "d:\\numbers_test.txt" if ( !$bPublish );
    89 $sNUMBERS_FILE = "d:\\numbers_test.txt" if ( !$bPublish );
    90 
    90 
    91 my $sLabelBaseString = $sFbfProjectRepo;
    91 my $sLabelBaseString = $sFbfProjectRepo;
   124 }
   124 }
   125 elsif ($sFbfProjectRepo)
   125 elsif ($sFbfProjectRepo)
   126 {
   126 {
   127 	my $sRevZeroHash = get_rev_zero_hash($sFbfProjectRepo);
   127 	my $sRevZeroHash = get_rev_zero_hash($sFbfProjectRepo);
   128 	my $sJobNumberKey = $sRevZeroHash;
   128 	my $sJobNumberKey = $sRevZeroHash;
   129 	$sJobNumberKey .= ".T" if ($bTestBuild);
   129 	$sJobNumberKey .= ".T" if (!$bProduction);
   130 	$nUnformattedNumber = get_job_number($sJobNumberKey);
   130 	$nUnformattedNumber = get_job_number($sJobNumberKey);
   131 }
   131 }
   132 my $nJobNumber = sprintf("%.3d", $nUnformattedNumber);
   132 my $nJobNumber = sprintf("%.3d", $nUnformattedNumber);
   133 $nJobNumber = "T$nJobNumber" if ($bTestBuild);
   133 $nJobNumber = "T$nJobNumber" if (!$bProduction);
   134 
   134 
   135 # check that $sLETTERS_FILE exists, otherwise create it
   135 # check that $sLETTERS_FILE exists, otherwise create it
   136 if (!-f $sLETTERS_FILE)
   136 if (!-f $sLETTERS_FILE)
   137 {
   137 {
   138 	open FILE, ">$sLETTERS_FILE";
   138 	open FILE, ">$sLETTERS_FILE";