Bug 387970: Regression issues in _M5; move CvsTag() from Bootstrap::Step::Tag to Bootstrap::Util. r=rhelmer
git-svn-id: svn://10.0.0.236/trunk@235922 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
69e1c5f094
commit
168ecc255d
@ -9,13 +9,13 @@ use File::Spec::Functions;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
use Bootstrap::Config;
|
||||
use Bootstrap::Util;
|
||||
use MozBuild::Util qw(RunShellCommand Email);
|
||||
|
||||
use base 'Exporter';
|
||||
|
||||
our @EXPORT = qw(catfile);
|
||||
|
||||
my $DEFAULT_TIMEOUT = 3600;
|
||||
my $DEFAULT_LOGFILE = 'default.log';
|
||||
|
||||
sub new {
|
||||
@ -33,7 +33,7 @@ sub Shell {
|
||||
my $cmdArgs = exists($args{'cmdArgs'}) ? $args{'cmdArgs'} : [];
|
||||
my $dir = $args{'dir'};
|
||||
my $timeout = exists($args{'timeout'}) ? $args{'timeout'} :
|
||||
$DEFAULT_TIMEOUT;
|
||||
$Bootstrap::Util::DEFAULT_SHELL_TIMEOUT;
|
||||
my $ignoreExitValue = exists($args{'ignoreExitValue'}) ?
|
||||
$args{'ignoreExitValue'} : 0;
|
||||
my $rv = '';
|
||||
|
||||
@ -8,7 +8,7 @@ use File::Copy qw(move);
|
||||
use POSIX qw(strftime);
|
||||
|
||||
use MozBuild::Util qw(MkdirWithPath RunShellCommand);
|
||||
use Bootstrap::Util qw(CvsCatfile);
|
||||
use Bootstrap::Util qw(CvsCatfile GetDiffFileList);
|
||||
|
||||
use Bootstrap::Step;
|
||||
use Bootstrap::Step::Tag::Bump;
|
||||
@ -115,7 +115,9 @@ sub Execute {
|
||||
$this->Shell(cmd => 'cvs',
|
||||
cmdArgs => ['up',
|
||||
'-r', $geckoTag],
|
||||
dir => catfile($cvsrootTagDir, 'mozilla'));
|
||||
dir => catfile($cvsrootTagDir, 'mozilla'),
|
||||
logFile => catfile($logDir, 'tag-relbranch_update_' .
|
||||
$geckoTag));
|
||||
} else {
|
||||
# We go through some convoluted hoops here to get the _RELBRANCH
|
||||
# datespec without forcing it to be specified. Because of this,
|
||||
@ -236,50 +238,35 @@ sub CvsTag {
|
||||
my %args = @_;
|
||||
|
||||
# All the required args first, followed by the optional ones...
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): null tagName" if
|
||||
(!exists($args{'tagName'}));
|
||||
my $tagName = $args{'tagName'};
|
||||
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): null coDir" if
|
||||
(!exists($args{'coDir'}));
|
||||
my $coDir = $args{'coDir'};
|
||||
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): invalid files data" if
|
||||
(exists($args{'files'}) && ref($args{'files'}) ne 'ARRAY');
|
||||
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): null logFile"
|
||||
if (!exists($args{'logFile'}));
|
||||
my $logFile = $args{'logFile'};
|
||||
|
||||
my $branch = exists($args{'branch'}) ? $args{'branch'} : 0;
|
||||
my $files = exists($args{'files'}) ? $args{'files'} : [];
|
||||
my $force = exists($args{'force'}) ? $args{'force'} : 0;
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): null coDir" if
|
||||
(!exists($args{'coDir'}));
|
||||
|
||||
# We renamed this argument when CvsTag() got moved...
|
||||
$args{'cvsDir'} = $args{'coDir'};
|
||||
|
||||
# Check if we're supposed to dump the tagging output to stdout...
|
||||
my $config = new Bootstrap::Config();
|
||||
my $logDir = $config->Get(sysvar => 'logDir');
|
||||
|
||||
# only force or branch specific files, not the whole tree
|
||||
if ($force && scalar(@{$files}) <= 0) {
|
||||
die("ASSERT: Bootstrap::Step::Tag::CvsTag(): Cannot specify force without files");
|
||||
} elsif ($branch && scalar(@{$files}) <= 0) {
|
||||
die("ASSERT: Bootstrap::Step::Tag::CvsTag(): Cannot specify branch without files");
|
||||
} elsif ($branch && $force) {
|
||||
die("ASSERT: Bootstrap::Step::Tag::CvsTag(): Cannot specify both branch and force");
|
||||
if ($config->Exists(var => 'dumpLogs') &&
|
||||
$config->Get(var => 'dumpLogs')) {
|
||||
$args{'output'} = 1;
|
||||
}
|
||||
|
||||
my @cmdArgs;
|
||||
push(@cmdArgs, 'tag');
|
||||
push(@cmdArgs, '-F') if ($force);
|
||||
push(@cmdArgs, '-b') if ($branch);
|
||||
push(@cmdArgs, $tagName);
|
||||
push(@cmdArgs, @{$files}) if (scalar(@{$files}) > 0);
|
||||
# We call this by full scoping (and don't include it in the use() statement
|
||||
# for Bootstrap::Util above) to disambiguate between the Util version and
|
||||
# the Tag version, which is a shim now.
|
||||
my $rv = Bootstrap::Util::CvsTag(%args);
|
||||
|
||||
$this->Shell(
|
||||
cmd => 'cvs',
|
||||
cmdArgs => \@cmdArgs,
|
||||
dir => $coDir,
|
||||
logFile => $logFile,
|
||||
);
|
||||
if ($rv->{'timedOut'} || ($rv->{'exitValue'} != 0)) {
|
||||
$this->Log(msg => "Bootstrap::Step::Tag::CvsTag failed; rv: " .
|
||||
"$rv->{'exitValue'}, timeout: $rv->{'timedOut'}, output: " .
|
||||
"$rv->{'output'}");
|
||||
die("Bootstrap::Step::Tag::CvsTag: exited bogusly: $rv->{'exitValue'}");
|
||||
}
|
||||
|
||||
return $rv;
|
||||
}
|
||||
|
||||
#
|
||||
@ -326,53 +313,4 @@ sub GenerateRelbranchName {
|
||||
return 'GECKO' . $geckoVersion . '_' . $geckoDateSpec . '_RELBRANCH';
|
||||
}
|
||||
|
||||
sub GetDiffFileList {
|
||||
my $this = shift;
|
||||
my %args = @_;
|
||||
|
||||
foreach my $requiredArg (qw(cvsDir prevTag newTag)) {
|
||||
if (!exists($args{$requiredArg})) {
|
||||
die "ASSERT: MozBuild::Util::GetDiffFileList(): null arg: " .
|
||||
$requiredArg;
|
||||
}
|
||||
}
|
||||
|
||||
my $cvsDir = $args{'cvsDir'};
|
||||
my $firstTag = $args{'prevTag'};
|
||||
my $newTag = $args{'newTag'};
|
||||
|
||||
my $rv = RunShellCommand(command => 'cvs',
|
||||
args => ['diff', '-uN',
|
||||
'-r', $firstTag,
|
||||
'-r', $newTag],
|
||||
dir => $cvsDir,
|
||||
timeout => 3600);
|
||||
|
||||
# Gah. So, the shell return value of "cvs diff" is dependent on whether or
|
||||
# not there were diffs, NOT whether or not the command succeeded. (Thanks,
|
||||
# CVS!) So, we can't really check exitValue here, since it could be 1 or
|
||||
# 0, depending on whether or not there were diffs (and both cases are valid
|
||||
# for this function). Maybe if there's an error it returns a -1? Or 2?
|
||||
# Who knows.
|
||||
#
|
||||
# So basically, we check that it's not 1 or 0, which... isn't a great test.
|
||||
#
|
||||
# TODO - check to see if timedOut, dumpedCore, or sigNum are set.
|
||||
if ($rv->{'exitValue'} != 1 && $rv->{'exitValue'} != 0) {
|
||||
die("ASSERT: MozBuild::Util::GetDiffFileList(): cvs diff returned " .
|
||||
$rv->{'exitValue'});
|
||||
}
|
||||
|
||||
my @differentFiles = ();
|
||||
|
||||
foreach my $line (split(/\n/, $rv->{'output'})) {
|
||||
if ($line =~ /^Index:\s(.+)$/) {
|
||||
push(@differentFiles, $1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return \@differentFiles;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@ -93,7 +93,9 @@ sub Execute {
|
||||
$this->Shell(cmd => 'cvs',
|
||||
cmdArgs => ['up',
|
||||
'-r', $geckoTag],
|
||||
dir => catfile($l10nTagDir, 'l10n'));
|
||||
dir => catfile($l10nTagDir, 'l10n'),
|
||||
logFile => catfile($logDir, 'tag-l10n_relbranch_update_' .
|
||||
$geckoTag));
|
||||
}
|
||||
|
||||
# Create the l10n RC tag
|
||||
|
||||
@ -10,10 +10,14 @@ use MozBuild::Util qw(RunShellCommand);
|
||||
|
||||
use base qw(Exporter);
|
||||
|
||||
our @EXPORT_OK = qw(CvsCatfile GetLocaleManifest
|
||||
our @EXPORT_OK = qw(CvsCatfile CvsTag
|
||||
GetDiffFileList
|
||||
GetLocaleManifest
|
||||
GetBouncerPlatforms GetPatcherPlatforms
|
||||
GetBouncerToPatcherPlatformMap);
|
||||
|
||||
our($DEFAULT_SHELL_TIMEOUT);
|
||||
|
||||
use strict;
|
||||
|
||||
# This maps Bouncer platforms, used in bouncer and the shipped-locales file
|
||||
@ -36,6 +40,7 @@ my %PLATFORM_MAP = (# bouncer/shipped-locales platform => patcher2 platform
|
||||
|
||||
my $DEFAULT_CVSROOT = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot';
|
||||
|
||||
$DEFAULT_SHELL_TIMEOUT = 3600;
|
||||
|
||||
##
|
||||
# Turn an array of directory/filenames into a CVS module path.
|
||||
@ -165,4 +170,104 @@ sub GetLocaleManifest {
|
||||
return $localeManifest;
|
||||
}
|
||||
|
||||
sub CvsTag {
|
||||
my %args = @_;
|
||||
|
||||
# All the required args first, followed by the optional ones...
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): null tagName" if
|
||||
(!exists($args{'tagName'}));
|
||||
my $tagName = $args{'tagName'};
|
||||
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): null cvsDir" if
|
||||
(!exists($args{'cvsDir'}));
|
||||
my $cvsDir = $args{'cvsDir'};
|
||||
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): invalid files data" if
|
||||
(exists($args{'files'}) && ref($args{'files'}) ne 'ARRAY');
|
||||
|
||||
die "ASSERT: Bootstrap::Step::Tag::CvsTag(): null logFile"
|
||||
if (!exists($args{'logFile'}));
|
||||
my $logFile = $args{'logFile'};
|
||||
|
||||
my $branch = exists($args{'branch'}) ? $args{'branch'} : 0;
|
||||
my $files = exists($args{'files'}) ? $args{'files'} : [];
|
||||
my $force = exists($args{'force'}) ? $args{'force'} : 0;
|
||||
my $timeout = exists($args{'timeout'}) ? $args{'timeout'} :
|
||||
$DEFAULT_SHELL_TIMEOUT;
|
||||
|
||||
# only force or branch specific files, not the whole tree
|
||||
if ($force && scalar(@{$files}) <= 0) {
|
||||
die("ASSERT: Bootstrap::Util::CvsTag(): Cannot specify force without files");
|
||||
} elsif ($branch && scalar(@{$files}) <= 0) {
|
||||
die("ASSERT: Bootstrap::UtilCvsTag(): Cannot specify branch without files");
|
||||
} elsif ($branch && $force) {
|
||||
die("ASSERT: Bootstrap::UtilCvsTag(): Cannot specify both branch and force");
|
||||
}
|
||||
|
||||
my @cmdArgs;
|
||||
push(@cmdArgs, 'tag');
|
||||
push(@cmdArgs, '-F') if ($force);
|
||||
push(@cmdArgs, '-b') if ($branch);
|
||||
push(@cmdArgs, $tagName);
|
||||
push(@cmdArgs, @{$files}) if (scalar(@{$files}) > 0);
|
||||
|
||||
my %cvsTagArgs = (command => 'cvs',
|
||||
args => \@cmdArgs,
|
||||
dir => $cvsDir,
|
||||
logfile => $logFile);
|
||||
|
||||
$cvsTagArgs{'timeout'} = $timeout if (defined($timeout));
|
||||
$cvsTagArgs{'output'} = $args{'output'} if (exists($args{'output'}));
|
||||
|
||||
return RunShellCommand(%cvsTagArgs);
|
||||
}
|
||||
|
||||
sub GetDiffFileList {
|
||||
my %args = @_;
|
||||
|
||||
foreach my $requiredArg (qw(cvsDir prevTag newTag)) {
|
||||
if (!exists($args{$requiredArg})) {
|
||||
die "ASSERT: MozBuild::Util::GetDiffFileList(): null arg: " .
|
||||
$requiredArg;
|
||||
}
|
||||
}
|
||||
|
||||
my $cvsDir = $args{'cvsDir'};
|
||||
my $firstTag = $args{'prevTag'};
|
||||
my $newTag = $args{'newTag'};
|
||||
|
||||
my $rv = RunShellCommand(command => 'cvs',
|
||||
args => ['diff', '-uN',
|
||||
'-r', $firstTag,
|
||||
'-r', $newTag],
|
||||
dir => $cvsDir,
|
||||
timeout => 3600);
|
||||
|
||||
# Gah. So, the shell return value of "cvs diff" is dependent on whether or
|
||||
# not there were diffs, NOT whether or not the command succeeded. (Thanks,
|
||||
# CVS!) So, we can't really check exitValue here, since it could be 1 or
|
||||
# 0, depending on whether or not there were diffs (and both cases are valid
|
||||
# for this function). Maybe if there's an error it returns a -1? Or 2?
|
||||
# Who knows.
|
||||
#
|
||||
# So basically, we check that it's not 1 or 0, which... isn't a great test.
|
||||
#
|
||||
# TODO - check to see if timedOut, dumpedCore, or sigNum are set.
|
||||
if ($rv->{'exitValue'} != 1 && $rv->{'exitValue'} != 0) {
|
||||
die("ASSERT: MozBuild::Util::GetDiffFileList(): cvs diff returned " .
|
||||
$rv->{'exitValue'});
|
||||
}
|
||||
|
||||
my @differentFiles = ();
|
||||
|
||||
foreach my $line (split(/\n/, $rv->{'output'})) {
|
||||
if ($line =~ /^Index:\s(.+)$/) {
|
||||
push(@differentFiles, $1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return \@differentFiles;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user