# HG changeset patch # User Simon Howkins # Date 1265737767 0 # Node ID 24ecf67cba71b642894e863c7dc797cf2e533045 # Parent 6c56420d1006030ca0382c1604d6d9a3cb7dfe17 Bug 1661: Improve build speed with better caching strategy Changed the way that the cache is located, so the same code can run on any build machine without any configuration. Made work around for Bug 419 the only option, as we're not using the alternative anyway, and I don't want to commit completely untested code! Changed caching algorithm, to improve build times. diff -r 6c56420d1006 -r 24ecf67cba71 common/build.xml --- a/common/build.xml Mon Feb 08 14:50:19 2010 +0000 +++ b/common/build.xml Tue Feb 09 17:49:27 2010 +0000 @@ -31,8 +31,9 @@ - + + @@ -77,18 +78,8 @@ - + - - - - - - - - - - @@ -357,7 +348,7 @@ - + @@ -365,19 +356,38 @@ - - + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + - + diff -r 6c56420d1006 -r 24ecf67cba71 common/common_props.ant.xml --- a/common/common_props.ant.xml Mon Feb 08 14:50:19 2010 +0000 +++ b/common/common_props.ant.xml Tue Feb 09 17:49:27 2010 +0000 @@ -43,8 +43,8 @@ - - + + @@ -63,7 +63,7 @@ - + diff -r 6c56420d1006 -r 24ecf67cba71 common/templates/source-spec.ant.xml.ftl --- a/common/templates/source-spec.ant.xml.ftl Mon Feb 08 14:50:19 2010 +0000 +++ b/common/templates/source-spec.ant.xml.ftl Tue Feb 09 17:49:27 2010 +0000 @@ -7,84 +7,118 @@ <#assign change_list = "" /> <#assign dollar = "$"/> <#assign count = 0 /> -<#if ("${ant['sf.spec.sourcesync.archive']}")?? && "${ant['sf.spec.sourcesync.archive']}" == "true"> - <#assign fast_sync = true /> -<#else> - <#assign fast_sync = false /> - -<#if ("${ant['sf.spec.sourcesync.bug419']}")?? && "${ant['sf.spec.sourcesync.bug419']}" == "true"> - <#assign bug419 = true /> -<#else> - <#assign bug419 = false /> - <#list data as csv_file> <#list csv_file as pkg_detail> - - - - - - <#if fast_sync && ("${pkg_detail.type}"!="tag") > - - - - - - - - - - - - - - - <#else> - - - - - - - - <#if bug419 > - - - - - - - - - - - - <#else> - - - <#if "${pkg_detail.type}"=="tag" > - - - - - - - - <#if "${pkg_detail.type}"== "changeset" || "${pkg_detail.type}"=="branch"> - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -103,11 +137,7 @@ - <#if fast_sync > - - <#else> - - + @@ -132,7 +162,7 @@ - + ${sync_list} diff -r 6c56420d1006 -r 24ecf67cba71 common/tools/cachefiles.pl --- a/common/tools/cachefiles.pl Mon Feb 08 14:50:19 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -#!/usr/bin/perl - - -use strict; - -#my $cache = "d:/HG_cache/"; -#my $master = "//v800008/Builds01/"; -my $cache = shift @ARGV; -my $csv = shift @ARGV; -my $generated = shift @ARGV; -my @recover; -my @nospace; -my $exitcode = 0; - -if(defined $cache && defined $generated && defined $csv) -{ - print "Cache:$cache\nIn:$csv\nOut:$generated\n"; - - # Format the cache directory path - if ( $cache !~ /(.*)[\\\/]$/ ) - { - $cache .= "/"; - } - - open(IN, "<$csv") or die "Couldn't open $csv for reading"; - open(OUT,">$generated") or die "Couldn't open $generated for writing"; - my $header = ; - print OUT $header; - while( my $line = ) - { - my @args = split(',',$line); - my $repo = shift @args; - my $master = ""; - if ( $repo =~ m/^(.*\/)(.*\/(oss|rnd|sfl)\/.*\/)$/i ) - { - $master = $1; - $repo = $2; - } - if(-d $master.$repo.".hg") - { - # print "Found:\t".$master.$repo.".hg\n"; - my $cmd; - if(-d $cache.$repo.".hg") # update - { - $cmd = "hg pull -R $cache$repo $master$repo"; - } - else #clone - { - #taken from the normal clone script... - my @dirs = split ('\/', $cache.$repo); - my $destdir = pop @dirs; - my $path = ""; - foreach my $dir (@dirs) - { - $path = ($path eq "") ? $dir : "$path/$dir"; - if (!-d $path) - { - mkdir $path; - } - } - - $cmd = "hg clone -U $master$repo $cache$repo"; - } - if(cache($cmd)) - { - print OUT $cache.$repo.",".join(',', @args); - } - else - { - print OUT $master.$repo.",".join(',', @args); - $exitcode = 1; - } - } - else - { - print "Error: cannot find ".$master.$repo.".hg\n"; - $exitcode = 1; - } - } - - close OUT; - close IN; -} -else -{ - print "Usage: "; - $exitcode = 1; -} - -foreach my $line (@recover) -{ - print "WARNING: HG Recover: $line\n"; -} -foreach my $line (@nospace) -{ - print "WARNING: No Space: $line\n"; -} - -exit $exitcode; - -sub cache($cmd) -{ - my $cmd = shift; - print "$cmd\n"; - - open(CMD, "$cmd 2>&1 |") or die "Couldn't execute $cmd"; - while(my $line = ) - { -# print $line; - # parse the output for failures. On fail return 0; - if($line =~ m/abort/i) - { - print $line; - if($line =~ m/hg\s+recover/i) - { - push(@recover, $cmd); - } - elsif($line =~ m/No\s+space/i) - { - push(@nospace, $cmd); - } - close CMD; - return 0; - } - } - close CMD; - return 1; -} \ No newline at end of file