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