This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make mconfig more verbose on fail
[metaconfig.git] / bin / manifake
1 #!/usr/bin/perl
2         eval "exec perl -i~ -S $0 $*"
3                 if $running_under_some_shell;
4
5 # $Id: manifake.SH 1 2006-08-24 12:32:52Z rmanfredi $
6 #
7 #  Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
8 #  
9 #  You may redistribute only under the terms of the Artistic Licence,
10 #  as specified in the README file that comes with the distribution.
11 #  You may reuse parts of this distribution only within the terms of
12 #  that same Artistic Licence; a copy of which may be found at the root
13 #  of the source tree for dist 4.0.
14 #
15 # $Log: manifake.SH,v $
16 # Revision 3.0.1.1  1993/08/19  06:42:18  ram
17 # patch1: leading config.sh searching was not aborting properly
18 #
19 # Revision 3.0  1993/08/18  12:04:32  ram
20 # Baseline for dist 3.0 netwide release.
21 #
22
23 $NEWMANI = 'MANIFEST.new';
24 $MANI = 'MANIFEST';
25
26 &manifake;
27
28 sub manifake {
29     # make MANIFEST and MANIFEST.new say the same thing
30     if (! -f $NEWMANI) {
31         if (-f $MANI) {
32             open(IN,$MANI) || die "Can't open $MANI";
33             open(OUT,">$NEWMANI") || die "Can't create $NEWMANI";
34             while (<IN>) {
35                 if (/---/) {
36                                         # Everything until now was a header...
37                                         close OUT;
38                                         open(OUT,">$NEWMANI") ||
39                                                 die "Can't recreate $NEWMANI";
40                                         next;
41                                 }
42                 s/^\s*(\S+\s+)[0-9]*\s*(.*)/$1$2/;
43                                 print OUT;
44                                 print OUT "\n" unless /\n$/;    # If no description
45             }
46             close IN;
47                         close OUT;
48         }
49         else {
50 die "You need to make a $NEWMANI file, with names and descriptions.\n";
51         }
52     }
53 }
54