Ignore:
Timestamp:
27/03/2009 23:50:30 (3 years ago)
Author:
chris
Message:

Allow substitutions and removing private sections for distribution in
.in files. Simplify code a little and improve comments.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/infrastructure/makedistribution.pl.in

    r2368 r2470  
    88 
    99# other extensions which need text copying, just to remove the private stuff 
    10 my %text_files = ('txt' => 1, 'spec' => 1); 
     10# .in is included here, as these could be any kind of source, but clearly 
     11# they have text substitutions run on them by autoconf, so we can too :) 
     12my %text_files = ('txt' => 1, 'spec' => 1, 'in' => 1); 
    1113 
    1214# files which don't get the license added 
     
    190192        if(exists $comment_chars{$ext} && !exists $no_license{$fn} && $license_in_dir) 
    191193        { 
    192                 my $b = $comment_chars{$ext}; 
    193  
    194194                # copy as text, inserting license 
     195                # print "source copy $fn to $base_name/$dst_fn\n"; 
     196 
    195197                my $in = gensym; 
    196198                open $in,$fn; 
     
    205207                 
    206208                # write license 
     209                my $b = $comment_chars{$ext}; 
    207210                for(@license) 
    208211                { 
     
    226229                close $in; 
    227230        } 
     231        elsif(exists $text_files{$ext}) 
     232        { 
     233                # copy this as text, to remove private stuff 
     234                # print "text copy $fn to $base_name/$dst_fn\n"; 
     235 
     236                my $in = gensym; 
     237                open $in,$fn; 
     238                open OUT,">$base_name/$dst_fn"; 
     239 
     240                while(<$in>) 
     241                { 
     242                        unless(skip_non_applicable_section($_, $in, $fn)) 
     243                        { 
     244                                print OUT 
     245                        } 
     246                }        
     247 
     248                close OUT; 
     249                close $in; 
     250        } 
    228251        else 
    229252        { 
    230                 if(exists $text_files{$ext}) 
    231                 { 
    232                         # copy this as text, to remove private stuff 
    233                         my $in = gensym; 
    234                         open $in,$fn; 
    235                         open OUT,">$base_name/$dst_fn"; 
    236  
    237                         while(<$in>) 
    238                         { 
    239                                 unless(skip_non_applicable_section($_, $in, $fn)) 
    240                                 { 
    241                                         print OUT 
    242                                 } 
    243                         }        
    244  
    245                         close OUT; 
    246                         close $in; 
    247                 } 
    248                 else 
    249                 { 
    250                         # copy as binary 
    251                         system 'cp',$fn,"$base_name/$dst_fn" 
    252                 } 
     253                # copy as binary 
     254                # print "binary copy $fn to $base_name/$dst_fn\n"; 
     255                system 'cp',$fn,"$base_name/$dst_fn" 
    253256        } 
    254257         
Note: See TracChangeset for help on using the changeset viewer.