Bug 375332: patcher2 changes required to support beta program; specifically, this allows a way to configure patcher to dump snippets for all a channel in a separate directory, to be staged separately. r=rhelmer.

This commit is contained in:
preed@mozilla.com 2007-04-17 13:53:28 -07:00
parent 10c79b894d
commit 55e2c7c621
3 changed files with 62 additions and 15 deletions

View File

@ -417,6 +417,14 @@ sub CreateUpdateGraph
$u_config->{$u_key}->{'force'} = $u_force;
$u_config->{$u_key}->{'platforms'} = {};
# Add the keys that specify channel-specific snippet directories
foreach my $c (@channels) {
my $testKey = $c . '-dir';
if (exists($u->{$testKey})) {
$u_config->{$u_key}->{$testKey} = $u->{$testKey};
}
}
my $r_config = $this->{'mAppConfig'}->{'release'};
my @releases = keys %$r_config;

View File

@ -59,6 +59,7 @@ require Exporter;
ValidateToolsDirectory
EnsureDeliverablesDir
SubstitutePath
GetSnippetDirFromChannel
);
use strict;
@ -71,7 +72,8 @@ use vars qw($MAR_BIN $MBSDIFF_BIN $MAKE_BIN
$INCREMENTAL_UPDATE_BIN $UNWRAP_FULL_UPDATE_BIN
$TMPDIR_PREFIX
%BOUNCER_PLATFORMS %AUS2_PLATFORMS
$DEFAULT_PARTIAL_MAR_OUTPUT_FILE);
$DEFAULT_PARTIAL_MAR_OUTPUT_FILE
$DEFAULT_SNIPPET_BASE_DIR $DEFAULT_SNIPPET_TEST_DIR);
$MAR_BIN = 'dist/host/bin/mar';
$MBSDIFF_BIN = 'dist/host/bin/mbsdiff';
@ -95,6 +97,9 @@ $TMPDIR_PREFIX = '/dev/shm/tmp/MozAUSLib';
$DEFAULT_PARTIAL_MAR_OUTPUT_FILE = 'partial.mar';
$DEFAULT_SNIPPET_BASE_DIR = 'aus2';
$DEFAULT_SNIPPET_TEST_DIR = $DEFAULT_SNIPPET_BASE_DIR . '.test';
sub EnsureDeliverablesDir
{
my %args = @_;
@ -317,4 +322,29 @@ sub SubstitutePath
return $string;
}
sub GetSnippetDirFromChannel {
my %args = @_;
die 'ASSERT: GetSnippetDirFromChannel(): null/invalid update config ' .
"object\n" if (!exists($args{'config'}) || ref($args{'config'}) ne 'HASH');
die "ASSERT: GetSnippetDirFromChannel(): null channel\n" if (
!exists($args{'channel'}));
my $channel = $args{'channel'};
my $currentUpdateConfig = $args{'config'};
die "ASSERT: GetSnippetDirFromChannel(): invalid update config object\n"
if (! exists($currentUpdateConfig->{'to'}) ||
!exists($currentUpdateConfig->{'from'}));
my $snippetDirTestKey = $channel . '-dir';
if (exists($currentUpdateConfig->{$snippetDirTestKey})) {
return $DEFAULT_SNIPPET_BASE_DIR . '.' .
$currentUpdateConfig->{$snippetDirTestKey};
} elsif ($channel =~ /test(-\w+)?$/) {
return $DEFAULT_SNIPPET_TEST_DIR;
} else {
return $DEFAULT_SNIPPET_BASE_DIR;
}
}
1;

View File

