Home | History | Annotate | Line # | Download | only in grep
      1  1.1  christos #! /bin/sh
      2  1.1  christos #
      3  1.3    rillig #	$NetBSD: grep2netbsd,v 1.3 2024/09/08 09:36:46 rillig Exp $
      4  1.1  christos #
      5  1.1  christos # Copyright (c) 2003 The NetBSD Foundation, Inc.
      6  1.1  christos # All rights reserved.
      7  1.1  christos #
      8  1.1  christos # Redistribution and use in source and binary forms, with or without
      9  1.1  christos # modification, are permitted provided that the following conditions
     10  1.1  christos # are met:
     11  1.1  christos # 1. Redistributions of source code must retain the above copyright
     12  1.1  christos #    notice, this list of conditions and the following disclaimer.
     13  1.1  christos # 2. Redistributions in binary form must reproduce the above copyright
     14  1.1  christos #    notice, this list of conditions and the following disclaimer in the
     15  1.1  christos #    documentation and/or other materials provided with the distribution.
     16  1.1  christos #
     17  1.1  christos # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     18  1.1  christos # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     19  1.1  christos # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     20  1.1  christos # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     21  1.1  christos # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     22  1.1  christos # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     23  1.1  christos # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     24  1.1  christos # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     25  1.1  christos # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     26  1.1  christos # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     27  1.1  christos # POSSIBILITY OF SUCH DAMAGE.
     28  1.1  christos #
     29  1.3    rillig # grep2netbsd:  convert a grep source tree into a
     30  1.1  christos # format suitable for commit.  Works on current dir.
     31  1.1  christos #
     32  1.1  christos 
     33  1.1  christos # delete some superfluous files
     34  1.1  christos echo deleting some superfluous files
     35  1.1  christos rm -rf bootstrap djgpp m4 tests vms autom4te-2.53.cache
     36  1.1  christos find . -type f -name .cvsignore -exec rm {} \;
     37  1.1  christos 
     38  1.1  christos echo done
     39  1.1  christos 
     40  1.1  christos ### Remove the $'s around RCS tags
     41  1.1  christos cleantags .
     42  1.1  christos 
     43  1.1  christos ### Add our NetBSD RCS Id
     44  1.1  christos find . -type f -name '*.[chly]' -print | while read c; do
     45  1.1  christos 	sed 1q < $c | grep -q '\$NetBSD' || (
     46  1.1  christos echo "/*	\$NetBSD\$	*/" >/tmp/grep3$$
     47  1.1  christos echo "" >>/tmp/grep3$$
     48  1.1  christos cat $c  >> /tmp/grep3$$
     49  1.1  christos mv /tmp/grep3$$ $c && echo added NetBSD RCS tag to $c
     50  1.1  christos 	)
     51  1.1  christos done
     52  1.1  christos 
     53  1.1  christos find . -type f -name '*.[0-9]' -print | while read m; do
     54  1.1  christos 	sed 1q < $m | grep -q '\$NetBSD' || (
     55  1.1  christos echo ".\\\"	\$NetBSD\$" >/tmp/grep4$$
     56  1.1  christos echo ".\\\"" >>/tmp/grep4$$
     57  1.1  christos cat $m >> /tmp/grep4$$
     58  1.1  christos mv /tmp/grep4$$ $m && echo added NetBSD RCS tag to $m
     59  1.1  christos 	)
     60  1.1  christos done
     61  1.1  christos 
     62  1.1  christos find . -type f -name '*.texi' -print | while read t; do
     63  1.1  christos         sed "2 s/^/@c \$NetBSD\$\\
     64  1.1  christos /" < $t > /tmp/grep5$$
     65  1.1  christos 	mv /tmp/grep5$$ $t && echo added NetBSD RCS tag to $t
     66  1.1  christos done
     67  1.1  christos 
     68  1.1  christos echo done
     69  1.1  christos 
     70  1.1  christos cat << EOF
     71  1.1  christos To import:
     72  1.1  christos cvs -d cvs.netbsd.org:/cvsroot import src/external/gpl2/grep/dist FSF grep-X-Y
     73  1.2  christos 
     74  1.2  christos Then run configure, make, merge the config.h file and the gmo files in the po
     75  1.2  christos dir.
     76  1.1  christos EOF
     77  1.1  christos exit 0
     78