Bug 299 populateziptemplate.pl aborts if it cannot determine the license for a source component
Changed so that even if it encounters an error it will still generate the output file before it exits with a failure error code.
--- a/common/tools/populateziptemplate.pl Mon Aug 24 17:51:03 2009 +0100
+++ b/common/tools/populateziptemplate.pl Tue Aug 25 11:06:23 2009 +0100
@@ -33,7 +33,7 @@
}
# Load CSV
-open my $csvText, "<", $sourcesCSV or die;
+open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
my $csv = Text::CSV->new();
my @keys;
my @packages;
@@ -71,6 +71,8 @@
my $zipConfig = $xml->XMLin($template, keyattr => $keyAttr);
my @allRndFiles;
+my $failures = 0;
+
# For each package in CSV...
foreach my $package (@packages)
{
@@ -140,7 +142,8 @@
}
else
{
- die "Cannot determine license for '$package->{source}'";
+ warn "Cannot determine license for '$package->{source}'\n";
+ $failures++;
}
}
@@ -154,3 +157,5 @@
open my $fh, ">", $rndExcludes or die "Cannot write exlude file!";
print $fh @allRndFiles;
close $fh;
+
+exit($failures);