common/tools/csvToSysDef.pl
changeset 333 7b0a774a0c87
parent 331 f7c6fc4239ac
child 335 15307a7772ea
equal deleted inserted replaced
332:72ceabdbb597 333:7b0a774a0c87
    59 		$pkgDef =~ s{^/sf/}{};
    59 		$pkgDef =~ s{^/sf/}{};
    60 		$pkgDef =~ s{/[^/]*$}{};
    60 		$pkgDef =~ s{/[^/]*$}{};
    61 		# TODO: Where will this be on the build machine?
    61 		# TODO: Where will this be on the build machine?
    62 		$pkgDef = "$backupBaseDir/$pkgDef/package_definition.xml";
    62 		$pkgDef = "$backupBaseDir/$pkgDef/package_definition.xml";
    63 	}
    63 	}
    64 	die unless -f $pkgDef;
    64 	die "Unable to locate any package_definition at all for $package->{dst}" unless -f $pkgDef;
    65 
    65 
    66 	my $pkgTree = $parser->parsefile($pkgDef) or die;
    66 	my $pkgTree = eval { $parser->parsefile($pkgDef) } or die "Failed to parse $pkgDef : $@";
    67 	if (!$outTree)
    67 	if (!$outTree)
    68 	{
    68 	{
    69 		# The first file is taken verbatim
    69 		# The first file is taken verbatim
    70 		$outTree = $pkgTree;
    70 		$outTree = $pkgTree;
    71 	}
    71 	}
    86 sub mergeTrees
    86 sub mergeTrees
    87 {
    87 {
    88 	my $baseTree = shift or die;
    88 	my $baseTree = shift or die;
    89 	my $extrasTree = shift or die;
    89 	my $extrasTree = shift or die;
    90 
    90 
    91 	die unless ref $baseTree eq ref $extrasTree;
    91 	die ("Package Definitions do not match: ".(ref $baseTree)." vs ".(ref $extrasTree)) unless ref $baseTree eq ref $extrasTree;
    92 	return if ref $baseTree eq "main::Characters";
    92 	return if ref $baseTree eq "main::Characters";
    93 
    93 
    94 	foreach my $extraChild (@{$extrasTree->{Kids}})
    94 	foreach my $extraChild (@{$extrasTree->{Kids}})
    95 	{
    95 	{
    96 		# Work out whether this child should be merged with a namesake, or appended
    96 		# Work out whether this child should be merged with a namesake, or appended