common/tools/populateziptemplate.pl
changeset 380 d4dac57985d9
parent 372 ea854a4b723d
child 388 2ab990de5a23
equal deleted inserted replaced
379:1d777b8357df 380:d4dac57985d9
    31 {
    31 {
    32   die "fifth argument can only be \'--nosource\'";
    32   die "fifth argument can only be \'--nosource\'";
    33 }
    33 }
    34 
    34 
    35 # Load CSV
    35 # Load CSV
    36 open my $csvText, "<", $sourcesCSV or die;
    36 open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
    37 my $csv = Text::CSV->new();
    37 my $csv = Text::CSV->new();
    38 my @keys;
    38 my @keys;
    39 my @packages;
    39 my @packages;
    40 while (my $line = <$csvText>)
    40 while (my $line = <$csvText>)
    41 {
    41 {
    68 my $keyAttr = { config => "name", name => "set"};
    68 my $keyAttr = { config => "name", name => "set"};
    69 # Load template
    69 # Load template
    70 my $xml = XML::Simple->new();
    70 my $xml = XML::Simple->new();
    71 my $zipConfig = $xml->XMLin($template, keyattr => $keyAttr);
    71 my $zipConfig = $xml->XMLin($template, keyattr => $keyAttr);
    72 my @allRndFiles;
    72 my @allRndFiles;
       
    73 
       
    74 my $failures = 0;
    73 
    75 
    74 # For each package in CSV...
    76 # For each package in CSV...
    75 foreach my $package (@packages)
    77 foreach my $package (@packages)
    76 {
    78 {
    77 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
    79 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
   138 		print FILE @files;
   140 		print FILE @files;
   139 		close FILE;
   141 		close FILE;
   140 	}
   142 	}
   141 	else
   143 	else
   142 	{
   144 	{
   143 		die "Cannot determine license for '$package->{source}'";
   145 		warn "Cannot determine license for '$package->{source}'\n";
       
   146 		$failures++;
   144 	}
   147 	}
   145 }
   148 }
   146 
   149 
   147 # Turn the RnD source inclusion lists into a binary exclusion list
   150 # Turn the RnD source inclusion lists into a binary exclusion list
   148 my @excludes = map { {name => "exclude", value => "$_"} } @allRndFiles;
   151 my @excludes = map { {name => "exclude", value => "$_"} } @allRndFiles;
   152 
   155 
   153 # Output all rnd files into exclude list for later
   156 # Output all rnd files into exclude list for later
   154 open my $fh, ">", $rndExcludes or die "Cannot write exlude file!";
   157 open my $fh, ">", $rndExcludes or die "Cannot write exlude file!";
   155 print $fh @allRndFiles;
   158 print $fh @allRndFiles;
   156 close $fh;
   159 close $fh;
       
   160 
       
   161 exit($failures);