~vcs-imports/boxbackup/trunk

« back to all changes in this revision

Viewing changes to infrastructure/makedistribution.pl.in

  • Committer: chris
  • Date: 2010-01-23 17:11:24 UTC
  • Revision ID: importd@galapagos-20100123171124-uqlabhc1am97rgbl
Switch license to GPL for backup parts, and dual GPL/BSD for common 
parts, as discussed and agreed in this thread:

http://lists.boxbackup.org/pipermail/boxbackup/2010-January/000005.html

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
my %text_files = ('txt' => 1, 'spec' => 1, 'in' => 1);
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
23
26
my $distribution = $ARGV[0];
68
71
system "rm $base_name.tgz";
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
79
87
my %modules_included;
88
96
        {
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')
94
103
                {
95
104
                        # actually we just need to make a directory here
96
105
                        mkdir "$base_name/$dst",0755;
97
106
                }
98
 
                elsif($src eq 'NO-LICENSE-IN-DIR')
 
107
                elsif($src eq 'LICENSE')
99
108
                {
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);
 
109
                        $current_license = $dst;
110
110
                }
111
111
                elsif($src eq 'REPLACE-VERSION-IN')
112
112
                {
113
113
                        replace_version_in($dst);
114
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);
125
 
                }
126
115
                elsif($src eq 'RUN')
127
116
                {
128
117
                        my ($junk,$cmd) = split /\s+/, $line, 2;
189
178
        
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
202
187
                # print "source copy $fn to $base_name/$dst_fn\n";
214
199
                
215
200
                # write license
216
201
                my $b = $comment_chars{$ext};
217
 
                for(@license)
 
202
                my $this_license = $license_text{$current_license};
 
203
                for (@$this_license)
218
204
                {
219
 
                        print OUT $b,$_,"\n"
 
205
                        print OUT $b, $_;
220
206
                }
221
207
                
222
208
                if($first ne '')