build_package.pl
changeset 16 e1b9f78cef38
parent 15 45ed0efeb8a4
child 17 d75feffe620f
equal deleted inserted replaced
15:45ed0efeb8a4 16:e1b9f78cef38
    16 use strict;
    16 use strict;
    17 
    17 
    18 use Getopt::Long;
    18 use Getopt::Long;
    19 use File::Path;
    19 use File::Path;
    20 
    20 
    21 my $sBOOTSTRAP_DIR="D:\\Helium\\hlm-apps\\bootstrap";
    21 my $sBOOTSTRAP_DIR="C:\\Apps\\FBF\\bootstrap";
    22 my $sJOB_BASE_DIR="D:\\fbf_project";
    22 my $sJOB_BASE_DIR="D:\\fbf_project";
    23 my $sCONFIG_REPO="\\\\lon-engbuild87\\d\$\\mercurial_development\\oss\\FCL\\interim\\fbf\\configs\\pkgbuild";
       
    24 my $nMAX_JOBDIR_AGE_SECONDS = 86400; # max number of seconds after which the letter is forcibly released
    23 my $nMAX_JOBDIR_AGE_SECONDS = 86400; # max number of seconds after which the letter is forcibly released
    25 my $nLOCK_FILE_MAX_ATTEMPTS = 5;
    24 my $nLOCK_FILE_MAX_ATTEMPTS = 5;
    26 my $sNUMBERS_FILE="\\\\sym-build01\\f\$\\numbers.txt";
    25 #my $sNUMBERS_FILE="\\\\sym-build01\\f\$\\numbers.txt";
       
    26 my $sNUMBERS_FILE="d:\\numbers.txt";
    27 my $sLETTERS_FILE="D:\\letters.txt";
    27 my $sLETTERS_FILE="D:\\letters.txt";
    28 my $nMAX_LETTER_AGE_SECONDS = 86400; # max number of seconds after which the letter is forcibly released
    28 my $nMAX_LETTER_AGE_SECONDS = 86400; # max number of seconds after which the letter is forcibly released
    29 
    29 
    30 my $sProjectRepo = '';
    30 my $sFbfProjectRepo = '';
       
    31 my $sFbfProjectDir = '';
       
    32 my $sFbfConfigRepo="\\\\lon-engbuild87\\d\$\\mercurial_development\\oss\\FCL\\interim\\fbf\\configs\\pkgbuild";
       
    33 my $sFbfConfigDir = '';
    31 my $sJobLabel = '';
    34 my $sJobLabel = '';
    32 my $nCmdLineNumber;
    35 my $nCmdLineNumber;
    33 GetOptions(('label:s' => \$sJobLabel, 'project:s' => \$sProjectRepo, 'number:s' => \$nCmdLineNumber));
    36 GetOptions(('label:s' => \$sJobLabel, 'configrepo:s' => \$sFbfConfigRepo, 'configdir:s' => \$sFbfConfigDir, 'projectrepo:s' => \$sFbfProjectRepo, 'projectdir:s' => \$sFbfProjectDir, 'number:s' => \$nCmdLineNumber));
    34 
    37 
    35 if (!$sJobLabel or !$sProjectRepo)
    38 if (!$sJobLabel or !$sFbfProjectRepo)
    36 {
    39 {
    37 	print "Usage: build_package.pl --label=<label> --project=<project_repo>\n";
    40 	print "Usage: build_package.pl --label=<label> --projectrepo=<project repo> | --projectdir=<project dir>\n\t[--configrepo=<config repo> | --configdir=<config dir>]\n";
    38 	exit(0);
    41 	exit(0);
    39 }
    42 }
    40 
    43 
    41 my $sJobDir = mkdir_unique("$sJOB_BASE_DIR\\$sJobLabel");
    44 my $sJobDir = mkdir_unique("$sJOB_BASE_DIR\\$sJobLabel");
    42 
    45 
    43 print("cd $sBOOTSTRAP_DIR\n");
    46 print("cd $sBOOTSTRAP_DIR\n");
    44 chdir("$sBOOTSTRAP_DIR");
    47 chdir("$sBOOTSTRAP_DIR");
    45 print "###### BOOTSTRAP ######\n";
    48 print "###### BOOTSTRAP ######\n";
    46 print("hlm -f bootstrap.xml -Dsf.config.repo=$sCONFIG_REPO -Dsf.project.repo=$sProjectRepo -Dsf.target.dir=$sJobDir\n");
    49 my $sConfigArg = "-Dsf.config.repo=$sFbfConfigRepo";
    47 system("hlm -f bootstrap.xml -Dsf.config.repo=$sCONFIG_REPO -Dsf.project.repo=$sProjectRepo -Dsf.target.dir=$sJobDir");
    50 $sConfigArg = "-Dsf.config.dir=$sFbfConfigDir" if ($sFbfConfigDir);
       
    51 my $sProjectArg = "-Dsf.project.repo=$sFbfProjectRepo";
       
    52 $sProjectArg = "-Dsf.project.dir=$sFbfProjectDir" if ($sFbfProjectDir);
       
    53 print("hlm -f bootstrap.xml $sConfigArg $sProjectArg -Dsf.target.dir=$sJobDir\n");
       
    54 system("hlm -f bootstrap.xml $sConfigArg $sProjectArg -Dsf.target.dir=$sJobDir");
    48 
    55 
    49 # check that $sNUMBERS_FILE exists, otherwise create it
    56 # check that $sNUMBERS_FILE exists, otherwise create it
    50 if (!-f $sNUMBERS_FILE)
    57 if (!-f $sNUMBERS_FILE)
    51 {
    58 {
    52 	open FILE, ">$sNUMBERS_FILE";
    59 	open FILE, ">$sNUMBERS_FILE";
    53 	print FILE "\n";
    60 	print FILE "\n";
    54 	close FILE;
    61 	close FILE;
    55 }
    62 }
    56 
    63 
    57 my $nUnformattedNumber = ( $nCmdLineNumber ? $nCmdLineNumber : get_job_number($sProjectRepo));
    64 my $nUnformattedNumber = ( $nCmdLineNumber ? $nCmdLineNumber : get_job_number($sFbfProjectRepo));
    58 my $nJobNumber = sprintf("%.3d", $nUnformattedNumber);
    65 my $nJobNumber = sprintf("%.3d", $nUnformattedNumber);
    59 
    66 
    60 # check that $sLETTERS_FILE exists, otherwise create it
    67 # check that $sLETTERS_FILE exists, otherwise create it
    61 if (!-f $sLETTERS_FILE)
    68 if (!-f $sLETTERS_FILE)
    62 {
    69 {