зеркало из https://github.com/mozilla/pjs.git
Build script update (NOT PART OF THE BUILD)
This commit is contained in:
Родитель
cb62a03a11
Коммит
4952cc1a60
|
@ -48,7 +48,6 @@ my($prefs_file_name) = "Mozilla opt build prefs";
|
|||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%pull);
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
|
|
|
@ -48,7 +48,6 @@ my($prefs_file_name) = "Mozilla debug build prefs";
|
|||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%pull);
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
|
@ -73,7 +72,7 @@ SetupBuildRootDir(":mozilla:build:mac:build_scripts");
|
|||
# Override the defaults using the preferences files.
|
||||
SetupDefaultBuildOptions(1, ":mozilla:dist:viewer_debug:");
|
||||
|
||||
my($do_checkout) = 0;
|
||||
my($do_pull) = 0; # overridden by flags and prefs
|
||||
my($do_build) = 1;
|
||||
|
||||
RunBuild($do_checkout, $do_build, \%inputfiles, $prefs_file_name);
|
||||
RunBuild($do_pull, $do_build, \%inputfiles, $prefs_file_name);
|
||||
|
|
|
@ -200,9 +200,13 @@ sub CheckOutModule($$$$)
|
|||
|
||||
my($checkout_err) = $session->getLastError();
|
||||
if ($checkout_err == 708) {
|
||||
die "Checkout was cancelled";
|
||||
die "Error: Checkout was cancelled.\n";
|
||||
} elsif ($checkout_err == 911) {
|
||||
die "Error: CVS session settings are incorrect. Check your password, and the CVS root settings.\n";
|
||||
} elsif ($checkout_err == 703) {
|
||||
die "Error: CVS checkout failed. Unknown module, unknown tag, bad username, or other CVS error.\n";
|
||||
} elsif ($checkout_err == 711) {
|
||||
print "Checkout of '$module' failed\n";
|
||||
print "Checkout of '$module' failed.\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +226,7 @@ sub Checkout($)
|
|||
{
|
||||
my($checkout_list) = @_;
|
||||
|
||||
unless ( $main::pull{all} ) { return; }
|
||||
unless ( $main::build{pull} ) { return; }
|
||||
|
||||
my($start_time) = TimeStart();
|
||||
|
||||
|
@ -231,8 +235,9 @@ sub Checkout($)
|
|||
my($session) = Moz::MacCVS->new( $cvsfile );
|
||||
unless (defined($session)) { die "Error: Checkout aborted. Cannot create session file: $session" }
|
||||
|
||||
# activate MacCVS
|
||||
ActivateApplication('Mcvs');
|
||||
StartBuildModule("pull");
|
||||
|
||||
my(@cvs_co_list);
|
||||
|
||||
my($checkout_file) = getScriptFolder().":".$checkout_list;
|
||||
local(*CHECKOUT_FILE);
|
||||
|
@ -247,38 +252,56 @@ sub Checkout($)
|
|||
next;
|
||||
}
|
||||
|
||||
my($module) = "";
|
||||
my($revision) = "";
|
||||
my($date) = "";
|
||||
my(@cvs_co) = ["", "", ""];
|
||||
|
||||
if ($line =~ /\s*([^\s]+)\s*\,\s*([^\s]+)\s*\,\s*(.+)\s*/)
|
||||
my($module, $revision, $date) = (0, 1, 2);
|
||||
|
||||
if ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*\,\s*([^#]+)/)
|
||||
{
|
||||
$module = $1;
|
||||
$revision = $2;
|
||||
$date = $3;
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$revision] = $2;
|
||||
@cvs_co[$date] = $3;
|
||||
}
|
||||
elsif ($line =~ /\s*([\/\w]+)\s*\,\s*(\w+)\s*/)
|
||||
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*([^#,\s]+)\s*(#.+)?/)
|
||||
{
|
||||
$module = $1;
|
||||
$revision = $2;
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$revision] = $2;
|
||||
}
|
||||
elsif ($line =~ /\s*([^\s]+)\s*\,\s*,\s*(.+)\s*/)
|
||||
elsif ($line =~ /\s*([^#,\s]+)\s*\,\s*,\s*([^#,]+)/)
|
||||
{
|
||||
$module = $1;
|
||||
$date = $2;
|
||||
@cvs_co[$module] = $1;
|
||||
@cvs_co[$date] = $2;
|
||||
}
|
||||
elsif ($line =~ /\s*([\/\w]+)/)
|
||||
elsif ($line =~ /\s*([^#,\s]+)/)
|
||||
{
|
||||
$module = $1;
|
||||
@cvs_co[$module] = $1;
|
||||
}
|
||||
else
|
||||
{
|
||||
die "Error: unrecognized line '$line' in $checkout_list\n";
|
||||
}
|
||||
|
||||
# print "Checking out '$module', '$revision', '$date'\n";
|
||||
CheckOutModule($session, $module, $revision, $date);
|
||||
# strip surrounding space from date
|
||||
@cvs_co[$date] =~ s/^\s*|\s*$//g;
|
||||
|
||||
# print "Going to check out '@cvs_co[$module]', '@cvs_co[$revision]', '@cvs_co[$date]'\n";
|
||||
push(@cvs_co_list, \@cvs_co);
|
||||
}
|
||||
|
||||
close(CHECKOUT_FILE);
|
||||
|
||||
# activate MacCVS
|
||||
ActivateApplication('Mcvs');
|
||||
|
||||
my($this_co);
|
||||
foreach $this_co (@cvs_co_list)
|
||||
{
|
||||
my($module, $revision, $date) = ($this_co->[0], $this_co->[1], $this_co->[2]);
|
||||
CheckOutModule($session, $module, $revision, $date);
|
||||
}
|
||||
|
||||
TimeEnd($start_time, "Checkout");
|
||||
EndBuildModule("pull");
|
||||
}
|
||||
|
||||
|
||||
|
@ -297,8 +320,7 @@ sub RunBuild($$$$)
|
|||
}
|
||||
|
||||
# read local prefs, and the build progress file, and set flags to say what to build
|
||||
SetupBuildParams(\%main::pull,
|
||||
\%main::build,
|
||||
SetupBuildParams(\%main::build,
|
||||
\%main::options,
|
||||
\%main::optiondefines,
|
||||
\%main::filepaths,
|
||||
|
@ -308,7 +330,7 @@ sub RunBuild($$$$)
|
|||
# If we were told to pull, make sure we do, overriding prefs etc.
|
||||
if ($do_pull)
|
||||
{
|
||||
$main::pull{"all"} = 1;
|
||||
$main::build{"pull"} = 1;
|
||||
}
|
||||
|
||||
# setup the build log
|
||||
|
@ -344,9 +366,7 @@ sub RunBuild($$$$)
|
|||
$package_name =~ s/\.pm$//;
|
||||
|
||||
chdir($main::MOZ_SRC);
|
||||
my($dist_time) = TimeStart();
|
||||
&{$package_name."::BuildDist"}();
|
||||
TimeEnd($dist_time, "Building dist");
|
||||
|
||||
chdir($main::MOZ_SRC);
|
||||
&{$package_name."::BuildProjects"}();
|
||||
|
|
|
@ -28,13 +28,11 @@ use vars qw(@ISA @EXPORT);
|
|||
);
|
||||
|
||||
|
||||
my(@pull_flags);
|
||||
my(@build_flags);
|
||||
my(@options_flags);
|
||||
my(@filepath_flags);
|
||||
|
||||
my(%arrays_list) = (
|
||||
"pull_flags", \@pull_flags,
|
||||
"build_flags", \@build_flags,
|
||||
"options_flags", \@options_flags,
|
||||
"filepath_flags", \@filepath_flags
|
||||
|
@ -55,7 +53,7 @@ sub appendArrayFlag($$$)
|
|||
my($flags_array) = $arrays_list{$array_name};
|
||||
if ($flags_array)
|
||||
{
|
||||
push(@{$flags_array}, @this_flag);
|
||||
push(@{$flags_array}, @this_flag) || die "Failed to append\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -94,19 +92,19 @@ sub readFlagsFile($)
|
|||
}
|
||||
|
||||
# 1-word line, probably array name
|
||||
if ($line =~ /^(\w+)\s*$/)
|
||||
if ($line =~ /^([^#\s]+)\s*$/)
|
||||
{
|
||||
$cur_array = $1;
|
||||
next;
|
||||
}
|
||||
elsif ($line =~ /^(\w+)\s+\"(.+)\"\s*$/) # quoted option
|
||||
elsif ($line =~ /^([^#\s]+)\s+\"(.+)\"(\s+#.+)?$/) # quoted option, possible comment
|
||||
{
|
||||
my($flag) = $1;
|
||||
my($setting) = $2;
|
||||
|
||||
appendArrayFlag($cur_array, $flag, $setting);
|
||||
}
|
||||
elsif ($line =~ /^(\w+)\s+([^\s]+)\s*$/)
|
||||
elsif ($line =~ /^([^#\s]+)\s+([^#\s]+)(\s+#.+)?$/) # two-word line, possible comment
|
||||
{
|
||||
my($flag) = $1;
|
||||
my($setting) = $2;
|
||||
|
@ -163,14 +161,21 @@ sub printHash($)
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetPullFlags
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetPullFlags($)
|
||||
#-----------------------------------------------
|
||||
# printBuildArray
|
||||
#
|
||||
# Utility routine to print a 2D array
|
||||
#-----------------------------------------------
|
||||
sub printBuildArray($)
|
||||
{
|
||||
my($pull) = @_;
|
||||
my($build_array) = @_;
|
||||
|
||||
my($entry);
|
||||
foreach $entry (@$build_array)
|
||||
{
|
||||
print "$entry->[0] = $entry->[1]\n";
|
||||
}
|
||||
|
||||
flagsArrayToHash(\@pull_flags, $pull);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
@ -248,6 +253,8 @@ sub _getBuildProgressFile()
|
|||
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
#// setBuildProgressStart
|
||||
#//
|
||||
#// This automagically sets $build{"all"} to 0
|
||||
#//--------------------------------------------------------------------------------------------------
|
||||
sub setBuildProgressStart($$)
|
||||
{
|
||||
|
@ -257,10 +264,11 @@ sub setBuildProgressStart($$)
|
|||
my($index);
|
||||
foreach $index (@$build_array)
|
||||
{
|
||||
$index->[1] = $setting;
|
||||
$index->[1] = 0; # $setting;
|
||||
|
||||
if ($index->[0] eq $name) {
|
||||
$setting = 1;
|
||||
# $setting = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -337,31 +345,59 @@ sub ReadBuildProgress($)
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# clearOldBuildSettings
|
||||
#-------------------------------------------------------------------------------
|
||||
sub clearOldBuildSettings($$$$)
|
||||
{
|
||||
my($build, $options, $optiondefines, $filepaths) = @_;
|
||||
|
||||
# empty the arrays in case we're being called twice
|
||||
@build_flags = ();
|
||||
@options_flags = ();
|
||||
@filepath_flags = ();
|
||||
|
||||
# and empty the hashes
|
||||
%$build = ();
|
||||
%$options = ();
|
||||
%$optiondefines = ();
|
||||
%$filepaths = ();
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# SetupBuildParams
|
||||
#-------------------------------------------------------------------------------
|
||||
sub SetupBuildParams($$$$$$$)
|
||||
sub SetupBuildParams($$$$$$)
|
||||
{
|
||||
my($pull, $build, $options, $optiondefines, $filepaths, $flags_file, $prefs_file) = @_;
|
||||
my($build, $options, $optiondefines, $filepaths, $flags_file, $prefs_file) = @_;
|
||||
|
||||
# Empty the hashes and arrays, to wipe out any stale data.
|
||||
# Needed because these structures persist across two build scripts
|
||||
# called using 'do' from a parent script.
|
||||
clearOldBuildSettings($build, $options, $optiondefines, $filepaths);
|
||||
|
||||
# Read from the flags file, which sets up the various arrays
|
||||
readFlagsFile($flags_file);
|
||||
|
||||
# read the user pref file, that can change values in the array
|
||||
ReadMozUserPrefs($prefs_file, \@pull_flags, \@build_flags, \@options_flags, \@filepath_flags);
|
||||
# If 'all' is set in the build array, propagate that to all entries
|
||||
PropagateAllFlags(\@build_flags);
|
||||
|
||||
# read the user pref file, that can change values in the array
|
||||
ReadMozUserPrefs($prefs_file, \@build_flags, \@options_flags, \@filepath_flags);
|
||||
|
||||
# If build progress exists, this clears flags in the array up to a certain point
|
||||
ReadBuildProgress(\@build_flags);
|
||||
|
||||
PropagateAllFlags(\@build_flags);
|
||||
PropagateAllFlags(\@pull_flags);
|
||||
# printBuildArray(\@build_flags);
|
||||
# printBuildArray(\@options_flags);
|
||||
|
||||
SetPullFlags($pull);
|
||||
SetBuildFlags($build);
|
||||
SetBuildOptions($options);
|
||||
SetOptionDefines($optiondefines);
|
||||
SetFilepathFlags($filepaths);
|
||||
|
||||
# printHash($build);
|
||||
# printHash($build);
|
||||
# printHash($options);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ sub WriteDefaultPrefsFile($)
|
|||
% Lines which modify the default build settings. For the list of flags,
|
||||
% see MozBuildFlags.pm. Examples are:
|
||||
%
|
||||
% pull runtime 1 % just pull runtime
|
||||
% build pull 0 % don't pull
|
||||
% options mng 1 % turn mng on
|
||||
%
|
||||
% Line containing the special 'buildfrom' flag, which specifies
|
||||
|
@ -164,25 +164,26 @@ sub HandleBuildFromPref($$)
|
|||
|
||||
sub ReadPrefsFile($$$$$)
|
||||
{
|
||||
my($file_path, $pull_flags, $build_flags, $options_flags, $filepath_flags) = @_;
|
||||
my($file_path, $build_flags, $options_flags, $filepath_flags, $create_if_missing) = @_;
|
||||
|
||||
local(*PREFS_FILE);
|
||||
|
||||
if (open(PREFS_FILE, "< $file_path"))
|
||||
{
|
||||
print "Reading build prefs from $file_path\n";
|
||||
print "Reading build prefs from '$file_path'\n";
|
||||
|
||||
while (<PREFS_FILE>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
if ($line =~ /^\#/ || $line =~ /^\s*$/) { # ignore comments and empty lines
|
||||
next;
|
||||
}
|
||||
|
||||
if (($line =~ /^\s*(\w+)\s+(\w+)\s+\"(.+)\"\s*/) ||
|
||||
($line =~ /^\s*(\w+)\s+(\w+)\s+\'(.+)\'\s*/) ||
|
||||
($line =~ /^\s*(\w+)\s+(\w+)\s+([^\s]+)\s*/))
|
||||
if (($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\"(.+)\"(\s+#.+)?/) ||
|
||||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+\'(.+)\'(\s+#.+)?/) ||
|
||||
($line =~ /^\s*([^#\s]+)\s+([^#\s]+)\s+([^#\s]+)(\s+#.+)?/))
|
||||
{
|
||||
my($array_name) = $1;
|
||||
my($option_name) = $2;
|
||||
|
@ -190,11 +191,7 @@ sub ReadPrefsFile($$$$$)
|
|||
|
||||
# print "Read '$array_name' '$option_name' '$option_value'\n";
|
||||
|
||||
if ($array_name eq "pull")
|
||||
{
|
||||
HandlePrefSet($pull_flags, $option_name, $option_value, "Pull");
|
||||
}
|
||||
elsif ($array_name eq "build")
|
||||
if ($array_name eq "build")
|
||||
{
|
||||
HandlePrefSet($build_flags, $option_name, $option_value, "Build");
|
||||
}
|
||||
|
@ -211,12 +208,12 @@ sub ReadPrefsFile($$$$$)
|
|||
print "Unknown pref option at $line\n";
|
||||
}
|
||||
}
|
||||
elsif ($line =~ /^\s*buildfrom\s+(\w+)/)
|
||||
elsif ($line =~ /^\s*buildfrom\s+([^#\s]+)(\s+#.+)?/)
|
||||
{
|
||||
my($build_start) = $1;
|
||||
HandleBuildFromPref($build_flags, $build_start);
|
||||
}
|
||||
elsif ($line =~ /^\s*(\w+)\s+(\w+)/)
|
||||
elsif ($line =~ /^\s*([^#\s]+)\s+([^#\s]+)(\s+#.+)?/)
|
||||
{
|
||||
my($build_var) = $1;
|
||||
my($var_setting) = $2;
|
||||
|
@ -226,14 +223,14 @@ sub ReadPrefsFile($$$$$)
|
|||
}
|
||||
else
|
||||
{
|
||||
print "Unknown pref option at $line\n";
|
||||
print "Unrecognized input line at $line\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(PREFS_FILE);
|
||||
}
|
||||
else
|
||||
elsif ($create_if_missing)
|
||||
{
|
||||
print "No prefs file found at $file_path; using defaults\n";
|
||||
|
||||
|
@ -251,16 +248,26 @@ sub ReadPrefsFile($$$$$)
|
|||
#
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
sub ReadMozUserPrefs($$$$$)
|
||||
sub ReadMozUserPrefs($$$$)
|
||||
{
|
||||
my($prefs_file_name, $pull_flags, $build_flags, $options_flags, $filepath_flags) = @_;
|
||||
my($prefs_file_name, $build_flags, $options_flags, $filepath_flags) = @_;
|
||||
|
||||
if ($prefs_file_name eq "") { return; }
|
||||
|
||||
# if local prefs exist, just use those. Othewise, look in the prefs folder
|
||||
if (-e $prefs_file_name)
|
||||
{
|
||||
# read local prefs
|
||||
ReadPrefsFile($prefs_file_name, $build_flags, $options_flags, $filepath_flags, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
# first read prefs folder prefs
|
||||
my($prefs_path) = GetPrefsFolder();
|
||||
$prefs_path .= ":$prefs_file_name";
|
||||
|
||||
ReadPrefsFile($prefs_path, $pull_flags, $build_flags, $options_flags, $filepath_flags);
|
||||
ReadPrefsFile($prefs_path, $build_flags, $options_flags, $filepath_flags, 1);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
# Setting containing spaces must be quoted with double quotes.
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
pull_flags
|
||||
all 0
|
||||
|
||||
build_flags
|
||||
all 1
|
||||
pull 0
|
||||
dist 0
|
||||
xpidl 0
|
||||
idl 0
|
||||
|
@ -49,5 +47,5 @@ xptlink 0
|
|||
filepath_flags
|
||||
idepath ":CodeWarrior IDE Path.txt"
|
||||
sessionpath ":Mozilla session path.txt"
|
||||
buildlogfilepath ":Build Logs:Mozilla build log.txt"
|
||||
buildlogfilepath ":Build Logs:Mozilla build log.txt" # this is a path
|
||||
scriptlogfilepath ":Build Logs:Mozilla script log.txt"
|
||||
|
|
|
@ -48,7 +48,6 @@ my($prefs_file_name) = "Mozilla pull prefs";
|
|||
#-------------------------------------------------------------
|
||||
# hashes to hold build options
|
||||
#-------------------------------------------------------------
|
||||
my(%pull);
|
||||
my(%build);
|
||||
my(%options);
|
||||
my(%filepaths);
|
||||
|
|
Загрузка…
Ссылка в новой задаче