makerel revision 1.7
1#!/usr/bin/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. 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 12use ExtUtils::Manifest qw(fullcheck); 13 14$|=1; 15$relroot = ".."; # XXX make an option 16 17die "Must be in root of the perl source tree.\n" 18 unless -f "./MANIFEST" and -f "patchlevel.h"; 19 20open PATCHLEVEL,"<patchlevel.h" or die; 21my @patchlevel_h = <PATCHLEVEL>; 22close PATCHLEVEL; 23my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h; 24print $patchlevel_h; 25$revision = $1 if $patchlevel_h =~ /PERL_REVISION\s+(\d+)/; 26$patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/; 27$subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/; 28die "Unable to parse patchlevel.h" unless $subversion >= 0; 29$vers = sprintf("%d.%d.%d", $revision, $patchlevel, $subversion); 30 31# fetch list of local patches 32my (@local_patches, @lpatch_tags, $lpatch_tags); 33@local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h; 34@local_patches = grep { !/^\s*,?NULL/ } @local_patches; 35@lpatch_tags = map { /^\s*,"(\w+)/ } @local_patches; 36$lpatch_tags = join "-", @lpatch_tags; 37 38$perl = "perl-$vers"; 39$reldir = "$perl"; 40$reldir .= "-$lpatch_tags" if $lpatch_tags; 41 42print "\nMaking a release for $perl in $relroot/$reldir\n\n"; 43 44print "Cross-checking the MANIFEST...\n"; 45($missfile, $missentry) = fullcheck(); 46warn "Can't make a release with MANIFEST files missing.\n" if @$missfile; 47warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry; 48if ("@$missentry" =~ m/\.orig\b/) { 49 # Handy listing of find command and .orig files from patching work. 50 # I tend to run 'xargs rm' and copy and paste the file list. 51 my $cmd = "find . -name '*.orig' -print"; 52 print "$cmd\n"; 53 system($cmd); 54} 55die "Aborted.\n" if @$missentry or @$missfile; 56print "\n"; 57 58# VMS no longer has hardcoded version numbers descrip.mms 59 60print "Creating $relroot/$reldir release directory...\n"; 61die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir"; 62die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz"; 63mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n"; 64print "\n"; 65 66 67print "Copying files to release directory...\n"; 68# ExtUtils::Manifest maniread does not preserve the order 69$cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir"; 70system($cmd) == 0 71 or die "$cmd failed"; 72print "\n"; 73 74chdir "$relroot/$reldir" or die $!; 75 76print "Setting file permissions...\n"; 77system("find . -type f -print | xargs chmod 0444"); 78system("find . -type d -print | xargs chmod 0755"); 79system("find t ext lib -name '*.t' -print | xargs chmod +x"); 80system("find t ext lib -name 'test.pl' -print | xargs chmod +x"); 81my @exe = qw( 82 Configure 83 configpm 84 configure.gnu 85 embed.pl 86 installperl 87 installman 88 keywords.pl 89 opcode.pl 90 t/TEST 91 *.SH 92 vms/ext/Stdio/test.pl 93 vms/ext/filespec.t 94 x2p/*.SH 95 Porting/findrfuncs 96 Porting/genlog 97 Porting/makerel 98 Porting/p4genpatch 99 Porting/patchls 100 Porting/*.pl 101 mpeix/nm 102 mpeix/relink 103 Cross/generate_config_sh 104 Cross/warp 105); 106system("chmod +x @exe") == 0 107 or die "system: $!"; 108 109my @writables = qw( 110 NetWare/config_H.wc 111 NetWare/Makefile 112 keywords.h 113 opcode.h 114 opnames.h 115 pp_proto.h 116 pp.sym 117 proto.h 118 embed.h 119 embedvar.h 120 global.sym 121 overload.c 122 overload.h 123 pod/perlintern.pod 124 pod/perlapi.pod 125 pod/perltoc.pod 126 perlapi.h 127 perlapi.c 128 ext/Devel/PPPort/module2.c 129 ext/Devel/PPPort/module3.c 130 reentr.c 131 reentr.h 132 regcharclass.h 133 regnodes.h 134 warnings.h 135 lib/warnings.pm 136 win32/Makefile 137 win32/Makefile.ce 138 win32/makefile.mk 139 win32/config_H.bc 140 win32/config_H.gc 141 win32/config_H.vc 142 utils/Makefile 143 uconfig.h 144); 145system("chmod +w @writables") == 0 146 or die "system: $!"; 147 148print "Adding CRs to DOSish files...\n"; 149# This list is also in curliff.pl. 150my @crlf = qw( 151 djgpp/configure.bat 152 README.ce 153 README.dos 154 README.symbian 155 README.win32 156 symbian/config.pl 157 symbian/makesis.pl 158 symbian/README 159 symbian/xsbuild.pl 160 win32/Makefile 161 win32/Makefile.ce 162 win32/ce-helpers/compile-all.bat 163 win32/ce-helpers/compile.bat 164 win32/ce-helpers/registry.bat 165 win32/distclean.bat 166 win32/makefile.mk 167); 168system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0 169 or die "system: $!"; 170print "\n"; 171 172chdir ".." or die $!; 173 174print "Creating and compressing the tar file...\n"; 175my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch 176$cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz"; 177system($cmd) == 0 178 or die "$cmd failed"; 179print "\n"; 180 181system("ls -ld $perl*"); 182