common/tools/mergeXML.pl
changeset 1272 26a71d6a561e
parent 814 11c237c9ad00
equal deleted inserted replaced
1271:77ff148fa4d2 1272:26a71d6a561e
    24 use XML::Printer;
    24 use XML::Printer;
    25 
    25 
    26 # Read option arguments
    26 # Read option arguments
    27 my $howtoString;
    27 my $howtoString;
    28 my $xslLink;
    28 my $xslLink;
       
    29 my $sortByTime;
    29 my $help;
    30 my $help;
    30 GetOptions((
    31 GetOptions((
    31 	'xsl=s' => \$xslLink,
    32 	'xsl=s' => \$xslLink,
    32 	'merge=s' => \$howtoString,
    33 	'merge=s' => \$howtoString,
       
    34 	'sortByTime!' => \$sortByTime,
    33 	'help!' => \$help,
    35 	'help!' => \$help,
    34 ));
    36 ));
    35 
    37 
    36 my $wrongArgs = 0;
    38 my $wrongArgs = 0;
    37 unless ($help)
    39 unless ($help)
    57 	$mergeTags->{$tag} = $attribute;
    59 	$mergeTags->{$tag} = $attribute;
    58 }
    60 }
    59 
    61 
    60 # Expand wildcards
    62 # Expand wildcards
    61 @ARGV = map { glob $_ } @ARGV;
    63 @ARGV = map { glob $_ } @ARGV;
       
    64 if ($sortByTime)
       
    65 {
       
    66 	# Sort by creation time (this helps the BRAG merging put the phases & steps in the right build sequence)
       
    67 	@ARGV = sort { (stat($a))[10] <=> (stat($b))[10] } @ARGV;
       
    68 }
    62 
    69 
    63 # Merge all the trees together
    70 # Merge all the trees together
    64 my $outTree = mergeMultipleTrees($mergeTags, @ARGV);
    71 my $outTree = mergeMultipleTrees($mergeTags, @ARGV);
    65 
    72 
    66 # Output total tree
    73 # Output total tree