Skip to content

Instantly share code, notes, and snippets.

@rail
Created January 12, 2012 20:45
Show Gist options
  • Save rail/1602986 to your computer and use it in GitHub Desktop.
Save rail/1602986 to your computer and use it in GitHub Desktop.
diff -u b/MozAUSLib.pm b/MozAUSLib.pm
--- b/MozAUSLib.pm
+++ b/MozAUSLib.pm
@@ -44,6 +44,7 @@
use Cwd;
use File::Path;
+use File::Basename;
use File::Copy qw(move copy);
use English;
@@ -64,7 +65,7 @@
GetSnippetDirFromChannel
CachedHashFile
$OBJDIR
- PreopulateHashCache
+ PrepopulateHashCache
);
use strict;
@@ -130,7 +131,7 @@
$SNIPPET_CHECKSUM_HASH_CACHE = {};
-sub PreopulateHashCache {
+sub PrepopulateHashCache {
my %args = @_;
my $config = $args{'config'};
my $startdir = getcwd();
@@ -173,7 +174,8 @@
my ($hash, $hash_type, $size, $fname) = split /\s/, $line;
$hash_type = uc($hash_type);
my $file = undef;
- if ($fname =~ m/partial.mar$/){
+ if ($fname =~ m/partial.mar$/ &&
+ basename($fname) eq basename($partial_mar_path)){
$file = $partial_mar_path;
} elsif ($fname =~ m/complete.mar$/){
$file = $complete_mar_path;
@@ -197,6 +199,7 @@
close F;
}
}
+ chdir($startdir);
# print Data::Dumper::Dumper($SNIPPET_CHECKSUM_HASH_CACHE);
}
diff -u b/patcher2.pl b/patcher2.pl
--- b/patcher2.pl
+++ b/patcher2.pl
@@ -62,7 +62,7 @@
GetSnippetDirFromChannel
CachedHashFile
$OBJDIR
- PreopulateHashCache);
+ PrepopulateHashCache);
use MozBuild::Util qw(MkdirWithPath RunShellCommand DownloadFile);
@@ -129,29 +129,25 @@
my $startdir = getcwd();
my $deliverableDir = EnsureDeliverablesDir(config => $config);
- #printf("PRE-REMOVE-BROKEN-UPDATES:\n\n%s", Data::Dumper::Dumper($config));
- if (!$config->useChecksums()){
- # TODO: touch mars and use this?
- $config->RemoveBrokenUpdates();
- }
- #printf("POST-REMOVE-BROKEN:\n\n%s", Data::Dumper::Dumper($config));
-
BuildTools(config => $config, fromHg => 0) if $config->RequestedStep('build-tools');
BuildTools(config => $config, fromHg => 1) if $config->RequestedStep('build-tools-hg');
run_download_complete_patches(config => $config) if $config->RequestedStep('download');
+ if ($config->useChecksums()) {
+ PrepopulateHashCache(config => $config);
+ }
+ #printf("PRE-REMOVE-BROKEN-UPDATES:\n\n%s", Data::Dumper::Dumper($config));
+ $config->RemoveBrokenUpdates();
+ #printf("POST-REMOVE-BROKEN:\n\n%s", Data::Dumper::Dumper($config));
- if (! $config->useChecksums() && $config->RequestedStep('create-patches')) {
- CreatePartialPatches(config => $config);
- CreateCompletePatches(config => $config);
+ if ($config->RequestedStep('create-patches')) {
+ if (!$config->useChecksums()) {
+ CreatePartialPatches(config => $config);
+ CreateCompletePatches(config => $config);
+ }
}
if ($config->RequestedStep('(create-patches|create-patchinfo)')) {
- if ($config->useChecksums()){
- PreopulateHashCache(config => $config);
- chdir($startdir);
- $config->RemoveBrokenUpdates();
- }
CreatePartialPatchinfo(config => $config);
CreateCompletePatchinfo(config => $config);
CreatePastReleasePatchinfo(config => $config);
@@ -192,8 +188,7 @@
Only applicable when in "create-patches" mode
--tools-revision=TAG Specify tag to use for build-tools checkout
Only applicable when in "build-tools" mode
---use-checksums Try to use checksums files instead of complete
- MAR files.
+--use-checksums Use checksums files instead of MAR files.
__END_USAGE__
exit($exitCode) if (defined($exitCode));
@@ -365,20 +360,16 @@
platform => $p,
version => $r,
locale => $l);
+ my $output_filename = $MozAUSConfig::DEFAULT_MAR_NAME;
+ if ($config->useChecksums()){
+ $output_filename = $MozAUSConfig::DEFAULT_CHECKSUMS_NAME;
+ }
my $output_filename = SubstitutePath(
- path => $MozAUSConfig::DEFAULT_MAR_NAME,
+ path => $output_filename,
platform => $p,
locale => $l,
version => $r,
app => lc($config->GetApp()));
- if ($config->useChecksums()){
- $output_filename = SubstitutePath(
- path => $MozAUSConfig::DEFAULT_CHECKSUMS_NAME,
- platform => $p,
- locale => $l,
- version => $r,
- app => lc($config->GetApp()));
- }
next if -e $output_filename;
$i++;
@@ -824,7 +815,6 @@
$complete_patch->{'info_path'} = catfile($aus_prefix,
'complete.txt');
- # Go to next iteration if this partial patch already exists.
next if ( -e $complete_patch->{'info_path'} or
(! $config->useChecksums() && ! -e $complete_pathname ) );
$i++;
@@ -1349,7 +1339,6 @@
$partial_patch->{'info_path'} = catfile($aus_prefix,
'partial.txt');
- # Go to next iteration if this partial patch already exists.
next if ( -e $partial_patch->{'info_path'} or
(! $config->useChecksums() && ! -e $snippetPathname) );
$i++;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment