Module Name:    src
Committed By:   simonb
Date:           Fri Oct  6 05:58:21 UTC 2023

Modified Files:
        src/external/bsd/less: less2netbsd

Log Message:
Many tweaks to 10-year-old script cherry-picking from many other
foo2netbsd scripts.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/less/less2netbsd

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

Modified files:

Index: src/external/bsd/less/less2netbsd
diff -u src/external/bsd/less/less2netbsd:1.5 src/external/bsd/less/less2netbsd:1.6
--- src/external/bsd/less/less2netbsd:1.5	Sun Jul  3 23:25:01 2011
+++ src/external/bsd/less/less2netbsd	Fri Oct  6 05:58:21 2023
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: less2netbsd,v 1.5 2011/07/03 23:25:01 tron Exp $
+#	$NetBSD: less2netbsd,v 1.6 2023/10/06 05:58:21 simonb Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,32 +30,75 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-# less2netbsd:
-# Prepare a less source tree for import into the NetBSD source repository.
+# less2netbsd: Prepare a less source tree for import into the NetBSD
+# source repository, under src/external .
+# based on many other *2netbsd scripts
+#
+# Rough instructions for importing new less release:
+#
+#	$ cd /some/where/temporary
+#	$ tar xpfz /new/less/release/tar/file
+#	$ sh /usr/src/external/bsd/less/less2netbsd less-xyz `pwd`
+#	$ cd src/external/bsd/less/dist
+#	$ cvs -d cvs.netbsd.org:/cvsroot import src/external/bsd/less/dist \
+#		GREENWOODSOFTWARE LESS-xyz
+#	   Enter the new NEWS portion as your commit message
+#	$ cd ../../../../../less-xyz
+#	$ ./configure
+#	$ cp defines.h /usr/src/external/bsd/less/include
+#	$ cd /usr/src/external/bsd/less
+#	$ cvs update
+#	$ cvs commit -m "Updated autoconf generated files for less xyz."
+#	$ cd /some/where/temporary
+#	   ... and clean up the leftovers
 
 PROGNAME=$(basename "$0")
-if [ $# -ne 1 ]
-then
-	echo "Usage: $PROGNAME <dir>" >&2
+if [ $# -ne 2 ]; then
+	echo "Usage: $PROGNAME src dest" >&2
 	exit 1
 fi
-DIRNAME="$1"
+
+r=$1
+d=$2/src/external/bsd/less/dist
+
+case "$d" in
+	/*)
+		;;
+	*)
+		d=`/bin/pwd`/$d
+		;;
+esac
+
+case "$r" in
+	/*)
+		;;
+	*)
+		r=`/bin/pwd`/$r
+		;;
+esac
+
+# Start with clean target directory
+echo preparing directory $d
+rm -rf $d
+mkdir -p $d
 
 # Change to the source directory.
-if [ -d "$DIRNAME" ] && cd "$DIRNAME"
-then
+if [ -d $r ] && cd $r; then
 	:
 else
-	echo "${PROGNAME}: cannot access directory \"$DIRNAME\"." >&2
-	exit
+	echo "${PROGNAME}: cannot access directory \"$r\"." >&2
+	exit 1
 fi
 
+# Copy the files and directories
+echo copying $r to $d
+cd $r
+pax -rwpp * $d
+
 # Check whether the source directory looks sane.
 CHECK_FILES="LICENSE configure less.h version.c"
-for FILENAME in $CHECK_FILES
-do
-	if [ ! -f "$FILENAME" ]
-	then
+for FILENAME in $CHECK_FILES; do
+	if [ ! -f "$FILENAME" ]; then
 		echo "${PROGNAME}: less distribution incomplete." >&2
 		exit
 	fi
@@ -65,28 +108,29 @@ done
 REQUIRED_HEADERS=defines.h
 for FILENAME in $REQUIRED_HEADERS
 do
-	if [ ! -f "$FILENAME" ]
-	then
-		echo "${PROGNAME}: Please run \"./configure\"." >&2
-		exit
+	if [ -f "$FILENAME" ]; then
+		echo "${PROGNAME}: \"./configure\" run too early, start again." >&2
+		exit 1
 	fi
 done
 
 # Fix the permissions.
-find . -type d -print0 | xargs -0 chmod 755
-find . -type f -print0 | xargs -0 chmod 644
+find . -type d -printx | xargs chmod 755
+find . -type f -printx | xargs chmod 644
 chmod 755 configure
 
 # Remove files generated by "configure".
-REMOVE_FILES="Makefile config.log config.status configure.lineno"
+REMOVE_FILES="Makefile config.log config.status"
 rm -f $REMOVE_FILES
 
+# Remove extra files/dirs that we don't want to import
+rm -rf lesstest
+
 # Add NetBSD RCS Ids.
 find . -type f -name "*.[ch]" -print |
 while read FILENAME
 do
-	if ! grep -q '\$NetBSD' "$FILENAME"
-	then
+	if ! grep -q '\$NetBSD' "$FILENAME"; then
 		NEW_FILENAME="${FILENAME}.new"
 		rm -f "${NEW_FILENAME}"
 		(echo "/*	\$NetBSD\$	*/"

Reply via email to