Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: gdb/copyright.sh

Issue 11969036: Merge GDB 7.5.1 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@master
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gdb/copyright.py ('k') | gdb/corefile.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/sh
2 # Automatically update copyright for GDB, the GNU debugger.
3 #
4 # Copyright (C) 2007-2012 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 either by hand, as needed, or by the copyright.py
48 # script.
49 byhand="
50 *.s
51 *.f
52 *.f90
53 *.igen
54 *.ac
55 *.texi
56 *.texinfo
57 *.tex
58 *.defs
59 *.1
60 *.ads
61 *.adb
62 *.gpr
63 *.inc
64 "
65
66 # Files which should not be modified, either because they are
67 # generated, non-FSF, or otherwise special (e.g. license text,
68 # or test cases which must be sensitive to line numbering).
69 prunes="
70 COPYING
71 COPYING.LIB
72 CVS
73 configure
74 copying.c
75 gdbarch.c
76 gdbarch.h
77 fdl.texi
78 gpl.texi
79 gdbtk
80 gdb.gdbtk
81 osf-share
82 aclocal.m4
83 step-line.inp
84 step-line.c
85 "
86
87 ####
88 # Main program
89 ####
90
91 : ${EMACS:=emacs}
92
93 # Disable filename expansion, so that we can get at the glob patterns
94 # from $byhand.
95 set -f
96
97 version=`$EMACS --version | sed 's/GNU Emacs \([0-9]*\)\..*/\1/; 1q'`
98 if test "$version" -lt 22; then
99 echo "error: $EMACS is too old; use at least an Emacs 22.0.XX snapshot." >&2
100 exit 1
101 fi
102
103 if test $# -lt 1; then
104 dir=.
105 else
106 dir=$1
107 fi
108
109 if ! test -f doc/gdbint.texinfo; then
110 echo "\"$dir\" is not a GDB source directory."
111 exit 1
112 fi
113
114 cat > copytmp.el <<EOF
115 (load "copyright")
116 (setq vc-cvs-stay-local nil
117 message-log-max t)
118 (setq fsf-regexp "Free[#; \t\n]+Software[#; \t\n]+Foundation,[#; \t\n]+Inc\."
119 fsf-copyright-regexp (concat copyright-regexp "[#; \t\n]+" fsf-regexp)
120 generated-regexp "THIS FILE IS MACHINE GENERATED WITH CGEN")
121
122 (defun gdb-copyright-update (filename)
123 (widen)
124 (goto-char (point-min))
125 (if (and (not (re-search-forward generated-regexp (+ (point) copyright-limit) t))
126 (re-search-forward fsf-copyright-regexp (+ (point) copyright-limit) t ))
127 (progn
128 (setq copyright-update t
129 copyright-query nil
130 fill-column 78
131 start (copy-marker (match-beginning 0))
132 end (progn
133 (re-search-backward fsf-regexp)
134 (re-search-forward fsf-regexp
135 (+ (point) copyright-limit) t)
136 (point-marker))
137 fsf-start (copy-marker (match-beginning 0)))
138 (replace-match "Free_Software_Foundation,_Inc." t t)
139 (copyright-update)
140 (fill-region-as-paragraph start end)
141 (replace-string "_" " " nil fsf-start end))
142 (message (concat "WARNING: No copyright message found in " filename))))
143
144 EOF
145
146 for f in $prunes $byhand; do
147 prune_opts="$prune_opts -name $f -prune -o"
148 done
149
150 for f in $(find "$dir" "$dir/../include/gdb" "$dir/../sim" \
151 $prune_opts -type f -print); do
152 cat >> copytmp.el <<EOF
153 (switch-to-buffer (find-file "$f"))
154 (setq backup-inhibited t)
155 (setq write-file-hooks '())
156 (gdb-copyright-update "$f")
157 (save-buffer)
158 (kill-buffer (buffer-name))
159 EOF
160 done
161
162 cat >> copytmp.el <<EOF
163 (delete-file "copytmp.el")
164 ;; Comment out the next line to examine the message buffer.
165 (kill-emacs)
166 EOF
167
168 $EMACS --no-site-file -q -l ./copytmp.el
169
170 python $dir/copyright.py
OLDNEW
« no previous file with comments | « gdb/copyright.py ('k') | gdb/corefile.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698