common/tools/populateziptemplate.pl
changeset 388 2ab990de5a23
parent 380 d4dac57985d9
child 455 bb24766fdbdc
equal deleted inserted replaced
387:1c8af9baa8a7 388:2ab990de5a23
    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 
    73 my $miscCount = 0;
    74 my $failures = 0;
       
    75 
    74 
    76 # For each package in CSV...
    75 # For each package in CSV...
    77 foreach my $package (@packages)
    76 foreach my $package (@packages)
    78 {
    77 {
    79 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
    78 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
   140 		print FILE @files;
   139 		print FILE @files;
   141 		close FILE;
   140 		close FILE;
   142 	}
   141 	}
   143 	else
   142 	else
   144 	{
   143 	{
   145 		warn "Cannot determine license for '$package->{source}'\n";
   144 		(my $dest2 = $package->{dst}) =~ s{[\\/]}{_slash_}g;
   146 		$failures++;
   145 		push @{$zipConfig->{config}->{config}->{src}->{config}->{misc}->{config}},
       
   146 		{
       
   147 			set =>
       
   148 			[
       
   149 				{
       
   150 					name => "name",
       
   151 					value=> "src_misc_$dest2"."_$miscCount",
       
   152 				},
       
   153 				{
       
   154 					name => "include",
       
   155 					value => "$package->{dst}/**",
       
   156 				},
       
   157 			]
       
   158 		};
       
   159 		$miscCount++;
       
   160 		warn "Warning: Cannot determine license for '$package->{source}' - it will be packaged as 'src_misc_$dest2"."_$miscCount'\n";
   147 	}
   161 	}
   148 }
   162 }
   149 
   163 
   150 # Turn the RnD source inclusion lists into a binary exclusion list
   164 # Turn the RnD source inclusion lists into a binary exclusion list
   151 my @excludes = map { {name => "exclude", value => "$_"} } @allRndFiles;
   165 my @excludes = map { {name => "exclude", value => "$_"} } @allRndFiles;
   156 # Output all rnd files into exclude list for later
   170 # Output all rnd files into exclude list for later
   157 open my $fh, ">", $rndExcludes or die "Cannot write exlude file!";
   171 open my $fh, ">", $rndExcludes or die "Cannot write exlude file!";
   158 print $fh @allRndFiles;
   172 print $fh @allRndFiles;
   159 close $fh;
   173 close $fh;
   160 
   174 
   161 exit($failures);