equal
deleted
inserted
replaced
1 #! /usr/perl5/bin/perl |
1 #! /usr/perl5/bin/perl |
2 # |
2 # |
3 # Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
3 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
4 # |
4 # |
5 # Permission is hereby granted, free of charge, to any person obtaining a |
5 # Permission is hereby granted, free of charge, to any person obtaining a |
6 # copy of this software and associated documentation files (the "Software"), |
6 # copy of this software and associated documentation files (the "Software"), |
7 # to deal in the Software without restriction, including without limitation |
7 # to deal in the Software without restriction, including without limitation |
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
8 # the rights to use, copy, modify, merge, publish, distribute, sublicense, |
32 # If <manifest input> does not exist, <license file> is included in the output |
32 # If <manifest input> does not exist, <license file> is included in the output |
33 # The result is written to <manifest output>, or stdout if not specified |
33 # The result is written to <manifest output>, or stdout if not specified |
34 |
34 |
35 use strict; |
35 use strict; |
36 use warnings; |
36 use warnings; |
|
37 use POSIX qw(strftime); |
37 |
38 |
38 my %options; |
39 my %options; |
39 |
40 |
40 foreach my $arg (@ARGV) { |
41 foreach my $arg (@ARGV) { |
41 my ($attr, $val) = split /=/, $arg, 2; |
42 my ($attr, $val) = split /=/, $arg, 2; |
127 if (!@manifest_header) { |
128 if (!@manifest_header) { |
128 |
129 |
129 my $manifest_license_listref = required_option_list |
130 my $manifest_license_listref = required_option_list |
130 ('manifest_license', 'when not merging with existing manifest.'); |
131 ('manifest_license', 'when not merging with existing manifest.'); |
131 |
132 |
|
133 # substitute the current year for @YEARS@ in the license template |
|
134 my $current_year = strftime '%Y', localtime; |
|
135 |
132 foreach my $lf (@{$options{'manifest_license'}}) { |
136 foreach my $lf (@{$options{'manifest_license'}}) { |
133 open my $LICENSE, '<', $lf or die "Cannot open manifest_license $lf: $!\n"; |
137 open my $LICENSE, '<', $lf or die "Cannot open manifest_license $lf: $!\n"; |
134 while (my $ll = <$LICENSE>) { |
138 while (my $ll = <$LICENSE>) { |
135 chomp($ll); |
139 chomp($ll); |
136 if ($ll !~ m{^\#}) { |
140 if ($ll !~ m{^\#}) { |
137 $ll = '# ' . $ll; |
141 $ll = '# ' . $ll; |
138 } |
142 } |
|
143 $ll =~ s{\@YEARS\@}{$current_year}; |
139 push @manifest_header, $ll; |
144 push @manifest_header, $ll; |
140 } |
145 } |
141 close $LICENSE; |
146 close $LICENSE; |
142 } |
147 } |
143 |
148 |
154 |
159 |
155 push @manifest_header, 'set name=pkg.description ' . |
160 push @manifest_header, 'set name=pkg.description ' . |
156 'value="XXX: Please provide a descriptive paragraph for the package."'; |
161 'value="XXX: Please provide a descriptive paragraph for the package."'; |
157 |
162 |
158 my $pkg_summary = ''; |
163 my $pkg_summary = ''; |
159 |
164 if (exists $options{'summary'}) { |
|
165 $pkg_summary = $options{'summary'}->[0]; |
|
166 } |
|
167 |
|
168 if ($pkg_summary =~ m{^\s*$}) { |
160 SDIR: foreach my $sdir (@{$options{'source_dir'}}) { |
169 SDIR: foreach my $sdir (@{$options{'source_dir'}}) { |
161 foreach my $bdir (glob("build-*/$sdir")) { |
170 foreach my $bdir (glob("build-*/$sdir")) { |
162 # First try looking in a README file for a short summary |
171 # First try looking in a README file for a short summary |
163 my $rf = join('/', $bdir, 'README'); |
172 my $rf = join('/', $bdir, 'README'); |
164 if (open my $README, '<', $rf) { |
173 if (open my $README, '<', $rf) { |
207 last SDIR; |
216 last SDIR; |
208 } |
217 } |
209 } |
218 } |
210 } |
219 } |
211 } |
220 } |
|
221 } |
212 } |
222 } |
213 |
223 |
214 if ($pkg_summary eq '') { |
224 if ($pkg_summary eq '') { |
215 $pkg_summary = |
225 $pkg_summary = |
216 'XXX: Please provide a short name for the package'; |
226 'XXX: Please provide a short name for the package'; |