# HG changeset patch # User Shabe Razvi # Date 1266343132 0 # Node ID 1bec8957803b79a4511e14ea6c1367135ca45df4 # Parent ed28a33746f26ceabc35bde38158da2665e1c4d7# Parent 79766bc6c419c876c20e2409b82fc1d500a77379 Merge diff -r ed28a33746f2 -r 1bec8957803b common/build.xml --- a/common/build.xml Tue Feb 16 17:57:06 2010 +0000 +++ b/common/build.xml Tue Feb 16 17:58:52 2010 +0000 @@ -24,14 +24,16 @@ + - + + @@ -76,18 +78,8 @@ - + - - - - - - - - - - @@ -371,25 +363,46 @@ - + + + - - + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + - + diff -r ed28a33746f2 -r 1bec8957803b common/common_props.ant.xml --- a/common/common_props.ant.xml Tue Feb 16 17:57:06 2010 +0000 +++ b/common/common_props.ant.xml Tue Feb 16 17:58:52 2010 +0000 @@ -49,8 +49,8 @@ - - + + @@ -69,7 +69,7 @@ - + diff -r ed28a33746f2 -r 1bec8957803b common/templates/source-spec.ant.xml.ftl --- a/common/templates/source-spec.ant.xml.ftl Tue Feb 16 17:57:06 2010 +0000 +++ b/common/templates/source-spec.ant.xml.ftl Tue Feb 16 17:58:52 2010 +0000 @@ -1,126 +1,165 @@ +<#assign dollar = "$"/> + + + + <#assign fileset = "" /> <#assign sync_list = "" /> <#assign bom_list = "" /> <#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"> - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + - - - - - - - - - - - - <#if fast_sync > - - <#else> - - + + + + + + + + + + + @@ -129,44 +168,35 @@ - - + <#assign fileset = "${fileset}" + "\r\n " /> - <#assign sync_list = "${sync_list}" + "\r\n "/> - <#assign bom_list = "${bom_list}" + "\r\n "/> - <#assign change_list = "${change_list}" + "\r\n "/> + <#assign sync_list = "${sync_list}" + "\r\n "/> + <#assign bom_list = "${bom_list}" + "\r\n "/> + <#assign change_list = "${change_list}" + "\r\n "/> <#assign count = count + 1 /> - + ${fileset} - - - - ${sync_list} - - - - - - - - - - - ${bom_list} - - - - - - - - ${change_list} - - + + + + ${sync_list} + + + + + + + ${bom_list} + + + + ${change_list} + + diff -r ed28a33746f2 -r 1bec8957803b common/tools/cachefiles.pl --- a/common/tools/cachefiles.pl Tue Feb 16 17:57:06 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 diff -r ed28a33746f2 -r 1bec8957803b common/tools/envinfo.pl --- a/common/tools/envinfo.pl Tue Feb 16 17:57:06 2010 +0000 +++ b/common/tools/envinfo.pl Tue Feb 16 17:58:52 2010 +0000 @@ -79,7 +79,7 @@ # Metrowerk Compiler my $mwcc_ver = 'N.A.'; my $mwcc_out = `mwccsym2 -version`; -$mwcc_ver = $1 if ($mwcc_out =~ /^Version (.*) \(Build/m); +$mwcc_ver = $1 if ($mwcc_out =~ /^Version (.*)/m); push @environment_info, {name=>'mwccsym2', version=>$mwcc_ver}; # RVCT 2.2 diff -r ed28a33746f2 -r 1bec8957803b common/tools/findPhysicalDrive.pl --- a/common/tools/findPhysicalDrive.pl Tue Feb 16 17:57:06 2010 +0000 +++ b/common/tools/findPhysicalDrive.pl Tue Feb 16 17:58:52 2010 +0000 @@ -12,23 +12,64 @@ # Contributors: # # Description: -# Find and output the drive letter mapped to the physical volume with the -# largest amount of free space -# +# Search physical drives to find either: +# * The one with the largest amount of free space +# * The one with the greatest capacity +# * The list of all such drives use strict; +use Getopt::Long; + +# Read option arguments +my $option; +my $ok = GetOptions( + 'capacity' => \$option->{capacity}, + 'space' => \$option->{space}, + 'all' => \$option->{all}, + 'help|?' => \$option->{help}, +); + +if (defined $option->{help}) +{ + usage(); + exit; +} + +if (!$ok || @ARGV || 1 != scalar grep { defined $option->{$_} } keys %$option) +{ + warn "Exactly one option must be supplied to indicate the required output\n$ok\n@ARGV\n"; + usage(); + exit(1); +} + # Use Windows command to list physical volumes on the machine # (No substed drives, or mapped network drives) -my @drives = map {chomp;$_} `echo list volume | diskpart`; +my @details = map {chomp;$_} `echo list volume | diskpart`; -my %drives; -for my $driveLine (@drives) +my @drives; +my %space; +my %capacity; +for my $driveLine (@details) { # If this line of output is actually about a healthy HD volume... - if ($driveLine =~ m{^\s+Volume \d+\s+([A-Z]).*?(Partition|RAID-5)\s+\d+ [A-Z]+\s+Healthy} ) + if ($driveLine =~ m{^\s+Volume \d+\s+([A-Z]).*?(Partition|RAID-5)\s+(\d+) ([A-Z]+)\s+Healthy} ) { - my $letter = $1; + my ($letter, $capacityValue, $capacityUnit) = ($1, $3, $4); + + my %multiplier = ( + MB => 1000000, + GB => 1000000000, + TB => 1000000000000, + ); + + if (not exists $multiplier{$capacityUnit}) + { + warn "Don't know how to interpret $capacityValue $capacityUnit\n"; + next; + } + $capacityValue *= $multiplier{$capacityUnit}; + # Ignore the system drive next if ($driveLine =~ m{System\s*$}); @@ -38,14 +79,45 @@ my $bytesFree = $bytesFree[-1]; # Record info for this volume - $drives{$letter} = $bytesFree; + push @drives, $letter; + $space{$bytesFree} = $letter; + $capacity{$capacityValue} = $letter; } } -die "Unable to find any suitable drives at all\n" unless %drives; +die "Unable to find any suitable drives at all\n" unless %space; -# Switch keys and values -%drives = reverse %drives; -# Sort by space to find the volume with the largest amount of space and print out the corresponding letter -print "$drives{(reverse sort keys %drives)[0]}:\n"; +if ($option->{all}) +{ + print join ",", map { "$_:" } @drives; + print "\n"; + exit; +} +elsif ($option->{capacity}) +{ + # Sort by capacity to find the largest volume and print out the corresponding letter + print "$capacity{(reverse sort keys %capacity)[0]}:\n"; +} +elsif ($option->{space}) +{ + # Sort by space to find the volume with the largest amount of space and print out the corresponding letter + print "$space{(reverse sort keys %space)[0]}:\n"; +} +exit; + +sub usage +{ + $0 =~ m{[\\/]([^\\/]*)$}; + print < + +