From b372bebb9a3c14c8863d33a754582ff649aa730f Mon Sep 17 00:00:00 2001 From: "ccooper%deadsquid.com" Date: Fri, 4 Jan 2008 17:56:38 +0000 Subject: [PATCH] b=391358 r=mozpreed - use make_incremental_updates.py --- tools/patcher/MozAUSConfig.pm | 3 ++- tools/patcher/MozAUSLib.pm | 3 +++ tools/patcher/patcher2.pl | 48 +++++++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/tools/patcher/MozAUSConfig.pm b/tools/patcher/MozAUSConfig.pm index 0a1de912857..f6c04ffef84 100644 --- a/tools/patcher/MozAUSConfig.pm +++ b/tools/patcher/MozAUSConfig.pm @@ -113,7 +113,7 @@ sub ProcessCommandLineArgs Getopt::Long::GetOptions(\%args, 'help|h|?', 'man', 'version', 'app=s', 'config=s', 'verbose', 'dry-run', 'tools-dir=s', 'download-dir=s', 'deliverable-dir=s', - 'tools-revision=s', @RUN_MODES) + 'tools-revision=s', 'partial-patchlist-file=s', @RUN_MODES) or return 0; $this->{'mConfigFilename'} = defined($args{'config'}) ? $args{'config'} : @@ -127,6 +127,7 @@ sub ProcessCommandLineArgs $args{'mDownloadDir'} : $DEFAULT_DOWNLOAD_DIR; $this->{'mDeliverableDir'} = defined($args{'mDeliverableDir'}) ? $args{'mDeliverableDir'} : $DEFAULT_DELIVERABLE_DIR; + $this->{'mPartialPatchlistFile'} = defined($args{'partial-patchlist-file'}) ? $args{'partial-patchlist-file'} : undef; # Is this a dry run, and we'll just print what we *would* do? $this->{'dryRun'} = defined($args{'dryRun'}) ? 1 : 0; diff --git a/tools/patcher/MozAUSLib.pm b/tools/patcher/MozAUSLib.pm index 2722141f5c3..0273623b045 100644 --- a/tools/patcher/MozAUSLib.pm +++ b/tools/patcher/MozAUSLib.pm @@ -71,6 +71,7 @@ use strict; use vars qw($MAR_BIN $MBSDIFF_BIN $MAKE_BIN $INCREMENTAL_UPDATE_BIN $UNWRAP_FULL_UPDATE_BIN + $FAST_INCREMENTAL_UPDATE_BIN $TMPDIR_PREFIX %BOUNCER_PLATFORMS %AUS2_PLATFORMS $DEFAULT_PARTIAL_MAR_OUTPUT_FILE @@ -81,6 +82,7 @@ $MAR_BIN = 'dist/host/bin/mar'; $MBSDIFF_BIN = 'dist/host/bin/mbsdiff'; $INCREMENTAL_UPDATE_BIN = 'tools/update-packaging/make_incremental_update.sh'; +$FAST_INCREMENTAL_UPDATE_BIN = 'tools/update-packaging/make_incremental_updates.py'; $UNWRAP_FULL_UPDATE_BIN = 'tools/update-packaging/unwrap_full_update.pl'; $MAKE_BIN = '/usr/bin/make'; @@ -161,6 +163,7 @@ sub ValidateToolsDirectory return (-d $binPrefix and -x "$binPrefix/$MAR_BIN" and -x "$binPrefix/$MBSDIFF_BIN" and + -x "$binPrefix/$FAST_INCREMENTAL_UPDATE_BIN" and -x "$binPrefix/$INCREMENTAL_UPDATE_BIN" and -x "$binPrefix/$UNWRAP_FULL_UPDATE_BIN"); } diff --git a/tools/patcher/patcher2.pl b/tools/patcher/patcher2.pl index 53bcc1386fd..d91ed5a6b88 100755 --- a/tools/patcher/patcher2.pl +++ b/tools/patcher/patcher2.pl @@ -95,6 +95,7 @@ sub main { PrintUsage(exitCode => 1) if ($config eq undef); + if (not $config->RequestedStep('build-tools') and not ValidateToolsDirectory(toolsDir => $config->GetToolsDir())) { my $badDir = $config->GetToolsDir(); @@ -467,11 +468,17 @@ sub CreateCompletePatches { return $i; } # create_complete_patches - sub CreatePartialPatches { my %args = @_; my $config = $args{'config'}; + my $useFastPatcher = defined($config->{'mPartialPatchlistFile'}); + if ($useFastPatcher) { + print STDERR "fast patcher on!\n"; + open(PARTIAL_PATCHLIST_FILE, ">$config->{'mPartialPatchlistFile'}") + or die "open() of $config->{'mPartialPatchlistFile'} failed: $!"; + } + my $update = $config->GetCurrentUpdate(); my $total = 0; @@ -532,6 +539,15 @@ sub CreatePartialPatches { if ( -f $from_path and -f $to_path and ! -e $partial_pathname ) { + + if ($useFastPatcher) { + $partial_pathname =~ m/^(.*)\/[^\/]*$/g; + print PARTIAL_PATCHLIST_FILE + getcwd() . '/' . $from_path . ',' . getcwd() . '/' + . $to_path . ',' . getcwd() . '/' . + $partial_pathname . ',' . + Data::Dumper::Dumper($forcedUpdateList); + } else { my $start_time = time(); PrintProgress(total => $total, current => $i, @@ -548,7 +564,7 @@ sub CreatePartialPatches { die 'Partial mar creation failed (see error above?); ' . 'aborting.'; } - + print $partial_pathname."\n\n"; # rename partial.mar to the expected result $partial_pathname =~ m/^(.*)\/[^\/]*$/g; my $partial_pathname_parent = $1; @@ -562,20 +578,36 @@ sub CreatePartialPatches { printf("done (" . $total_time . "s)\n"); } - - #last if $i > 2; - #$i++; - select(undef, undef, undef, 0.5); } - #last; } - #last; + } } #printf("%s", Data::Dumper::Dumper($u_config)); chdir($startdir); + if ($useFastPatcher) { + close(PARTIAL_PATCHLIST_FILE); + # -u turns of output buffering so we get real-time updates + + my $fastIncrementalUpdateBinary = + catfile($config->GetToolsDir(), 'mozilla', + $MozAUSLib::FAST_INCREMENTAL_UPDATE_BIN); + + my $args = ['-u', $fastIncrementalUpdateBinary, '-f', + $config->{'mPartialPatchlistFile'}]; + + my $rv = RunShellCommand(command => 'python', + args => $args, + output => 1); + + if ($rv->{'exitValue'} != 0) { + die "FAILED: make_incremental_updates.py: $rv->{'exitValue'}, " . + "output: $rv->{'output'}\n"; + } + } + if (defined($total)) { printf("\n"); }