2
# $Id: srclist-update,v 1.19 2007/03/30 23:44:27 karl Exp $
4
# Check for files in directory $1 being up to date, according to the
5
# list on stdin. Don't actually make any changes, just show the diffs.
7
# Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
9
# This program is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2, or (at your option)
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
19
# You should have received a copy of the GNU General Public License
20
# along with this program; if not, write to the Free Software Foundation,
21
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23
# Originally written by Karl Berry.
31
#chicken="echo (would)"
34
dsttmp=$TMPDIR/srclist.dst
36
# Source `dirname $0`/srclistvars.sh first, if it exists.
38
test -r $mydir/srclistvars.sh && . $mydir/srclistvars.sh
42
# sed command to fix the license to be GPL.
44
/^[[:space:]]*#[[:space:]]*Th[ei][ s].* is free software/,/^[[:space:]]*#.*USA\./c\
45
# This program is free software; you can redistribute it and/or modify\
46
# it under the terms of the GNU General Public License as published by\
47
# the Free Software Foundation; either version 2, or (at your option)\
50
# This program is distributed in the hope that it will be useful,\
51
# but WITHOUT ANY WARRANTY; without even the implied warranty of\
52
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
53
# GNU General Public License for more details.\
55
# You should have received a copy of the GNU General Public License along\
56
# with this program; if not, write to the Free Software Foundation,\
57
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
59
/Th[ei][ s].* is free software/,/\*\//c\
60
This program is free software; you can redistribute it and/or modify\
61
it under the terms of the GNU General Public License as published by\
62
the Free Software Foundation; either version 2, or (at your option)\
65
This program is distributed in the hope that it will be useful,\
66
but WITHOUT ANY WARRANTY; without even the implied warranty of\
67
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
68
GNU General Public License for more details.\
70
You should have received a copy of the GNU General Public License along\
71
with this program; if not, write to the Free Software Foundation,\
72
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
75
# sed command to remove lines containing $Id lines.
76
# Quote the $ so that CVS does not expand it in this script.
77
remove_id_lines='/[$]Id:.*[$]/d'
79
# $1 is input file, $2 is output.
80
# Remove $Id lines, since they'll differ between source locations.
81
# If $options contains "gpl", change the license to be the standard
82
# GPL. We use this for libc files, et al.
86
sed_command="$remove_id_lines"
90
sed_command="$sed_command; $fixlicense";;
93
sed "$sed_command" $1 >$2
98
cat | while read src dst options; do
99
#echo "src=$src, dst=$dst, options=$options" >&2
101
*: ) continue;; # skip lines without second element
102
'#'* ) continue;; # skip comment-only lines
105
# Expand variables and make sure we have an input file.
107
if test ! -r $src; then
108
echo "$0: cannot read $src" >&2
112
# Ignore subdirs in src dir. E.g., if input spec is
113
# src/subdir/foo.c dst
114
# then write destination file dst/foo.c.
116
test -d $dst && dst=$dst/`basename $src`
118
# Fix files in both src and dst, for the sake
119
# of a clean comparison.
120
srctmp=$TMPDIR/`basename $src`
122
test -r $dst && fixfile $dst $dsttmp
124
if test ! -e $dst; then
125
echo "## $srctmp $dst # new"
126
$chicken cp -p $srctmp $dst
127
elif cmp -s $srctmp $dsttmp; then
128
$verbose && echo "## $srctmp $dst # unchanged"
130
echo "## $srctmp $dst # changes"
131
diff -C 2 $dst $srctmp