summaryrefslogtreecommitdiff
path: root/config/srclist-update
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2002-09-10 23:41:12 +0000
committerKarl Berry <karl@freefriends.org>2002-09-10 23:41:12 +0000
commit3f53294c6ad284644ff21fa9fe52173551b9965b (patch)
tree8d8dabf96c983fdefbcbd9bd1f7f824902fd80f3 /config/srclist-update
parent4334636ced7ef1569aec147035bf5d08c8515830 (diff)
downloadgnulib-3f53294c6ad284644ff21fa9fe52173551b9965b.tar.gz
sync and scripts to check syncness
Diffstat (limited to 'config/srclist-update')
-rwxr-xr-xconfig/srclist-update52
1 files changed, 52 insertions, 0 deletions
diff --git a/config/srclist-update b/config/srclist-update
new file mode 100755
index 0000000000..8fe4698631
--- /dev/null
+++ b/config/srclist-update
@@ -0,0 +1,52 @@
+#!/bin/sh
+# $Id: srclist-update,v 1.1 2002-09-10 23:41:12 karl Exp $
+#
+# Check for files being up to date, according to the list on stdin.
+#
+# Source $mydir/srclistvars.sh first, if it exists, where
+# $mydir=`dirname $0`.
+
+if test -n "$1"; then
+ cd "$1" || exit 1
+fi
+
+verbose=false
+#chicken="echo (would)"
+
+srctmp=${TMPDIR-/tmp}/srclist.src
+dsttmp=${TMPDIR-/tmp}/srclist.dst
+
+mydir=`dirname $0`
+test -r $mydir/srclistvars.sh && . $mydir/srclistvars.sh
+
+cat | while read src dst; do
+ test -z "$dst" && continue # skip lines without second element
+ echo "$src $dst" | sed 's/#.*$//' | egrep '^\s*$' >/dev/null \
+ && continue # skip whitespace and comment-only lines
+
+ src=`eval echo $src`
+ if test ! -r $src; then
+ echo "$0: cannot read $src" >&2
+ continue
+ fi
+
+ # If given src/foo.c dst, copy to dst/foo.c.
+ dst=`eval echo $dst`
+ test -d $dst && dst=$dst/`basename $src`
+
+ # $ Id: lines will differ.
+ fgrep -v '$'"Id:" $src >$srctmp
+ test -r $dst && fgrep -v '$'"Id:" $dst >$dsttmp
+
+ if test ! -e $dst; then
+ echo "## $src $dst # new"
+ $chicken cp -p $src $dst
+ elif cmp -s $srctmp $dsttmp; then
+ $verbose && echo "## $src $dst # unchanged"
+ else
+ echo "## $src $dst # changes"
+ diff -c2 $src $dst
+ fi
+done
+
+rm -f $srctmp $dsttmp