Module Name:    src
Committed By:   skrll
Date:           Thu Jun  8 15:51:12 UTC 2017

Added Files:
        src/external/gpl2/dtc: dtc2netbsd

Log Message:
Add a dtc2netbsd script


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/external/gpl2/dtc/dtc2netbsd

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/external/gpl2/dtc/dtc2netbsd
diff -u /dev/null src/external/gpl2/dtc/dtc2netbsd:1.1
--- /dev/null	Thu Jun  8 15:51:12 2017
+++ src/external/gpl2/dtc/dtc2netbsd	Thu Jun  8 15:51:12 2017
@@ -0,0 +1,124 @@
+#! /bin/sh
+#
+#	$NetBSD: dtc2netbsd,v 1.1 2017/06/08 15:51:12 skrll Exp $
+#
+#
+# Copyright (c) 2017 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Nick Hudson
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# dtc2netbsd:  convert a dtc source tree into netbsd dtc/libfdt source trees
+#
+# Rough instructions for importing new dtc release:
+#
+#	$ cd /some/where/temporary
+#	$ tar xpfz /dtc/release/tar/file
+#	$ DTCSRCS=$(pwd)
+#	$ WRKDIR=/an/other/temporary
+#	$ sh /usr/src/external/gpl2/dtc/dtc2netbsd $DTCSRCS $WRKDIR
+#
+# Import libfdt using
+#	$ cd $WRKDIR/libfdt
+#	$ cvs import -m "Import libfdt <version>" src/sys/external/bsd/libfdt/dist DTC dtc-<version>
+#
+# merge libfdt sources using, e.g.
+#	$ cvs -d cvs.netbsd.org:/cvsroot checkout -jdtc-1-4-1 -jdtc-1-4-4 src/sys/external/bsd/libfdt/dist
+#
+# Import dtc using
+#	$ cd $WRKDIR/dtc
+#	$ cvs import -m "Import dtc YYYY-MM-DD" src/external/gpl2/dtc/dist DTC dtc-<version>
+# merge dtc sources using, e.g.
+# 	$ cvs -d cvs.netbsd.org:/cvsroot checkout -jdtc-1-4-1 -jdtc-1-4-4 src/external/gpl2/dtc/dist
+
+if [ $# -ne 2 ]; then echo "dtc2netbsd dtcsrc tmpdir"; exit 1; fi
+
+r=$1
+d=$2
+
+case "$d" in
+	/*)
+		;;
+	*)
+		d=`/bin/pwd`/$d
+		;;
+esac
+
+case "$r" in
+	/*)
+		;;
+	*)
+		r=`/bin/pwd`/$r
+		;;
+esac
+
+echo preparing directory $d
+rm -rf $d
+mkdir -p $d/dtc
+
+### Copy the files and directories
+echo copying $r to $d
+cd $r
+pax -rw * $d/dtc
+mv $d/dtc/libfdt $d/libfdt
+
+# cd to import directory
+cd $d
+
+#
+
+### Remove the $'s around RCS tags
+cleantags $d
+
+### Add our NetBSD RCS Id
+find $d -type f -name '*.[chly]' -print | while read c; do
+	sed 1q < $c | grep -q '\$NetBSD' || (
+echo "/*	\$NetBSD\$	*/" >/tmp/dtc$$
+echo "" >>/tmp/dtc$$
+cat $c  >> /tmp/dtc$$
+mv /tmp/dtc$$ $c && echo added NetBSD RCS tag to $c
+	)
+done
+
+echo done
+
+### Clean up any CVS directories that might be around.
+echo "cleaning up CVS residue."
+(
+	cd $d
+	find . -type d -name "CVS" -print | xargs rm -r
+)
+echo done
+
+### Fixing file and directory permissions.
+echo "Fixing file/directory permissions."
+(
+	cd $d
+	find . -type f -print | xargs chmod u+rw,go+r
+	find . -type d -print | xargs chmod u+rwx,go+rx
+)
+echo done
+
+exit 0

Reply via email to