OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [copyright.sh] - Blame information for rev 272

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 24 jeremybenn
#!/bin/sh
2
# Automatically update copyright for GDB, the GNU debugger.
3
#
4
# Copyright (C) 2007, 2008 Free Software Foundation, Inc.
5
#
6
# This file is part of GDB.
7
#
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 3 of the License, or
11
# (at your option) any later version.
12
#
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
# GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License
19
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
 
21
# Usage: cd src/gdb && sh ./copyright.sh
22
# To use a different version of emacs, set the EMACS environment
23
# variable before running.
24
 
25
# After running, update those files mentioned in $byhand by hand.
26
# Always review the output of this script before committing it!
27
# A useful command to review the output is:
28
#  filterdiff -x \*.c -x \*.cc -x \*.h -x \*.exp updates.diff
29
# This removes the bulk of the changes which are most likely
30
# to be correct.
31
 
32
####
33
# Configuration
34
####
35
 
36
# As of Emacs 22.0 (snapshot), wrapping and copyright updating do not
37
# handle these file types - all reasonable:
38
#  Assembly (weird comment characters, e.g. "!"); .S usually has C
39
#            comments, which are fine)
40
#  Fortran ("c" comment character)
41
#  igen
42
#  Autoconf input (dnl)
43
#  texinfo (@c)
44
#  tex (%)
45
#  *.defs as C
46
#   man
47
# So these need to be done by hand, as needed
48
byhand="
49
*.s
50
*.f
51
*.f90
52
*.igen
53
*.ac
54
*.texi
55
*.texinfo
56
*.tex
57
*.defs
58
*.1
59
"
60
 
61
# Files which should not be modified, either because they are
62
# generated, non-FSF, or otherwise special (e.g. license text,
63
# or test cases which must be sensitive to line numbering).
64
prunes="
65
COPYING
66
COPYING.LIB
67
CVS
68
configure
69
copying.c
70
gdbarch.c
71
gdbarch.h
72
fdl.texi
73
gpl.texi
74
gdbtk
75
gdb.gdbtk
76
osf-share
77
aclocal.m4
78
step-line.inp
79
step-line.c
80
"
81
 
82
####
83
# Main program
84
####
85
 
86
: ${EMACS:=emacs}
87
 
88
# Disable filename expansion, so that we can get at the glob patterns
89
# from $byhand.
90
set -f
91
 
92
version=`$EMACS --version | sed 's/GNU Emacs \([0-9]*\)\..*/\1/; 1q'`
93
if test "$version" -lt 22; then
94
  echo "error: $EMACS is too old; use at least an Emacs 22.0.XX snapshot." >&2
95
  exit 1
96
fi
97
 
98
if test $# -lt 1; then
99
  dir=.
100
else
101
  dir=$1
102
fi
103
 
104
if ! test -f doc/gdbint.texinfo; then
105
  echo "\"$dir\" is not a GDB source directory."
106
  exit 1
107
fi
108
 
109
cat > copytmp.el <<EOF
110
(load "copyright")
111
(setq vc-cvs-stay-local nil
112
      message-log-max t)
113
(setq fsf-regexp "Free[#; \t\n]+Software[#; \t\n]+Foundation,[#; \t\n]+Inc\."
114
      fsf-copyright-regexp (concat copyright-regexp "[#; \t\n]+" fsf-regexp)
115
      generated-regexp "THIS FILE IS MACHINE GENERATED WITH CGEN")
116
 
117
(defun gdb-copyright-update (filename)
118
  (widen)
119
  (goto-char (point-min))
120
  (if (and (not (re-search-forward generated-regexp (+ (point) copyright-limit) t))
121
           (re-search-forward fsf-copyright-regexp (+ (point) copyright-limit) t))
122
      (progn
123
        (setq copyright-update t
124
              copyright-query nil
125
              fill-column 78
126
              start (copy-marker (match-beginning 0))
127
              end (progn
128
                    (re-search-backward fsf-regexp)
129
                    (re-search-forward fsf-regexp
130
                     (+ (point) copyright-limit) t)
131
                    (point-marker))
132
              fsf-start (copy-marker (match-beginning 0)))
133
        (replace-match "Free_Software_Foundation,_Inc." t t)
134
        (copyright-update)
135
        (fill-region-as-paragraph start end)
136
        (replace-string "_" " " nil fsf-start end))
137
    (message (concat "WARNING: No copyright message found in " filename))))
138
 
139
EOF
140
 
141
for f in $prunes $byhand; do
142
  prune_opts="$prune_opts -name $f -prune -o"
143
done
144
 
145
for f in $(find "$dir" "$dir/../include/gdb" "$dir/../sim" \
146
           $prune_opts -type f -print); do
147
  cat >> copytmp.el <<EOF
148
(switch-to-buffer (find-file "$f"))
149
(setq backup-inhibited t)
150
(setq write-file-hooks '())
151
(gdb-copyright-update "$f")
152
(save-buffer)
153
(kill-buffer (buffer-name))
154
EOF
155
done
156
 
157
cat >> copytmp.el <<EOF
158
(delete-file "copytmp.el")
159
;; Comment out the next line to examine the message buffer.
160
(kill-emacs)
161
EOF
162
 
163
exec $EMACS --no-site-file -q -l ./copytmp.el

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.