- Timestamp:
- 08/03/2010 21:28:01 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
box/RELEASE/0.11rc7/infrastructure/makedistribution.pl.in
r2573 r2657 13 13 14 14 # files which don't get the license added 15 my %no_license = (); # 'filename' => 1 15 # my %file_license = (); # 'filename' => 'GPL', 'DUAL' or 'none' 16 16 17 17 # ---------------------------------------------- 18 18 19 19 # 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 23 my $current_license; # 'GPL', 'DUAL' or 'none' 21 24 22 25 # distribution name … … 69 72 mkdir $base_name,0755; 70 73 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 75 my %license_text; # name of license => array of lines of license text 76 foreach 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 } 77 85 78 86 # copy files, make a note of all the modules included … … 89 97 next unless $line =~ m/\S/; 90 98 chomp $line; 91 my ($src,$dst,$other) = split /\s+/, $line; 99 my @words = split /\s+/, $line; 100 my ($src,$dst,$other) = @words; 92 101 $dst = $src if $dst eq ''; 93 102 if($src eq 'MKDIR') … … 96 105 mkdir "$base_name/$dst",0755; 97 106 } 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; 110 110 } 111 111 elsif($src eq 'REPLACE-VERSION-IN') 112 112 { 113 113 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 manifests120 $src = $dst;121 $dst = $other;122 $dst = $src if $dst eq '';123 124 copy_file($src,$dst);125 114 } 126 115 elsif($src eq 'RUN') … … 190 179 my $ext; 191 180 $ext = $1 if $fn =~ m/\.(\w+)\Z/; 192 193 # licenses not used in this directory?194 my $license_in_dir = 1;195 181 $dst_fn =~ m~\A(.+)/[^/]+?\Z~; 196 $license_in_dir = 0 if exists $no_license_dir{$1};197 182 198 183 # 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") 200 185 { 201 186 # copy as text, inserting license … … 215 200 # write license 216 201 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, $_; 220 206 } 221 207
Note: See TracChangeset
for help on using the changeset viewer.
