bump all relevant tags in client.mk b=387426 r=preed r=cf

This commit is contained in:
rhelmer@mozilla.com 2007-07-11 20:57:18 -07:00
parent 84385d4b0a
commit 45c44493ab

View File

@ -89,36 +89,52 @@ sub Execute {
my $bumpVersion = undef; my $bumpVersion = undef;
my $preVersion = undef; my $preVersion = undef;
my $search = undef; my %searchReplace = ();
my $replace = undef;
# Order or searching for these values is not preserved, so make
# sure that the order replacement happens does not matter.
if ($fileName eq 'client.mk') { if ($fileName eq 'client.mk') {
$search = '^MOZ_CO_TAG\s+=\s+' . $branchTag . '$'; %searchReplace = (
$replace = 'MOZ_CO_TAG = ' . $releaseTag; '^MOZ_CO_TAG\s+=\s+' . $branchTag . '$' =>
'MOZ_CO_TAG = ' . $releaseTag,
'^NSPR_CO_TAG\s+=\s+\w*' =>
'NSPR_CO_TAG = ' . $releaseTag,
'^NSS_CO_TAG\s+=\s+\w*' =>
'NSS_CO_TAG = ' . $releaseTag,
'^LOCALES_CO_TAG\s+=\s+' . $branchTag . '$' =>
'LOCALES_CO_TAG = ' . $releaseTag,
'^LDAPCSDK_CO_TAG\s+=\s+' . $branchTag . '$' =>
'LDAPCSDK_CO_TAG = ' . $releaseTag);
} elsif ($fileName eq $moduleVer) { } elsif ($fileName eq $moduleVer) {
$preVersion = $version . 'pre'; $preVersion = $version . 'pre';
$search = '^WIN32_MODULE_PRODUCTVERSION_STRING=' . $preVersion . '$'; %searchReplace = ('^WIN32_MODULE_PRODUCTVERSION_STRING=' .
$replace = 'WIN32_MODULE_PRODUCTVERSION_STRING=' . $version; $preVersion . '$' => 'WIN32_MODULE_PRODUCTVERSION_STRING=' .
$version);
} elsif ($fileName eq $versionTxt) { } elsif ($fileName eq $versionTxt) {
$preVersion = $version . 'pre'; $preVersion = $version . 'pre';
$search = '^' . $preVersion . '$'; %searchReplace = ('^' . $preVersion . '$' => $version);
$replace = $version;
} elsif ($fileName eq $milestoneTxt) { } elsif ($fileName eq $milestoneTxt) {
$preVersion = $milestone . 'pre'; $preVersion = $milestone . 'pre';
$search = '^' . $preVersion . '$'; %searchReplace = ('^' . $preVersion . '$' => $milestone);
$replace = $milestone;
} else { } else {
die("ASSERT: do not know how to bump file $fileName"); die("ASSERT: do not know how to bump file $fileName");
} }
if (scalar(keys(%searchReplace)) <= 0) {
die("ASSERT: no search/replace to perform");
}
open(INFILE, "< $file") or die("Could not open $file: $!"); open(INFILE, "< $file") or die("Could not open $file: $!");
open(OUTFILE, "> $file.tmp") or die("Could not open $file.tmp: $!"); open(OUTFILE, "> $file.tmp") or die("Could not open $file.tmp: $!");
while(<INFILE>) { while(<INFILE>) {
if($_ =~ /$search/) { foreach my $search (keys(%searchReplace)) {
$this->Log(msg => "$search found"); my $replace = $searchReplace{$search};
$found = 1; if($_ =~ /$search/) {
$_ =~ s/$search/$replace/; $this->Log(msg => "$search found");
$this->Log(msg => "$search replaced with $replace"); $found = 1;
$_ =~ s/$search/$replace/;
$this->Log(msg => "$search replaced with $replace");
}
} }
print OUTFILE $_; print OUTFILE $_;
@ -126,7 +142,8 @@ sub Execute {
close INFILE or die("Could not close $file: $!"); close INFILE or die("Could not close $file: $!");
close OUTFILE or die("Coule not close $file.tmp: $!"); close OUTFILE or die("Coule not close $file.tmp: $!");
if (not $found) { if (not $found) {
die("No " . $search . " found in file $file: $!"); die("None of " . join(keys(%searchReplace)) .
" found in file $file: $!");
} }
if (not move("$file.tmp", if (not move("$file.tmp",