Commit | Line | Data |
---|---|---|
08aa1457 | 1 | #!/bin/env perl -w |
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); | |
13 | ||
14 | $|=1; | |
15 | $relroot = ".."; # XXX make an option | |
16 | ||
17 | die "Must be in root of the perl source tree.\n" | |
18 | unless -f "./MANIFEST" and -f "patchlevel.h"; | |
19 | ||
3ffabb8c GS |
20 | open PATCHLEVEL,"<patchlevel.h" or die; |
21 | my @patchlevel_h = <PATCHLEVEL>; | |
22 | close PATCHLEVEL; | |
d4257220 | 23 | my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h; |
08aa1457 | 24 | print $patchlevel_h; |
d4257220 GS |
25 | $patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/; |
26 | $subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/; | |
55d729e4 | 27 | die "Unable to parse patchlevel.h" unless $subversion >= 0; |
08aa1457 | 28 | $vers = sprintf("5.%03d", $patchlevel); |
55d729e4 GS |
29 | $vms_vers = sprintf("5_%03d", $patchlevel); |
30 | if ($subversion) { | |
31 | $vers.= sprintf( "_%02d", $subversion); | |
32 | $vms_vers.= sprintf( "%02d", $subversion); | |
33 | } else { | |
34 | $vms_vers.= " "; | |
35 | } | |
08aa1457 | 36 | |
3ffabb8c GS |
37 | # fetch list of local patches |
38 | my (@local_patches, @lpatch_tags, $lpatch_tags); | |
39 | @local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h; | |
40 | @local_patches = grep { !/^\s*,?NULL/ } @local_patches; | |
41 | @lpatch_tags = map { /^\s*,"(\w+)/ } @local_patches; | |
42 | $lpatch_tags = join "-", @lpatch_tags; | |
43 | ||
08aa1457 | 44 | $perl = "perl$vers"; |
f27ffc4a | 45 | $reldir = "$perl"; |
3ffabb8c | 46 | $reldir .= "-$lpatch_tags" if $lpatch_tags; |
08aa1457 | 47 | |
f27ffc4a | 48 | print "\nMaking a release for $perl in $relroot/$reldir\n\n"; |
08aa1457 | 49 | |
08aa1457 | 50 | print "Cross-checking the MANIFEST...\n"; |
51 | ($missfile, $missentry) = fullcheck(); | |
3e3baf6d TB |
52 | warn "Can't make a release with MANIFEST files missing.\n" if @$missfile; |
53 | warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry; | |
90248788 TB |
54 | if ("@$missentry" =~ m/\.orig\b/) { |
55 | # Handy listing of find command and .orig files from patching work. | |
56 | # I tend to run 'xargs rm' and copy and paste the file list. | |
57 | my $cmd = "find . -name '*.orig' -print"; | |
58 | print "$cmd\n"; | |
59 | system($cmd); | |
60 | } | |
3e3baf6d | 61 | die "Aborted.\n" if @$missentry or @$missfile; |
08aa1457 | 62 | print "\n"; |
63 | ||
b59922b7 GS |
64 | # VMS no longer has hardcoded version numbers descrip.mms |
65 | #print "Updating VMS version specific files with $vms_vers...\n"; | |
66 | #system("perl -pi -e 's/^\QPERL_VERSION = \E\d\_\d+(\s*\#)/PERL_VERSION = $vms_vers$1/' vms/descrip.mms"); | |
55d729e4 GS |
67 | |
68 | ||
48e117bb GS |
69 | |
70 | print "Creating $relroot/$reldir release directory...\n"; | |
71 | die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir"; | |
72 | die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz"; | |
73 | mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n"; | |
74 | print "\n"; | |
75 | ||
76 | ||
77 | print "Copying files to release directory...\n"; | |
78 | # ExtUtils::Manifest maniread does not preserve the order | |
79 | $cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir"; | |
80 | system($cmd) == 0 or die "$cmd failed"; | |
81 | print "\n"; | |
82 | ||
6e24577b | 83 | chdir "$relroot/$reldir" or die $!; |
48e117bb | 84 | |
08aa1457 | 85 | print "Setting file permissions...\n"; |
fb73857a | 86 | system("find . -type f -print | xargs chmod -w"); |
87 | system("find . -type d -print | xargs chmod g-s"); | |
88 | system("find t -name '*.t' -print | xargs chmod +x"); | |
48e117bb | 89 | my @exe = qw( |
08aa1457 | 90 | Configure |
91 | configpm | |
08aa1457 | 92 | embed.pl |
93 | installperl | |
94 | installman | |
95 | keywords.pl | |
08aa1457 | 96 | opcode.pl |
97 | perly.fixer | |
98 | t/TEST | |
99 | t/*/*.t | |
100 | *.SH | |
101 | vms/ext/Stdio/test.pl | |
102 | vms/ext/filespec.t | |
08aa1457 | 103 | x2p/*.SH |
104 | Porting/patchls | |
105 | Porting/makerel | |
106 | ); | |
107 | system("chmod +x @exe"); | |
6e24577b | 108 | |
f7f713ed GS |
109 | my @writables = qw( |
110 | embed.h | |
111 | embedvar.h | |
112 | ext/B/B/Asmdata.pm | |
113 | ext/ByteLoader/byterun.c | |
114 | ext/ByteLoader/byterun.h | |
115 | global.sym | |
116 | keywords.h | |
0ebdc6d5 | 117 | lib/warnings.pm |
f7f713ed GS |
118 | objXSUB.h |
119 | opcode.h | |
120 | pp.sym | |
121 | pp_proto.h | |
122 | regnodes.h | |
0ebdc6d5 | 123 | warnings.h |
f7f713ed | 124 | win32/config_H.bc |
f29c64d6 | 125 | win32/config_H.gc |
f7f713ed GS |
126 | win32/config_H.vc |
127 | ); | |
128 | system("chmod +w @writables"); | |
129 | ||
6e24577b | 130 | print "Adding CRs to DOSish files...\n"; |
48e117bb GS |
131 | my @crlf = qw( |
132 | djgpp/configure.bat | |
133 | README.dos | |
134 | README.win32 | |
135 | win32/Makefile | |
136 | win32/makefile.mk | |
137 | ); | |
138 | system("perl -pi -e 's/\$/\\r/' @crlf"); | |
08aa1457 | 139 | print "\n"; |
140 | ||
6e24577b GS |
141 | chdir ".." or die $!; |
142 | ||
08aa1457 | 143 | print "Creating and compressing the tar file...\n"; |
f27ffc4a | 144 | my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch |
3ffabb8c | 145 | $cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz"; |
08aa1457 | 146 | system($cmd) == 0 or die "$cmd failed"; |
147 | print "\n"; | |
148 | ||
149 | system("ls -ld $perl*"); |