Ignore:
Timestamp:
08/03/2010 21:28:01 (2 years ago)
Author:
chris
Message:

Merge [2596] [2599] [2600] from trunk into 0.11rc7, implements license
change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/RELEASE/0.11rc7/infrastructure/makedistribution.pl.in

    r2573 r2657  
    1313 
    1414# files which don't get the license added 
    15 my %no_license = (); # 'filename' => 1 
     15# my %file_license = (); # 'filename' => 'GPL', 'DUAL' or 'none' 
    1616 
    1717# ---------------------------------------------- 
    1818 
    1919# filled in from the manifest file 
    20 my %no_license_dir = (); 
     20# my %dir_license = (); # 'dir' => 'GPL', 'DUAL' or 'none' 
     21# 
     22# most recently specified LICENSE become default until overridden 
     23my $current_license; # 'GPL', 'DUAL' or 'none' 
    2124 
    2225# distribution name 
     
    6972mkdir $base_name,0755; 
    7073 
    71 # get license file 
    72 open LICENSE,"$dist_root/LICENSE.txt" or die "Can't open $dist_root/LICENSE.txt"; 
    73 my $license_f; 
    74 read LICENSE,$license_f,100000; 
    75 close LICENSE; 
    76 my @license = ('distribution '.$base_name.' (svn version: '.$svnversion.')',split(/\n/,$license_f)); 
     74# get license files 
     75my %license_text; # name of license => array of lines of license text 
     76foreach my $license ("GPL", "DUAL") 
     77{ 
     78        my $file = "./LICENSE-$license.txt"; 
     79        open LICENSE, $file or die "Can't open $file: $!"; 
     80        my @lines = <LICENSE>; 
     81        close LICENSE; 
     82        unshift @lines, "distribution $base_name (svn version: $svnversion)\n"; 
     83        $license_text{$license} = \@lines; 
     84} 
    7785 
    7886# copy files, make a note of all the modules included 
     
    8997                next unless $line =~ m/\S/; 
    9098                chomp $line; 
    91                 my ($src,$dst,$other) = split /\s+/, $line; 
     99                my @words = split /\s+/, $line; 
     100                my ($src,$dst,$other) = @words; 
    92101                $dst = $src if $dst eq ''; 
    93102                if($src eq 'MKDIR') 
     
    96105                        mkdir "$base_name/$dst",0755; 
    97106                } 
    98                 elsif($src eq 'NO-LICENSE-IN-DIR') 
    99                 { 
    100                         my ($junk,$spec) = split /\s+/, $line; 
    101                         # record that this directory shouldn't have the license added 
    102                         $no_license_dir{$dst} = 1; 
    103  
    104                         # actually copy it, to remove redundancy in manifests 
    105                         $src = $dst; 
    106                         $dst = $other; 
    107                         $dst = $src if $dst eq ''; 
    108                         $modules_included{$spec} = 1; 
    109                         copy_dir($src,$dst); 
     107                elsif($src eq 'LICENSE') 
     108                { 
     109                        $current_license = $dst; 
    110110                } 
    111111                elsif($src eq 'REPLACE-VERSION-IN') 
    112112                { 
    113113                        replace_version_in($dst); 
    114                 } 
    115                 elsif($src eq 'NO-LICENSE') 
    116                 { 
    117                         $no_license{$dst} = 1; 
    118  
    119                         # actually copy it, to remove redundancy in manifests 
    120                         $src = $dst; 
    121                         $dst = $other; 
    122                         $dst = $src if $dst eq ''; 
    123  
    124                         copy_file($src,$dst); 
    125114                } 
    126115                elsif($src eq 'RUN') 
     
    190179        my $ext; 
    191180        $ext = $1 if $fn =~ m/\.(\w+)\Z/; 
    192          
    193         # licenses not used in this directory? 
    194         my $license_in_dir = 1; 
    195181        $dst_fn =~ m~\A(.+)/[^/]+?\Z~; 
    196         $license_in_dir = 0 if exists $no_license_dir{$1}; 
    197182         
    198183        # licensed or not? 
    199         if(exists $comment_chars{$ext} && !exists $no_license{$fn} && $license_in_dir) 
     184        if(exists $comment_chars{$ext} && $current_license ne "none") 
    200185        { 
    201186                # copy as text, inserting license 
     
    215200                # write license 
    216201                my $b = $comment_chars{$ext}; 
    217                 for(@license) 
    218                 { 
    219                         print OUT $b,$_,"\n" 
     202                my $this_license = $license_text{$current_license}; 
     203                for (@$this_license) 
     204                { 
     205                        print OUT $b, $_; 
    220206                } 
    221207                 
Note: See TracChangeset for help on using the changeset viewer.