common/tools/populateziptemplate.pl
changeset 461 874d24067366
parent 456 1ba3c86ebec0
child 484 5efa4ed4b4f8
equal deleted inserted replaced
460:fda39efc6eb8 461:874d24067366
    24 # TODO: Use a proper option parsing module
    24 # TODO: Use a proper option parsing module
    25 my $sourcesCSV = shift or die "First arg must be source csv file";
    25 my $sourcesCSV = shift or die "First arg must be source csv file";
    26 my $template = shift or die "Second arg must be template file";
    26 my $template = shift or die "Second arg must be template file";
    27 my $ftl = shift or die "Third arg must be output file";
    27 my $ftl = shift or die "Third arg must be output file";
    28 my $rndExcludes = shift or die "Fourth arg must be rnd-excludes file";
    28 my $rndExcludes = shift or die "Fourth arg must be rnd-excludes file";
    29 my $nosource = shift;
       
    30 if(defined $nosource && $nosource !~ m/--nosource/i)
       
    31 {
       
    32   die "fifth argument can only be \'--nosource\'";
       
    33 }
       
    34 
    29 
    35 # Load CSV
    30 # Load CSV
    36 open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
    31 open my $csvText, "<", $sourcesCSV or die "Unable to open sources.csv from $sourcesCSV";
    37 my $csv = Text::CSV->new();
    32 my $csv = Text::CSV->new();
    38 my @keys;
    33 my @keys;
    77 {
    72 {
    78 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
    73 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
    79 	$package->{dst} =~ s{^/}{}g;
    74 	$package->{dst} =~ s{^/}{}g;
    80 	if ($package->{source} =~ m{/(sfl|oss)/(MCL|FCL)/sf/([^/]+)/([^/]+)})
    75 	if ($package->{source} =~ m{/(sfl|oss)/(MCL|FCL)/sf/([^/]+)/([^/]+)})
    81 	{
    76 	{
    82 		if(!defined $nosource)
       
    83   	{
       
    84   		push @{$zipConfig->{config}->{config}->{src}->{config}->{$1}->{config}},
    77   		push @{$zipConfig->{config}->{config}->{src}->{config}->{$1}->{config}},
    85   		{
    78   		{
    86   			set =>
    79   			set =>
    87   			[
    80   			[
    88   				{
    81   				{
    93   					name => "include",
    86   					name => "include",
    94   					value => "$package->{dst}/**",
    87   					value => "$package->{dst}/**",
    95   				},
    88   				},
    96   			]
    89   			]
    97   		};
    90   		};
    98   	}	
       
    99 	}
    91 	}
   100 	elsif ($package->{source} =~ m{/rnd/([^/]+)/([^/]+)})
    92 	elsif ($package->{source} =~ m{/rnd/([^/]+)/([^/]+)})
   101 	{
    93 	{
   102 		# RnD repository
    94 		# RnD repository
   103 		my $licenseType = $1;
    95 		my $licenseType = $1;