@ -51,12 +51,14 @@ use IO::Handle;
use File::Path;
use File::Copy qw(move copy);
use File::Spec::Functions;
use File::Basename;
use MozAUSConfig;
use MozAUSLib qw(CreatePartialMarFile
GetAUS2PlatformStrings
EnsureDeliverablesDir
ValidateToolsDirectory SubstitutePath);
ValidateToolsDirectory SubstitutePath
GetSnippetDirFromChannel);
use MozBuild::Util qw(MkdirWithPath RunShellCommand DownloadFile HashFile);
@ -73,7 +75,6 @@ use vars qw($PID_FILE
$DEFAULT_HASH_TYPE
$DEFAULT_CVSROOT
$DEFAULT_SCHEMA_VERSION $CURRENT_SCHEMA_VERSION
$SNIPPET_DIR $SNIPPET_TEST_DIR
$ST_SIZE );
$PID_FILE = 'patcher2.pid';
@ -83,9 +84,6 @@ $DEFAULT_CVSROOT = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot';
$DEFAULT_SCHEMA_VERSION = 0;
$CURRENT_SCHEMA_VERSION = 1;
$SNIPPET_DIR = 'aus2';
$SNIPPET_TEST_DIR = $SNIPPET_DIR . '.test';
$ST_SIZE = 7;
sub main {
@ -678,7 +676,10 @@ sub CreateCompletePatchinfo {
my $updateType = $config->GetCurrentUpdate()->{'updateType'};
for my $c (@channels) {
my $aus_prefix = catfile($u, $SNIPPET_DIR,
my $snippetDir = GetSnippetDirFromChannel(
config => $config->GetCurrentUpdate(), channel => $c);
my $aus_prefix = catfile($u, $snippetDir,
$from_aus_app,
$from_aus_version,
$from_aus_platform,
@ -744,8 +745,11 @@ sub CreateCompletePatchinfo {
foreach my $testChan (split(/[\s,]+/,
$u_config->{$u}->{'testchannel'})) {
my $snippetDir = GetSnippetDirFromChannel(
config => $u_config->{$u}, channel => $testChan);
$testPatch->{'info_path'} = catfile($u,
'aus2.test', $from_aus_app,
$snippetDir, $from_aus_app,
$from_aus_version, $from_aus_platform,
$from_aus_buildid, $l, $testChan, 'complete.txt');
@ -891,9 +895,9 @@ sub CreatePastReleasePatchinfo {
my $updateType = $config->GetCurrentUpdate()->{'updateType'};
foreach my $channel (@{$pastUpd->{'channels'}}) {
my $ausDir = ($channel =~ /test(-\w+)?$/)
? $SNIPPET_TEST_DIR : $SNIPPET_DIR;
my $ausDir = GetSnippetDirFromChannel(config =>
$config->GetCurrentUpdate(), channel => $channel);
my $ausPrefix = catfile($prefixStr, $ausDir, $fromAusApp,
$fromAusVersion, $fromAusPlatform,
$fromAusBuildId, $locale,
@ -1053,7 +1057,10 @@ sub CreatePartialPatchinfo {
my $updateType = $u_config->{$u}->{'updateType'};
for my $c (@channels) {
my $aus_prefix = catfile($u, $SNIPPET_DIR,
my $snippetDir = GetSnippetDirFromChannel(config =>
$u_config->{$u}, channel => $c);
my $aus_prefix = catfile($u, $snippetDir,
$from_aus_app,
$from_aus_version,
$from_aus_platform,
@ -1118,8 +1125,11 @@ sub CreatePartialPatchinfo {
foreach my $testChan (split(/[\s,]+/,
$u_config->{$u}->{'testchannel'})) {
my $snippetDir = GetSnippetDirFromChannel(config =>
$u_config->{$u}, channel => $testChan);
$testPatch->{'info_path'} = catfile($u,
'aus2.test', $from_aus_app,
$snippetDir, $from_aus_app,
$from_aus_version, $from_aus_platform,
$from_aus_buildid, $l, $testChan, 'partial.txt');
@ -1162,8 +1172,7 @@ sub write_patch_info {
my $schemaVersion = $args{'schemaVer'} || $DEFAULT_SCHEMA_VERSION;
my $info_path = $patch->{'info_path'};
$info_path =~ m/^(.*)\/[^\/]*$/;
my $info_path_parent = $1;
my $info_path_parent = dirname($patch->{'info_path'});
my $text;
if ($DEFAULT_SCHEMA_VERSION == $schemaVersion) {