common/tools/populateziptemplate.pl
changeset 408 0c558d696e7a
parent 313 52d855dfda13
child 372 ea854a4b723d
equal deleted inserted replaced
407:57a2cac6870f 408:0c558d696e7a
    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 shift and die "No more than four arguments please";
    29 my $nosource = shift;
       
    30 if(defined $nosource && $nosource !~ m/--nosource/i)
       
    31 {
       
    32   die "fifth argument can only be \'--nosource\'";
       
    33 }
    30 
    34 
    31 # Load CSV
    35 # Load CSV
    32 open my $csvText, "<", $sourcesCSV or die;
    36 open my $csvText, "<", $sourcesCSV or die;
    33 my $csv = Text::CSV->new();
    37 my $csv = Text::CSV->new();
    34 my @keys;
    38 my @keys;
    71 foreach my $package (@packages)
    75 foreach my $package (@packages)
    72 {
    76 {
    73 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
    77 	warn "Warning: Package $package->{dst} does not appear on the local system\n" unless -d $package->{dst};
    74 	$package->{dst} =~ s{^/}{}g;
    78 	$package->{dst} =~ s{^/}{}g;
    75 	if ($package->{source} =~ m{/(sfl|oss)/(MCL|FCL)/sf/([^/]+)/([^/]+)})
    79 	if ($package->{source} =~ m{/(sfl|oss)/(MCL|FCL)/sf/([^/]+)/([^/]+)})
    76 	{	    
    80 	{
    77 		push @{$zipConfig->{config}->{config}->{src}->{config}->{$1}->{config}},
    81 		if(!defined $nosource)
    78 		{
    82   	{
    79 			set =>
    83   		push @{$zipConfig->{config}->{config}->{src}->{config}->{$1}->{config}},
    80 			[
    84   		{
    81 				{
    85   			set =>
    82 					name => "name",
    86   			[
    83 					value=> "src_$1_$3_$4",
    87   				{
    84 				},
    88   					name => "name",
    85 				{
    89   					value=> "src_$1_$3_$4",
    86 					name => "include",
    90   				},
    87 					value => "$package->{dst}/**",
    91   				{
    88 				},
    92   					name => "include",
    89 			]
    93   					value => "$package->{dst}/**",
    90 		};
    94   				},
       
    95   			]
       
    96   		};
       
    97   	}	
    91 	}
    98 	}
    92 	elsif ($package->{source} =~ m{/rnd/([^/]+)/([^/]+)})
    99 	elsif ($package->{source} =~ m{/rnd/([^/]+)/([^/]+)})
    93 	{
   100 	{
    94 		# RnD repository
   101 		# RnD repository
    95 		my $name = "binaries_$2";
   102 		my $name = "binaries_$2";