Commit | Line | Data |
23b3bd7f |
1 | #!/usr/bin/perl -w |
08aa1457 |
2 | |
3 | # A first attempt at some automated support for making a perl release. |
4 | # Very basic but functional - if you're on a unix system. |
08aa1457 |
5 | # |
6 | # No matter how automated this gets, you'll always need to read |
7 | # and re-read pumpkin.pod checking for things to be done at various |
8 | # stages of the process. |
9 | # |
10 | # Tim Bunce, June 1997 |
11 | |
12 | use ExtUtils::Manifest qw(fullcheck); |
5f244db9 |
13 | $ExtUtils::Manifest::Quiet = 1; |
14 | use Getopt::Std; |
08aa1457 |
15 | |
16 | $|=1; |
5f244db9 |
17 | |
18 | sub usage { die <<EOF; } |
85bdf03b |
19 | usage: $0 [ -r rootdir ] [-s suffix ] [ -b ] |
5f244db9 |
20 | -r rootdir directory under which to create the build dir and tarball |
21 | defaults to '..' |
22 | -s suffix suffix to append to to the perl-x.y.z dir and tarball name |
23 | defaults to the concatenaion of the local_patches entry |
24 | in patchlevel.h (or blank, if none) |
85bdf03b |
25 | -b make a .bz2 file in addtion to a .gz file |
5f244db9 |
26 | EOF |
27 | |
28 | my %opts; |
85bdf03b |
29 | getopts('br:s:', \%opts) or usage; |
5f244db9 |
30 | @ARGV && usage; |
31 | |
32 | $relroot = defined $opts{r} ? $opts{r} : ".."; |
08aa1457 |
33 | |
34 | die "Must be in root of the perl source tree.\n" |
35 | unless -f "./MANIFEST" and -f "patchlevel.h"; |
36 | |
3ffabb8c |
37 | open PATCHLEVEL,"<patchlevel.h" or die; |
38 | my @patchlevel_h = <PATCHLEVEL>; |
39 | close PATCHLEVEL; |
d4257220 |
40 | my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h; |
08aa1457 |
41 | print $patchlevel_h; |
93136620 |
42 | $revision = $1 if $patchlevel_h =~ /PERL_REVISION\s+(\d+)/; |
d4257220 |
43 | $patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/; |
44 | $subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/; |
55d729e4 |
45 | die "Unable to parse patchlevel.h" unless $subversion >= 0; |
93136620 |
46 | $vers = sprintf("%d.%d.%d", $revision, $patchlevel, $subversion); |
08aa1457 |
47 | |
3ffabb8c |
48 | # fetch list of local patches |
49 | my (@local_patches, @lpatch_tags, $lpatch_tags); |
50 | @local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h; |
51 | @local_patches = grep { !/^\s*,?NULL/ } @local_patches; |
52 | @lpatch_tags = map { /^\s*,"(\w+)/ } @local_patches; |
53 | $lpatch_tags = join "-", @lpatch_tags; |
54 | |
2a7df08c |
55 | $perl = "perl-$vers"; |
f27ffc4a |
56 | $reldir = "$perl"; |
5f244db9 |
57 | |
58 | $lpatch_tags = $opts{s} if defined $opts{s}; |
3ffabb8c |
59 | $reldir .= "-$lpatch_tags" if $lpatch_tags; |
08aa1457 |
60 | |
f27ffc4a |
61 | print "\nMaking a release for $perl in $relroot/$reldir\n\n"; |
08aa1457 |
62 | |
08aa1457 |
63 | print "Cross-checking the MANIFEST...\n"; |
64 | ($missfile, $missentry) = fullcheck(); |
37d29c6f |
65 | @$missentry |
66 | = grep {$_ !~ m!^\.git/! and $_ !~ m!(?:/|^)\.gitignore!} @$missentry; |
9b05e874 |
67 | if (@$missfile ) { |
68 | warn "Can't make a release with MANIFEST files missing:\n"; |
69 | warn "\t".$_."\n" for (@$missfile); |
70 | } |
71 | if (@$missentry ) { |
72 | warn "Can't make a release with files not listed in MANIFEST\n"; |
73 | warn "\t".$_."\n" for (@$missentry); |
74 | |
75 | } |
90248788 |
76 | if ("@$missentry" =~ m/\.orig\b/) { |
77 | # Handy listing of find command and .orig files from patching work. |
78 | # I tend to run 'xargs rm' and copy and paste the file list. |
79 | my $cmd = "find . -name '*.orig' -print"; |
80 | print "$cmd\n"; |
81 | system($cmd); |
82 | } |
3e3baf6d |
83 | die "Aborted.\n" if @$missentry or @$missfile; |
08aa1457 |
84 | print "\n"; |
85 | |
b59922b7 |
86 | # VMS no longer has hardcoded version numbers descrip.mms |
48e117bb |
87 | |
88 | print "Creating $relroot/$reldir release directory...\n"; |
89 | die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir"; |
90 | die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz"; |
91 | mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n"; |
92 | print "\n"; |
93 | |
94 | |
95 | print "Copying files to release directory...\n"; |
96 | # ExtUtils::Manifest maniread does not preserve the order |
97 | $cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir"; |
86cd7d77 |
98 | system($cmd) == 0 |
99 | or die "$cmd failed"; |
48e117bb |
100 | print "\n"; |
101 | |
6e24577b |
102 | chdir "$relroot/$reldir" or die $!; |
48e117bb |
103 | |
d38b68fe |
104 | |
105 | my $SEARCH_ROOTS = 't ext lib dist cpan'; |
106 | |
08aa1457 |
107 | print "Setting file permissions...\n"; |
bf955a65 |
108 | system("find . -type f -print | xargs chmod 0444"); |
109 | system("find . -type d -print | xargs chmod 0755"); |
d38b68fe |
110 | system("find $SEARCH_ROOTS -name '*.t' -print | xargs chmod +x"); |
111 | system("find $SEARCH_ROOTS -name 'test.pl' -print | xargs chmod +x"); |
48e117bb |
112 | my @exe = qw( |
08aa1457 |
113 | Configure |
114 | configpm |
b907dc6d |
115 | configure.gnu |
08aa1457 |
116 | embed.pl |
117 | installperl |
118 | installman |
119 | keywords.pl |
08aa1457 |
120 | opcode.pl |
08aa1457 |
121 | t/TEST |
08aa1457 |
122 | *.SH |
08aa1457 |
123 | vms/ext/filespec.t |
08aa1457 |
124 | x2p/*.SH |
bb304ec8 |
125 | Porting/findrfuncs |
126 | Porting/genlog |
08aa1457 |
127 | Porting/makerel |
bb304ec8 |
128 | Porting/*.pl |
e619572c |
129 | mpeix/nm |
130 | mpeix/relink |
26e23ede |
131 | Cross/generate_config_sh |
132 | Cross/warp |
08aa1457 |
133 | ); |
86cd7d77 |
134 | system("chmod +x @exe") == 0 |
135 | or die "system: $!"; |
6e24577b |
136 | |
f7f713ed |
137 | my @writables = qw( |
f3513db0 |
138 | NetWare/config_H.wc |
139 | NetWare/Makefile |
ac634a9a |
140 | keywords.h |
141 | opcode.h |
142 | opnames.h |
143 | pp_proto.h |
144 | pp.sym |
145 | proto.h |
f7f713ed |
146 | embed.h |
147 | embedvar.h |
f7f713ed |
148 | global.sym |
e9e0c7d0 |
149 | overload.c |
150 | overload.h |
ac634a9a |
151 | perlapi.h |
152 | perlapi.c |
b2861970 |
153 | cpan/Devel-PPPort/module2.c |
154 | cpan/Devel-PPPort/module3.c |
e9e0c7d0 |
155 | reentr.c |
156 | reentr.h |
157 | regcharclass.h |
f7f713ed |
158 | regnodes.h |
0ebdc6d5 |
159 | warnings.h |
ac634a9a |
160 | lib/warnings.pm |
ac634a9a |
161 | win32/Makefile |
f78a30ba |
162 | win32/Makefile.ce |
ac634a9a |
163 | win32/makefile.mk |
164 | win32/config_H.bc |
f29c64d6 |
165 | win32/config_H.gc |
f7f713ed |
166 | win32/config_H.vc |
61190116 |
167 | utils/Makefile |
18b94d96 |
168 | uconfig.h |
f7f713ed |
169 | ); |
86cd7d77 |
170 | system("chmod +w @writables") == 0 |
171 | or die "system: $!"; |
f7f713ed |
172 | |
6e24577b |
173 | print "Adding CRs to DOSish files...\n"; |
27da23d5 |
174 | # This list is also in curliff.pl. |
48e117bb |
175 | my @crlf = qw( |
176 | djgpp/configure.bat |
f3513db0 |
177 | README.ce |
48e117bb |
178 | README.dos |
27da23d5 |
179 | README.symbian |
48e117bb |
180 | README.win32 |
27da23d5 |
181 | symbian/config.pl |
182 | symbian/makesis.pl |
183 | symbian/README |
184 | symbian/xsbuild.pl |
48e117bb |
185 | win32/Makefile |
f78a30ba |
186 | win32/Makefile.ce |
187 | win32/ce-helpers/compile-all.bat |
188 | win32/ce-helpers/compile.bat |
189 | win32/ce-helpers/registry.bat |
190 | win32/distclean.bat |
48e117bb |
191 | win32/makefile.mk |
192 | ); |
86cd7d77 |
193 | system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0 |
194 | or die "system: $!"; |
08aa1457 |
195 | print "\n"; |
196 | |
6e24577b |
197 | chdir ".." or die $!; |
198 | |
f27ffc4a |
199 | my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch |
85bdf03b |
200 | |
201 | print "Creating and compressing the tar.gz file...\n"; |
3ffabb8c |
202 | $cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz"; |
85bdf03b |
203 | system($cmd) == 0 or die "$cmd failed"; |
08aa1457 |
204 | |
85bdf03b |
205 | if ($opts{b}) { |
206 | print "Creating and compressing the tar.bz2 file...\n"; |
207 | $cmd = "tar cf - $reldir | bzip2 > $reldir.tar.bz2"; |
208 | system($cmd) == 0 or die "$cmd failed"; |
209 | } |
210 | |
211 | print "\n"; |
9b05e874 |
212 | |
ecc9c9d9 |
213 | system("ls -ld $perl*"); |
214 | print "\n"; |
215 | |
216 | for my $sha (qw(sha1 shasum sha1sum)) { |
217 | if (`which $sha 2>/dev/null`) { |
218 | system("$sha $perl*.tar.*"); |
219 | last; |
220 | } |
9b05e874 |
221 | } |