common/tools/csvToSysDef.pl
changeset 340 aee074ee2646
parent 335 15307a7772ea
child 341 2ba361491037
--- a/common/tools/csvToSysDef.pl	Fri Aug 07 14:59:13 2009 +0100
+++ b/common/tools/csvToSysDef.pl	Fri Aug 07 14:33:52 2009 +0100
@@ -52,16 +52,16 @@
 {
 	# If the sources.csv does not include a sys def for this package, it doesn't get built
 	next unless $package->{sysdef};
-	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
-	# Look for the pkg defn in the root of the package tree
+	# If it's in the "backup" location, use that one (ie our copy overrides the package's own copy)
 	my $pkgDef = "$package->{dst}/$package->{sysdef}";
+	$pkgDef =~ s{^/sf/}{};
+	$pkgDef =~ s{/[^/]*$}{};
+	$pkgDef = "$backupBaseDir/$pkgDef/package_definition.xml";
 	if (!-f $pkgDef)
 	{
-		# Not there, so try the "backup" location
-		$pkgDef =~ s{^/sf/}{};
-		$pkgDef =~ s{/[^/]*$}{};
-		# TODO: Where will this be on the build machine?
-		$pkgDef = "$backupBaseDir/$pkgDef/package_definition.xml";
+		# Not there, so look for the pkg defn in the root of the package tree
+		warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
+		$pkgDef = "$package->{dst}/$package->{sysdef}";
 	}
 	die "Unable to locate any package_definition at all for $package->{dst}" unless -f $pkgDef;
 
@@ -81,10 +81,12 @@
 #print Data::Dumper->Dump([$outTree->[0]], ["tree"]);
 
 # Output total tree
-print "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
+print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
 printTree($outTree->[0]);
 print "\n";
 
+exit;
+
 sub mergeTrees
 {
 	my $baseTree = shift or die;
@@ -161,7 +163,18 @@
 	
 	print "<$tagName";
 
-	foreach my $attr (grep { ! ref $tree->{$_} } keys %$tree)
+	foreach my $attr (
+		sort {
+			my $order = "name long-name tech_domain level span schema levels filter introduced deprecated purpose class plugin origin-model bldFile mrp version priority";
+			my $ixA = index $order, $a;
+			my $ixB = index $order, $b;
+			die "$a $b" if $ixA + $ixB == -2;
+			$ixA - $ixB;
+		}
+		grep {
+			! ref $tree->{$_}
+		}
+		keys %$tree)
 	{
 		print " $attr=\"$tree->{$attr}\"";
 	}