Merge the bulk of Perl_magic_clearsig() into Perl_magic_setsig().
[p5sagit/p5-mst-13.2.git] / make_patchnum.pl
index 95b8db6..2bacd4b 100644 (file)
@@ -13,18 +13,30 @@ make_patchnum.pl - make patchnum
 
   perl make_patchnum.pl
 
+=head1 DESCRITPTION
+
 This program creates the files holding the information
 about locally applied patches to the source code. The created
-files are C<.patchnum>, C<unpushed.h> and C<lib/Config_git.pl>.
+files are  C<git_version.h> and C<lib/Config_git.pl>.
+
+=item C<lib/Config_git.pl>
+
+Contains status information from git in a form meant to be processed
+by the tied hash logic of Config.pm. It is actually optional,
+although -V will look strange without it.
+
+C<git_version.h> contains similar information in a C header file
+format, designed to be used by patchlevel.h. This file is obtained
+from stock_git_version.h if miniperl is not available, and then
+later on replaced by the version created by this script.
 
-C<.patchnum> contains ???
+=head1 AUTHOR
 
-C<lib/Config_git.pl> contains the configuration of git for
-this branch.
+Yves Orton, Kenichi Ishigaki, Max Maischein
 
-C<unpushed.h> contains the local changes that haven't been
-synchronized with the remote repository as configured with
-C<< git configure branch.<current branch>.remote >>
+=head1 COPYRIGHT
+
+Same terms as Perl itself.
 
 =cut
 
@@ -32,10 +44,10 @@ BEGIN {
     my $root=".";
     while (!-e "$root/perl.c" and length($root)<100) {
         if ($root eq '.') {
-               $root="..";
-       } else {
-               $root.="/..";
-           }
+            $root="..";
+        } else {
+            $root.="/..";
+        }
     }
     die "Can't find toplevel" if !-e "$root/perl.c";
     sub path_to { "$root/$_[0]" } # use $_[0] if this'd be placed in toplevel.
@@ -45,7 +57,7 @@ sub read_file {
     my $file = path_to(@_);
     return "" unless -e $file;
     open my $fh, '<', $file
-       or die "Failed to open for read '$file':$!";
+        or die "Failed to open for read '$file':$!";
     return do { local $/; <$fh> };
 }
 
@@ -53,7 +65,7 @@ sub write_file {
     my ($file, $content) = @_;
     $file= path_to($file);
     open my $fh, '>', $file
-       or die "Failed to open for write '$file':$!";
+        or die "Failed to open for write '$file':$!";
     print $fh $content;
     close $fh;
 }
@@ -76,12 +88,12 @@ sub write_files {
     my %content= map { /WARNING: '([^']+)'/ || die "Bad mojo!"; $1 => $_ } @_;
     my @files= sort keys %content;
     my $files= join " and ", map { "'$_'" } @files;
-    foreach my $file (@files) { 
+    foreach my $file (@files) {
         if (read_file($file) ne $content{$file}) {
             print "Updating $files\n";
             write_file($_,$content{$_}) for @files;
             return 1;
-        } 
+        }
     }
     print "Reusing $files\n";
     return 0;
@@ -100,7 +112,7 @@ elsif (-d path_to('.git')) {
     ($branch) = map { /\* ([^(]\S*)/ ? $1 : () } backtick('git branch');
     my ($remote,$merge);
     if (length $branch) {
-        $merge= backtick("git config branch.$branch.merge"); 
+        $merge= backtick("git config branch.$branch.merge");
         $merge =~ s!^refs/heads/!!;
         $remote= backtick("git config branch.$branch.remote");
     }
@@ -138,7 +150,7 @@ git_unpushed='$unpushed_commit_list'";
 }
 
 # we extract the filename out of the warning header, so dont mess with that
-exit(write_files(<<"EOF_HEADER", <<"EOF_CONFIG"));
+write_files(<<"EOF_HEADER", <<"EOF_CONFIG");
 /**************************************************************************
 * WARNING: 'git_version.h' is automatically generated by make_patchnum.pl
 *          DO NOT EDIT DIRECTLY - edit make_patchnum.pl instead
@@ -161,4 +173,4 @@ git_commit_id_title='$commit_title'
 $extra_info
 ENDOFGIT
 EOF_CONFIG
-# ex: set ts=4 sts=4 et ft=perl:
+# ex: set ts=8 sts=4 sw=4 et ft=perl: