# Read all of the arguments $TypeBuild = ""; $DirBuild = ""; $FetchBuild = ""; $LabelBuild = ""; $ReturnLabel = ""; $ReturnBase = ""; $Return = ""; $Products = ""; # Save all the variables that are suppose to be set. open(SETVAR, "+>setvar.bat"); open(DELVAR, "+>delvar.bat"); print SETVAR "\@set CVSROOT=$ENV{'SYSTEM1VSS'}\n"; print DELVAR "\@set CVSROOT=\n"; print SETVAR "\@set SYSTEM2VSS=$ENV{'SYSTEM2VSS'}\n"; print DELVAR "\@set SYSTEM2VSS=\n"; print "\nYou may choose to quit this session by entering \"Q\" at any of the\n"; print "prompts that follow.\n\n"; # Get the current working directory. $BuildCwd = qx/cd/; chop $BuildCwd; $BuildCwd = uc ($BuildCwd); $BuildCwdDrive = substr($BuildCwd, 0, 2); $Products = &GetProdtoBuild; # Hard code this to be a release build as there is no need for a debug build currently # yes I know there will be one once I am complete. $TypeBuild = R; &SetEnvironment(); $CVSROOT = $ENV{'CVSROOT'}; if ($CVSROOT ne "") { print "\nDo you want to fetch files from CVS? Y/N [$FetchBuild] : "; $Return = ; chop $Return; &QuitIfChosen ($Return); if ($Return eq "") { $Return = $FetchBuild; } elsif ($Return eq 'Y' || $Return eq 'y') { $FetchBuild = "Y"; } else { $FetchBuild = "N"; } print "\nDo you want to label the build? Y/N [$LabelBuild] : "; $Return = ; chop $Return; &QuitIfChosen ($Return); $Return = uc($Return); if ($Return eq "") { last; } if ($Return eq "Y" || $Return eq "N") { $LabelBuild = $Return; } } else { print "CVSROOT not defined in the environment. Cannot build\n"; exit (100); } if ($LabelBuild eq "Y") { $BuildNum = "RV" . &TimeNow ; # Prompt the user for the build label if ($BuildNum == 0) { $TmpLabel = ""; } else { $TmpLabel = "$BuildNum"; } } $TmpLabel = "LATEST" if !$TmpLabel; # Label cannot be LATEST if labeling build if ($TmpLabel eq "LATEST") { print "\n"; print "ERROR: Unexpected default label of \"LATEST\" for labeled build.\n"; print "ERROR: Cannot continue.\n"; exit (100); } print "\nEnter the build name [$TmpLabel] : "; $Return = ; chop $Return; &QuitIfChosen ($Return); $ReturnLabel = $TmpLabel if !$Return; $ReturnLabel = uc($Return) if $Return; $JobName = $ReturnLabel; $ReturnLabel = "" if $ReturnLabel eq "LATEST"; # Get the files from CVS if we chose to label them then Rtag the files # use Rtag as it does not require a local copy and we can # then get the local copy of the file if ($FetchBuild eq "Y") { # check to see if we need to label the build if ($LabelBuild eq "Y") { # tag the repository $ret = &PlaceTag($JobName); } # # now fetch the files $ret = &FetchFiles($JobName, $ModuleName); } # build the product here # ******************************************************************* # ******************************************************************* # all Sub Routines are here # ******************************************************************* sub PlaceTag{ } sub TimeNow { #determine the date for the build label # get the time from 1/1/1900 ($seconds, $min, $hour, $DayofMonth, $month, $year, $weekday, $yeardate, $DST) = localtime(time); # add so we have the correct date, weekday and month are 0 based $year = $year + 1900; $month = $month + 1; # add a filling 0 to make sure we have a 2 digit day and month if ($month < 10) { $filler = 0; } else { $filler = ""; } if ($DayofMonth < 10 ) { $dayfil = 0 ; } else { $dayfil = ""; } $date = $year . $filler . $month . $dayfil . $DayofMonth ; return $date; } sub QuitIfChosen { if (uc($_[0]) eq "Q") { print "\nQuitting session per user request.\n"; exit(100); } } sub SetEnvironment { # this will establish the environment # system "setenv CVSROOT /usr/proj3/case/95s523/95sbde/base/Master"; system "setenv BDEROOT /usr/proj3/case/95s523/95sbde/base/Master"; qx/set alias dir ls -l/; # OK so it's a dos thing. qx/set alias ls ls -l/; system 'setenv CXX=g++'; # print out the environment @cmd = "setenv | tee environment.txt"; $ret = system @cmd; } sub GetProdtoBuild { # # this is put in to support multiple products that can be defined and built separately # allowing us to build several smaller products rather than a large monolithic build # # when the support for this is desired remove the following line return ""; print "\nYou may choose the product(s) to build. For a FULL build, press ."; print "\nUse whitespace or comma between multiple products.\n"; print "\nEnter the product(s) to build : "; $Return = ; chomp $Return; &QuitIfChosen ($Return); $Return =~ s/^\s+//; # Delete leading whitespace $Return =~ s/\s+$//; # Delete trailing whitespace $Return =~ s/\s+/,/g; # Replace whitespace with comma if ($Return ne "") { $Products = $Return; print "\n\nProduct(s) \"$Products\" will be built\n\n"; } else { print "\n\nNo product was chosen. A full build will be performed\n\n"; } print SETVAR "\@set BUILDPRODUCTS=$Products\n"; print DELVAR "\@set BUILDPRODUCTS=\n"; }