From 1af3faa2b79125b774c2182cab841ed7ee555bed Mon Sep 17 00:00:00 2001 From: William Harold Newman Date: Tue, 12 Jul 2005 12:58:01 +0000 Subject: [PATCH] 0.9.2.40: added scripts to impose whitespace canonicalization added scripts to check that sources haven't drifted away from canonical whitespacing (as when someone doesn't use emacs' INDENT-TABS-MODE=NIL...) (Note that the scripts include an annoying level of "echo"-ish commands which should probably be removed once things seem to be working OK for everyone.) (Something about huge touch-every-file "cvs commit" of canonicalized-whitespace versions of all sources is clashing with my flaky internet connection, so there may be some further delay in committing the result of running the scripts.) --- tools-for-build/canonicalize-whitespace | 9 +++++++ tools-for-build/canonicalize-whitespace-1 | 28 ++++++++++++++++++++++ tools-for-build/check-canonical-whitespace | 6 +++++ tools-for-build/grep-noncanonical-whitespace | 9 +++++++ tools-for-build/whitespacely-canonical-filenames | 19 +++++++++++++++ version.lisp-expr | 2 +- 6 files changed, 72 insertions(+), 1 deletion(-) create mode 100755 tools-for-build/canonicalize-whitespace create mode 100755 tools-for-build/canonicalize-whitespace-1 create mode 100644 tools-for-build/check-canonical-whitespace create mode 100755 tools-for-build/grep-noncanonical-whitespace create mode 100755 tools-for-build/whitespacely-canonical-filenames diff --git a/tools-for-build/canonicalize-whitespace b/tools-for-build/canonicalize-whitespace new file mode 100755 index 0000000..5c64e69 --- /dev/null +++ b/tools-for-build/canonicalize-whitespace @@ -0,0 +1,9 @@ +#!/bin/sh + +# (a script to be run in the root directory of the distribution) +# +# Convert tabs to spaces and delete trailing whitespace in files +# which we can safely assume to be source files in appropriate languages. + +tools-for-build/whitespacely-canonical-filenames \ + | xargs tools-for-build/canonicalize-whitespace-1 diff --git a/tools-for-build/canonicalize-whitespace-1 b/tools-for-build/canonicalize-whitespace-1 new file mode 100755 index 0000000..1e33369 --- /dev/null +++ b/tools-for-build/canonicalize-whitespace-1 @@ -0,0 +1,28 @@ +#!/bin/sh + +# in-place "canonicalize-whitespace" conversion for files in $*: +# * Convert tabs to spaces. +# * Delete trailing whitespace. +# (on $*, in place, overwriting the old file) + +scratchfilename=/tmp/canonicalize-whitespace-1.$$.tmp + +echo '/in canonicalize-whitespace-1' +echo '/$*'=$* +echo '/$scratchfilename='$scratchfilename + +for f in $*; do + + echo '/$f'=$f + + # We reuse the "expand" GNU utility to remove tabs, but if it turns out + # not to be available everywhere (or someone has defined "expand" to + # mean something else on some other class of system!) we could probably + # hand-code a replacement in a few lines. + expand $f > $scratchfilename + + sed 's/[ ]*$//' < $scratchfilename > $f + +done + +rm $scratchfilename diff --git a/tools-for-build/check-canonical-whitespace b/tools-for-build/check-canonical-whitespace new file mode 100644 index 0000000..fec0a58 --- /dev/null +++ b/tools-for-build/check-canonical-whitespace @@ -0,0 +1,6 @@ +#!/bin/sh + +# Look for violations of whitespace canonicalization. On the first +# one found, print the line (mostly to help humans) and exit with +# nonzero (mostly to help scripts). + diff --git a/tools-for-build/grep-noncanonical-whitespace b/tools-for-build/grep-noncanonical-whitespace new file mode 100755 index 0000000..a76dd1f --- /dev/null +++ b/tools-for-build/grep-noncanonical-whitespace @@ -0,0 +1,9 @@ +#!/bin/sh + +# Look for violations of whitespace canonicalization, handling them as +# greppish matches: +# * Print human-readable description of each one. +# * Exit with 0 if >=1 found, or exit with 0 if none found. + +tools-for-build/whitespacely-canonical-filenames | \ + xargs egrep --with-filename ' | $' \ No newline at end of file diff --git a/tools-for-build/whitespacely-canonical-filenames b/tools-for-build/whitespacely-canonical-filenames new file mode 100755 index 0000000..b858795 --- /dev/null +++ b/tools-for-build/whitespacely-canonical-filenames @@ -0,0 +1,19 @@ +#!/bin/sh + +# (a script to be run in the root directory of the distribution, +# probably as part of an enclosing do-something-with-whitespace script) +# +# Print to stdout the names of files whose whitespace we (SBCLers) +# try to keep canonical. + +# glob patterns for source files in languages for which the +# canonicalization is safe (not affecting meaning, at least given the +# conservative syntax used in SBCL sources) +source_extensions='.lisp .lisp-expr .c .h' +# other candidates: +# .sh +# ? + +for source_extension in $source_extensions; do + find . -name '*'$source_extension -print +done diff --git a/version.lisp-expr b/version.lisp-expr index 134df11..c8cb11c 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.9.2.39" +"0.9.2.40" -- 1.7.10.4