This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Populate metaconfig branch.
[metaconfig.git] / dist-3.0at70b / pat / patbase.SH
1 case $CONFIG in
2 '')
3         if test -f config.sh; then TOP=.;
4         elif test -f ../config.sh; then TOP=..;
5         elif test -f ../../config.sh; then TOP=../..;
6         elif test -f ../../../config.sh; then TOP=../../..;
7         elif test -f ../../../../config.sh; then TOP=../../../..;
8         else
9                 echo "Can't find config.sh."; exit 1
10         fi
11         . $TOP/config.sh
12         ;;
13 esac
14 case "$0" in
15 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
16 esac
17 echo "Extracting pat/patbase (with variable substitutions)"
18 cat >patbase <<!GROK!THIS!
19 $startperl
20         eval "exec perl -S \$0 \$*"
21                 if \$running_under_some_shell;
22
23 # $Id: patbase.SH,v 3.0.1.3 1994/01/24 14:29:24 ram Exp $
24 #
25 #  Copyright (c) 1991-1993, Raphael Manfredi
26 #  
27 #  You may redistribute only under the terms of the Artistic Licence,
28 #  as specified in the README file that comes with the distribution.
29 #  You may reuse parts of this distribution only within the terms of
30 #  that same Artistic Licence; a copy of which may be found at the root
31 #  of the source tree for dist 3.0.
32 #
33 # Original Author: Larry Wall <lwall@netlabs.com>
34 #
35 # $Log: patbase.SH,v $
36 # Revision 3.0.1.3  1994/01/24  14:29:24  ram
37 # patch16: added ~/.dist_profile awareness
38 #
39 # Revision 3.0.1.2  1993/08/24  12:15:58  ram
40 # patch3: random cleanup
41 #
42 # Revision 3.0.1.1  1993/08/19  06:42:32  ram
43 # patch1: leading config.sh searching was not aborting properly
44 #
45 # Revision 3.0  1993/08/18  12:10:38  ram
46 # Baseline for dist 3.0 netwide release.
47 #
48
49 \$version = '$VERSION';
50 \$patchlevel = '$PATCHLEVEL';
51 !GROK!THIS!
52 cat >>patbase <<'!NO!SUBS!'
53
54 $progname = &profile;           # My name
55
56 require 'getopts.pl';
57 &usage unless $#ARGV >= 0;
58 &usage unless &Getopts("ahV");
59
60 if ($opt_V) {
61         print STDERR "$progname $version PL$patchlevel\n";
62         exit 0;
63 } elsif ($opt_h) {
64         &usage;
65 }
66
67 &readpackage;
68
69 $RCSEXT = ',v' unless $RCSEXT;
70 $TOPDIR = '';                   # We are at the top-level directory
71
72 if ($opt_a) {
73         open(MANI,"MANIFEST.new") || die "No MANIFEST.new found.\n";
74         @ARGV = ();
75         while (<MANI>) {
76                 chop;
77                 s|^\./||;
78                 next if m|^patchlevel.h|;               # Special file
79                 ($_) = split(' ');
80                 next if -d;
81                 push(@ARGV,$_);
82         }
83         close MANI;
84 }
85
86 foreach $file (@ARGV) {
87         $files = &rcsargs($file);
88         @files = split(' ',$files);
89         $revs=0;
90         $rlog = `rlog -r$baserev -r$revbranch $files 2>&1`;
91         ($revs) = ($rlog =~ /selected revisions: (\d+)/);
92         if (!$revs) {
93                 print "$progname: $file has never been checked in--checking in...\n";
94                 system 'perl', '-S', 'patcil', $file;
95         }
96         elsif ($revs == 1) {
97                 print "Last revision for $file is $baserev.\n";
98                 system 'rcs', "-Nlastpat:$baserev", @files;
99         }
100         else {
101                 ($lastrev) = ($rlog =~ /revision $revbranch\.(\d+)/);
102                 print "Last revision for $file is $revbranch.$lastrev.\n";
103                 system 'rcs', "-Nlastpat:$revbranch.$lastrev", @files;
104         }
105 }
106
107 sub usage {
108         print STDERR "Usage: $progname [-ahV] [filelist]\n";
109         print STDERR "  -a : all the files in MANIFEST.new\n";
110         print STDERR "  -h : print this message and exit\n";
111         print STDERR "  -V : print version number and exit\n";
112         exit 1;
113 }
114
115 !NO!SUBS!
116 $grep -v '^;#' ../pl/package.pl >>patbase
117 $grep -v '^;#' ../pl/rcsargs.pl >>patbase
118 $grep -v '^;#' ../pl/comment.pl >>patbase
119 $grep -v '^;#' ../pl/tilde.pl >>patbase
120 $grep -v '^;#' ../pl/profile.pl >>patbase
121 chmod +x patbase
122 $eunicefix patbase