Maintenance 5.004_04 changes
[p5sagit/p5-mst-13.2.git] / Porting / makerel
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.
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
20 $patchlevel_h = `grep '#define ' patchlevel.h`;
21 print $patchlevel_h;
22 $patchlevel = $1 if $patchlevel_h =~ /PATCHLEVEL\s+(\d+)/;
23 $subversion = $1 if $patchlevel_h =~ /SUBVERSION\s+(\d+)/;
24 die "Unable to parse patchlevel.h" unless $subversion > 0;
25 $vers = sprintf("5.%03d", $patchlevel);
26 $vers.= sprintf( "_%02d", $subversion) if $subversion;
27
28 $perl = "perl$vers";
29 $reldir = "$relroot/$perl";
30 $reldir .= "-$ARGV[0]" if $ARGV[0];
31
32 print "\nMaking a release for $perl in $reldir\n\n";
33
34
35 print "Cross-checking the MANIFEST...\n";
36 ($missfile, $missentry) = fullcheck();
37 warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
38 warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
39 if ("@$missentry" =~ m/\.orig\b/) {
40     # Handy listing of find command and .orig files from patching work.
41     # I tend to run 'xargs rm' and copy and paste the file list.
42     my $cmd = "find . -name '*.orig' -print";
43     print "$cmd\n";
44     system($cmd);
45 }
46 die "Aborted.\n" if @$missentry or @$missfile;
47 print "\n";
48
49
50 print "Setting file permissions...\n";
51 system("find . -type f -print     | xargs chmod -w");
52 system("find . -type d -print     | xargs chmod g-s");
53 system("find t -name '*.t' -print | xargs chmod +x");
54 system("chmod +w configure"); # special case (see pumpkin.pod)
55 @exe = qw(
56     Configure
57     configpm
58     configure
59     embed.pl
60     installperl
61     installman
62     keywords.pl
63     myconfig
64     opcode.pl
65     perly.fixer
66     t/TEST
67     t/*/*.t
68     *.SH
69     vms/ext/Stdio/test.pl
70     vms/ext/filespec.t
71     vms/fndvers.com
72     x2p/*.SH
73     Porting/patchls
74     Porting/makerel
75 );
76 system("chmod +x @exe");
77 print "\n";
78
79
80 print "Creating $reldir release directory...\n";
81 die "$reldir release directory already exists\n"   if -e "../$perl";
82 die "$reldir.tar.gz release file already exists\n" if -e "../$reldir.tar.gz";
83 mkdir($reldir, 0755) or die "mkdir $reldir: $!\n";
84 print "\n";
85
86
87 print "Copying files to release directory...\n";
88 # ExtUtils::Manifest maniread does not preserve the order
89 $cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $reldir";
90 system($cmd) == 0 or die "$cmd failed";
91 print "\n";
92
93 chdir $relroot or die $!;
94
95 print "Creating and compressing the tar file...\n";
96 $cmd = "tar cf - $perl | gzip --best > $perl.tar.gz";
97 system($cmd) == 0 or die "$cmd failed";
98 print "\n";
99
100 system("ls -ld $perl*");