This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
revise documentation about set-id
[perl5.git] / Porting / makerel
index 8822aff..a4b2ed7 100755 (executable)
@@ -28,18 +28,18 @@ use Getopt::Std;
 $|=1;
 
 sub usage { die <<EOF; }
-usage: $0 [ -r rootdir ] [-s suffix ] [ -b ] [ -n ]
+usage: $0 [ -r rootdir ] [-s suffix ] [ -x ] [ -n ]
     -r rootdir   directory under which to create the build dir and tarball
                  defaults to '..'
     -s suffix    suffix to append to to the perl-x.y.z dir and tarball name
                 defaults to the concatenation of the local_patches entry
                 in patchlevel.h (or blank, if none)
-    -b           make a .bz2 file in addtion to a .gz file
+    -x           make a .xz file in addition to a .gz file
     -n           do not make any tarballs, just the directory
 EOF
 
 my %opts;
-getopts('bnr:s:', \%opts) or usage;
+getopts('xnr:s:', \%opts) or usage;
 @ARGV && usage;
 
 $relroot = defined $opts{r} ? $opts{r} : "..";
@@ -47,7 +47,7 @@ $relroot = defined $opts{r} ? $opts{r} : "..";
 die "Must be in root of the perl source tree.\n"
        unless -f "./MANIFEST" and -f "patchlevel.h";
 
-open PATCHLEVEL,"<patchlevel.h" or die;
+open PATCHLEVEL, '<', 'patchlevel.h' or die;
 my @patchlevel_h = <PATCHLEVEL>;
 close PATCHLEVEL;
 my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h;
@@ -140,31 +140,41 @@ my @writables = qw(
     proto.h
     embed.h
     embedvar.h
-    overload.c
+    overload.inc
     overload.h
     mg_vtable.h
     perlapi.h
     perlapi.c
-    cpan/Devel-PPPort/module2.c
-    cpan/Devel-PPPort/module3.c
-    cpan/autodie/t/truncate_me
+    dist/Devel-PPPort/module2.c
+    dist/Devel-PPPort/module3.c
+    cpan/autodie/t/touch_me
     reentr.c
     reentr.h
     regcharclass.h
     regnodes.h
     warnings.h
     lib/warnings.pm
+    win32/GNUmakefile
     win32/Makefile
     win32/Makefile.ce
     win32/makefile.mk
     win32/config_H.ce
     win32/config_H.gc
     win32/config_H.vc
-    utils/Makefile
     uconfig.h
 );
-system("chmod u+w @writables") == 0
-    or die "system: $!";
+
+my $out = `chmod u+w @writables 2>&1`;
+if ($? != 0) {
+    warn $out;
+    if ($out =~ /no such file/i) {
+        warn "Check that the files above still exist in the Perl core.\n";
+        warn "If not, remove them from \@writables in Porting/makerel\n";
+    }
+    exit 1;
+}
+
+warn $out if $out;
 
 chdir ".." or die $!;
 
@@ -195,16 +205,10 @@ if ($have_7z) {
     }
 }
 
-if ($opts{b}) {
-    if ($have_7z) {
-        print "Creating and compressing the tar.bz2 file with 7z...\n";
-        $cmd = "tar cf - $reldir | 7z a -tbzip2 -mx9 -bd -si $reldir.tar.bz2";
-        system($cmd) == 0 or die "$cmd failed";
-    } else {
-        print "Creating and compressing the tar.bz2 file...\n";
-        $cmd = "tar cf - $reldir | bzip2 > $reldir.tar.bz2";
-        system($cmd) == 0 or die "$cmd failed";
-    }
+if ($opts{x}) {
+    print "Creating and compressing the tar.gz file with 7z...\n";
+    $cmd = "tar cf - $reldir | xz -z -c > $reldir.tar.xz";
+    system($cmd) == 0 or die "$cmd failed";
 }
 
 print "\n";