Bug 359064: Adds --interval support to build-seamonkey.pl, so certain builds can only be run once every N seconds. r=rhelmer

This commit is contained in:
preed%mozilla.com 2006-11-03 03:27:31 +00:00
Родитель 960126a57d
Коммит d6f924a640
2 изменённых файлов: 21 добавлений и 2 удалений

Просмотреть файл

@ -24,7 +24,7 @@ use Config; # for $Config{sig_name} and $Config{sig_num}
use File::Find ();
use File::Copy;
$::UtilsVersion = '$Revision: 1.338 $ ';
$::UtilsVersion = '$Revision: 1.339 $ ';
package TinderUtils;
@ -144,6 +144,7 @@ Options:
--config-cvsup-dir DIR Provide a directory of configuration files
(mozconfig, etc.) to run a "cvs update" in before
a build begins.
--interval Limit this build to building once every N seconds
--version Print the version number (same as cvs revision).
--help
More details:
@ -179,6 +180,7 @@ sub ParseArgs {
-t BuildTree
--mozconfig MozConfigFileName
--config-cvsup-dir TboxBuildConfigDir
--interval BuildInterval
);
if (defined $args_with_options{$arg}) {
my $arg_arg = shift @ARGV;

Просмотреть файл

@ -12,11 +12,28 @@ use strict;
# They are not initialized here. The default values are after "__END__".
$TreeSpecific::name = $TreeSpecific::build_target = $TreeSpecific::checkout_target = $TreeSpecific::clobber_target = $::Version = undef;
$::Version = '$Revision: 1.103 $ ';
$::Version = '$Revision: 1.104 $ ';
{
TinderUtils::Setup();
tree_specific_overides();
# This code assumes that the build process will alter the mtime of the
# "build directory" (i.e. WINNT_5.2_Dep, Darwin_8.1.0_Clbr, etc.) by
# dumping a log file or some such in the directory. If that's not the
# case, then this "feature" won't work.
if (defined($Settings::BuildInterval) && $Settings::BuildInterval > 0) {
print STDERR "Build interval of $Settings::BuildInterval seconds requested\n";
my $lastBuilt = (stat($Settings::DirName))[9]; ## Magic 9 is st_mtime
my $now = time();
if (($now - $Settings::BuildInterval) < $lastBuilt) {
print STDERR 'Last built at ' . scalar(localtime($lastBuilt)) .
', ' . ($now - $lastBuilt) . " seconds ago; not building.\n";
TinderUtils::stop_tinderbox(reason => 'Build interval not expired');
}
}
TinderUtils::Build();
}