preed%mozilla.com 0ec3c21d6c Bug 371350: Fix various Bootstrap regressions:
In Step.pm
-- Use RunShellCommand() for chdir() handling.
-- Use RunShellCommand() for timeout handling.
-- Fix the signal name/number madness (fallout from the patch for bug 372583).
-- Re-ordered the use statements
-- add a "dumpLogs" config variable that will cause shell statements to be echo'd this is in prep for buildbot deployment of automation.

In Stage.pm:
-- Clean up/add a bunch of comments
-- Cleanup prestage-trimmed using shipped-locales as a basis for the cleanup
-- Run groom-files for mars afterwards
-- Create a stage-unsigned and stage-signed directory
-- Remove unknown directories (that we don't know how to handle) from prestage-trimmed
-- chown() all deliverables to the right group
-- Point the Verify() function at the copy of shipped-locales that the step checked out
-- Handle all of the ja/ja-JP-mac via the shipped-locales logic

Config.pm
-- Make sure Get() and Exists() assert if var is not passed
-- Fix a Get() bug where it would die with no such config variables if the actual variable evaluated to false

r=rhelmer.


git-svn-id: svn://10.0.0.236/trunk@221630 18797224-902f-48f8-a5cc-f745e15eee43
2007-03-09 21:20:05 +00:00

75 lines
1.4 KiB
Perl

#
# Config object for release automation
#
package Bootstrap::Config;
use strict;
# shared static config
my %config;
# single shared instance
my $singleton = undef;
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
return $singleton if defined $singleton;
my $this = {};
bless($this, $class);
$this->Parse();
$singleton = $this;
return $this;
}
sub Parse {
my $this = shift;
open (CONFIG, "< bootstrap.cfg")
|| die("Can't open config file bootstrap.cfg");
while (<CONFIG>) {
chomp; # no newline
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length; # anything left?
my ($var, $value) = split(/\s*=\s*/, $_, 2);
$config{$var} = $value;
}
close CONFIG;
}
sub Get {
my $this = shift;
my %args = @_;
my $var = $args{'var'};
die "ASSERT: Bootstep::Config::Get(): null var requested" if (not
defined($args{'var'}));
if ($this->Exists(var => $var)) {
return $config{$var};
} else {
die("No such config variable: $var\n");
}
}
sub Exists {
my $this = shift;
my %args = @_;
die "ASSERT: Bootstep::Config::Exists(): null var requested" if (not
defined($args{'var'}));
my $var = $args{'var'};
return exists($config{$var});
}
1;