comparison lisp/build-report.el @ 219:262b8bb4a523 r20-4b8

Import from CVS: tag r20-4b8
author cvs
date Mon, 13 Aug 2007 10:09:35 +0200
parents d44af0c54775
children 85a06df23a9a
comparison
equal deleted inserted replaced
218:c9f226976f56 219:262b8bb4a523
1 ;;; xemacs-build-report.el --- Automatically formatted build reports for XEmacs 1 ;;; build-report.el --- Automatically formatted build reports for XEmacs
2 2
3 ;; Copyright (C) 1997 Adrian Aichner 3 ;; Copyright (C) 1997 Adrian Aichner
4 4
5 ;; Author: Adrian Aichner, Teradyne GmbH Munich <aichner@ecf.teradyne.com> 5 ;; Author: Adrian Aichner, Teradyne GmbH Munich <aichner@ecf.teradyne.com>
6 ;; Date: Sun., Apr. 20, 1997. 6 ;; Date: Sun., Apr. 20, 1997.
7 ;; Version: 1.28 7 ;; Version: 1.35
8 ;; Keywords: internal 8 ;; Keywords: internal
9 9
10 ;; This file is part of XEmacs. 10 ;; This file is part of XEmacs.
11 11
12 ;; XEmacs is free software; you can redistribute it and/or modify 12 ;; XEmacs is free software; you can redistribute it and/or modify
31 ;; The Idea: 31 ;; The Idea:
32 ;; Let XEmacs report interesting aspects of how it was built. 32 ;; Let XEmacs report interesting aspects of how it was built.
33 33
34 ;; The Concept: 34 ;; The Concept:
35 ;; User creates an XEmacs Build Report by just calling 35 ;; User creates an XEmacs Build Report by just calling
36 ;; M-x xemacs-create-build-report 36 ;; M-x build-report
37 ;; which will initialize a mail buffer with relevant information 37 ;; which will initialize a mail buffer with relevant information
38 ;; derived from the XEmacs build process. Point is left at the 38 ;; derived from the XEmacs build process. Point is left at the
39 ;; beginning of the report for user to input some personal notes and 39 ;; beginning of the report for user to input some personal notes and
40 ;; send the report. 40 ;; send the report.
41 41
46 ;; Adrian Aichner, Teradyne GmbH Munich, Sun., Apr. 20, 1997. 46 ;; Adrian Aichner, Teradyne GmbH Munich, Sun., Apr. 20, 1997.
47 47
48 ;;; Code: 48 ;;; Code:
49 49
50 (require 'config) 50 (require 'config)
51 (provide 'xemacs-build-report) 51 (provide 'build-report)
52 52
53 ;; Due to recommandation by developers on xemacs-beta@xemacs.org, 53 ;; Due to recommandation by developers on xemacs-beta@xemacs.org,
54 ;; release versions are to be checked out using `co -u -kv ...'. 54 ;; release versions are to be checked out using `co -u -kv ...'.
55 (defconst xemacs-build-report-version 55 (defconst build-report-version
56 "1.28" 56 "1.35"
57 "Version number of xemacs-build-report.") 57 "Version number of build-report.")
58 58
59 (defgroup xemacs-build-report nil 59 (defgroup build-report nil
60 "Package automating the process of sending Xemacs Build Reports.") 60 "Package automating the process of sending XEmacs Build Reports."
61 61 :group 'build)
62 (defcustom xemacs-build-report-destination 62
63 (defcustom build-report-destination
63 "xemacs-beta@xemacs.org" 64 "xemacs-beta@xemacs.org"
64 "The mail address XEmacs Build Reports should go to." 65 "The mail address XEmacs Build Reports should go to."
65 :group 'xemacs-build-report) 66 :type 'string
66 67 :group 'build-report)
67 (defcustom xemacs-build-report-keep-regexp 68
68 "make\\[\\|error\\|warn\\|pure.*\\(space\\|size\\)\\|hides\\b\\|strange\\|shadowings" 69 (defcustom build-report-keep-regexp
70 (list
71 "make\\["
72 "error"
73 "warn"
74 "pure.*\\(space\\|size\\)"
75 "hides\\b"
76 "strange"
77 "shadowings"
78 "^Compilation"
79 "not\\s-+found")
69 "Regexp of make process output lines to keep in the report." 80 "Regexp of make process output lines to keep in the report."
70 :group 'xemacs-build-report) 81 :type '(repeat regexp)
71 82 :group 'build-report)
72 (defcustom xemacs-build-report-delete-regexp 83
73 "confl.*with.*auto-inlining" 84 (defcustom build-report-delete-regexp
85 (list
86 "confl.*with.*auto-inlining")
74 "Regexp of make process output lines to delete from the report." 87 "Regexp of make process output lines to delete from the report."
75 :group 'xemacs-build-report) 88 :type '(repeat regexp)
76 89 :group 'build-report)
77 (defcustom xemacs-build-report-make-output-file 90
91 (defcustom build-report-make-output-file
78 (concat (gethash 'blddir (config-value-hash-table)) "/beta.err") 92 (concat (gethash 'blddir (config-value-hash-table)) "/beta.err")
79 "Filename where stdout and stderr of XEmacs make process have been stored. 93 "Filename where stdout and stderr of XEmacs make process have been stored.
80 mk.err will not be created automatically. You'll have to run make with 94 mk.err will not be created automatically. You'll have to run make with
81 output redirection. I use an alias 95 output redirection. I use an alias
82 alias mk 'make \!* >>&\! \!$.err &' 96 alias mk 'make \!* >>&\! \!$.err &'
83 for that, so that I get beta.err went I run `mk beta'." 97 for that, so that I get beta.err went I run `mk beta'."
84 :group 'xemacs-build-report) 98 :type 'file
85 99 :group 'build-report)
86 (defcustom xemacs-build-report-installation-file 100
101 (defcustom build-report-installation-file
87 (concat (gethash 'blddir (config-value-hash-table)) "/Installation") 102 (concat (gethash 'blddir (config-value-hash-table)) "/Installation")
88 "Installation file produced by XEmacs configure process." 103 "Installation file produced by XEmacs configure process."
89 :group 'xemacs-build-report) 104 :type 'file
90 105 :group 'build-report)
91 (defcustom xemacs-build-report-subject 106
107 (defcustom build-report-installation-insert-all nil
108 "Tell build-report to insert the whole Installation file
109 instead of just the last report."
110 :type 'boolean
111 :group 'build-report)
112
113 (defcustom build-report-subject
92 (concat "[%s] " emacs-version " on " system-configuration) 114 (concat "[%s] " emacs-version " on " system-configuration)
93 "XEmacs Build Report Subject Line. %s-sequences will be substituted 115 "XEmacs Build Report Subject Line. %s-sequences will be substituted
94 with user input through `xemacs-create-build-report' according to 116 with user input through `build-report' according to
95 `xemacs-build-report-prompts' using `format'." 117 `build-report-prompts' using `format'."
96 :group 'xemacs-build-report) 118 :type 'string
97 119 :group 'build-report)
98 (defcustom xemacs-build-report-prompts 120
121 (defcustom build-report-prompts
99 '(("Status?: " "Success" "Failure")) 122 '(("Status?: " "Success" "Failure"))
100 "XEmacs Build Report Prompt(s). This is a list of prompt-string 123 "XEmacs Build Report Prompt(s). This is a list of prompt-string
101 lists used by `xemacs-create-build-report' in conjunction with 124 lists used by `build-report' in conjunction with
102 `xemacs-build-report-subject'. Each list consists of a prompt string 125 `build-report-subject'. Each list consists of a prompt string
103 followed by any number of strings which can be chosen via the history 126 followed by any number of strings which can be chosen via the history
104 mechanism." 127 mechanism."
105 :group 'xemacs-build-report) 128 :group 'build-report)
106 129
107 (defcustom xemacs-build-report-file-encoding 130 (defcustom build-report-file-encoding
108 "7bit" 131 "7bit"
109 "XEmacs Build Report File Encoding to be used when MIME support is 132 "XEmacs Build Report File Encoding to be used when MIME support is
110 available." 133 available."
111 :group 'xemacs-build-report) 134 :group 'build-report)
112 135
113 ;; Symbol Name mappings from TM to SEMI serving as 136 ;; Symbol Name mappings from TM to SEMI serving as Compatibility
114 ;; Compatibility Bandaid 137 ;; Bandaid
115 ;; If 'mime-editor/version-name is bound, we must be using TM(-edit). 138 (when (featurep 'mime-setup)
116 (if (featurep 'mime-setup) 139 ;; No (defvaralias ...) so far. Thanks to "Didier Verna"
117 (if (locate-library "tm-edit") 140 ;; <verna@inf.enst.fr> for reporting my incorrect defvaraliasing of
118 (progn 141 ;; `mime-editor/insert-tag'.
119 ;; No (defvaralias ...) so far. T 142 ;; Thanks to Jens-Ulrik Holger Petersen
120 ;; Thanks to "Didier Verna" verna@inf.enst.fr for reporting my 143 ;; <petersen@kurims.kyoto-u.ac.jp> for suggesting the conditional
121 ;; incorrect defvaraliasing of `mime-editor/insert-tag'. 144 ;; aliasing of SEMI functions.
122 (defalias 145 (unless (fboundp 'mime-edit-content-beginning)
123 'mime-edit-insert-tag 146 (defalias 'mime-edit-content-beginning 'mime-editor/content-beginning))
124 'mime-editor/insert-tag 147 (unless (fboundp 'mime-edit-insert-tag)
125 ) 148 (defalias 'mime-edit-insert-tag 'mime-editor/insert-tag))
126 (defalias 149 (unless (fboundp 'mime-edit-insert-binary-file)
127 'mime-edit-insert-binary-file 150 (defalias 'mime-edit-insert-binary-file
128 'mime-editor/insert-binary-file 151 'mime-editor/insert-binary-file)))
129 )))) 152
130 153 (defun build-report (&rest args)
131 (defun xemacs-create-build-report (&rest args) 154 "Initializes a fresh mail composition buffer using `compose-mail'
132 "Initializes a fresh mail-mode buffer with the contents of XEmacs 155 with the contents of XEmacs Installation file and excerpts from XEmacs
133 Installation file and excerpts from XEmacs make output and errors and 156 make output and errors and leaves point at the beginning of the mail text.
134 leaves point at the beginning of the mail text. See also 157 See also
135 `xemacs-build-report-destination', 158 `compose-mail', `mail-user-agent',
136 `xemacs-build-report-keep-regexp', 159 `build-report-destination',
137 `xemacs-build-report-delete-regexp', 160 `build-report-keep-regexp',
138 `xemacs-build-report-make-output-file' and 161 `build-report-delete-regexp',
139 `xemacs-build-report-installation-file'." 162 `build-report-make-output-file' and
163 `build-report-installation-file'."
140 (interactive 164 (interactive
141 (let (prompt 165 (let (prompt
142 hist 166 hist
143 arg 167 arg
144 (prompts xemacs-build-report-prompts)) 168 (prompts build-report-prompts))
145 (progn 169 (progn
146 (while prompts 170 (while prompts
147 (setq prompt (caar prompts)) 171 (setq prompt (caar prompts))
148 (setq hist (cdar prompts)) 172 (setq hist (cdar prompts))
149 (setq prompts (cdr prompts)) 173 (setq prompts (cdr prompts))
150 (setq arg (cons (read-string prompt "" 'hist) arg))) 174 (setq arg (cons (read-string prompt "" 'hist) arg)))
151 arg))) 175 arg)))
152 (save-excursion 176 (save-excursion
153 (compose-mail 177 (compose-mail
154 xemacs-build-report-destination 178 build-report-destination
155 (apply 'format xemacs-build-report-subject args) 179 (apply 'format build-report-subject args)
156 nil 180 nil
157 nil 181 nil
158 nil 182 nil
159 nil 183 nil
160 nil) 184 nil)
161 (let ((report-begin (mail-text))) 185 (let ((report-begin (point)))
162 (xemacs-build-report-insert-make-output report-begin) 186 (insert (build-report-insert-make-output report-begin))
163 (xemacs-build-report-insert-installation-file report-begin) 187 (insert (build-report-insert-installation-file
164 (xemacs-build-report-insert-header report-begin) 188 report-begin
165 ))) 189 build-report-installation-insert-all))
166 190 (insert (build-report-insert-header report-begin))
167 (defun xemacs-build-report-insert-header (where) 191 (goto-char report-begin))))
168 "Inserts the xemacs-build-report-header at the point specified by `where'." 192
193 (defun build-report-insert-header (where)
194 "Inserts the build-report-header at the point specified by `where'."
169 (goto-char where) 195 (goto-char where)
170 (insert "\n> XEmacs Build Report as generated\n> by " 196 (with-temp-buffer
171 "xemacs-build-report-version " 197 (insert "\n> XEmacs Build Report as generated\n> by"
172 xemacs-build-report-version 198 " build-report-version "
173 " follows:\n\n")) 199 build-report-version " follows:\n\n")
174 200 (buffer-string)))
175 (defun xemacs-build-report-insert-make-output (where) 201
202 (defun build-report-insert-make-output (where)
176 "Inserts the output of the XEmacs Beta make run. 203 "Inserts the output of the XEmacs Beta make run.
177 The make process output must have been saved in 204 The make process output must have been saved in
178 `xemacs-build-report-make-output-file' during the XEmacs Beta building." 205 `build-report-make-output-file' during the XEmacs Beta building."
179 (goto-char where) 206 (goto-char where)
180 (if (file-exists-p xemacs-build-report-make-output-file) 207 (with-temp-buffer
181 (progn 208 (if (file-exists-p build-report-make-output-file)
182 (if (featurep 'mime-setup) 209 (progn
183 (progn 210 (if (featurep 'mime-setup)
184 (setq xemacs-build-report-keep-regexp 211 (progn
185 (concat "^--\\[\\[\\|\\]\\]$\\|" 212 (mime-edit-insert-tag
186 xemacs-build-report-keep-regexp)) 213 "text"
187 (mime-edit-insert-tag 214 "plain"
188 "application" 215 (concat
189 "octet-stream" 216 "\nContent-Disposition: attachment;"
190 (concat 217 " filename=\""
191 "\nContent-Disposition: attachment;" 218 (file-name-nondirectory
192 " filename=\"" 219 build-report-make-output-file)
193 (file-name-nondirectory 220 "\""))
194 xemacs-build-report-make-output-file) 221 (mime-edit-insert-binary-file
195 "\"")) 222 build-report-make-output-file
196 (mime-edit-insert-binary-file 223 build-report-file-encoding))
197 xemacs-build-report-make-output-file 224 (insert-file-contents build-report-make-output-file))
198 xemacs-build-report-file-encoding)) 225 (goto-char (point-min))
199 (insert-file-contents xemacs-build-report-make-output-file)) 226 (delete-non-matching-lines (build-report-keep))
200 (goto-char where) 227 (goto-char (point-min))
201 (delete-non-matching-lines 228 (delete-matching-lines (build-report-delete))
202 xemacs-build-report-keep-regexp) 229 (goto-char (point-min))
203 (goto-char where) 230 (insert "> Contents of "
204 (delete-matching-lines xemacs-build-report-delete-regexp) 231 build-report-make-output-file
205 (goto-char where) 232 "\n> keeping lines matching\n> \""
206 (insert "> Contents of " 233 (build-report-keep)
207 xemacs-build-report-make-output-file 234 "\"\n> and then deleting lines matching\n> \""
208 "\n> keeping lines matching\n> \"" 235 (build-report-delete)
209 xemacs-build-report-keep-regexp 236 "\"\n\n"))
210 "\"\n> and then deleting lines matching\n> \"" 237 (insert "> " build-report-make-output-file
211 xemacs-build-report-delete-regexp 238 " does not exist!\n\n"))
212 "\"\n\n")) 239 (buffer-string)))
213 (insert "> " xemacs-build-report-make-output-file
214 " does not exist!\n\n")))
215 240
216 (defun xemacs-build-report-insert-installation-file (where) 241 (defun build-report-insert-installation-file (where all)
217 "Inserts the contents of the `xemacs-build-report-installation-file' 242 "Inserts the contents of the `build-report-installation-file'
218 created by the XEmacs Beta configure process." 243 created by the XEmacs Beta configure process."
219 (goto-char where) 244 (goto-char where)
220 (if (file-exists-p xemacs-build-report-installation-file) 245 (with-temp-buffer
221 (progn 246 (if (file-exists-p build-report-installation-file)
222 (insert "> Contents of " 247 (let (file-begin last-configure)
223 xemacs-build-report-installation-file 248 (insert "> Contents of "
224 ":\n\n") 249 build-report-installation-file
225 (if (featurep 'mime-setup) 250 ":\n")
226 (progn 251 (insert
227 (mime-edit-insert-tag 252 (format
228 "application" 253 "> (Output from %s of ./configure)\n\n"
229 "octet-stream" 254 (if all "all runs" "most recent run")))
230 (concat 255 (if (featurep 'mime-setup)
231 "\nContent-Disposition: attachment;" 256 (progn
232 " filename=\"" 257 (mime-edit-insert-tag
233 (file-name-nondirectory 258 "text"
234 xemacs-build-report-installation-file) 259 "plain"
235 "\"")) 260 (concat
236 (mime-edit-insert-binary-file 261 "\nContent-Disposition: attachment;"
237 xemacs-build-report-installation-file 262 " filename=\""
238 xemacs-build-report-file-encoding)) 263 (file-name-nondirectory
239 (insert-file-contents xemacs-build-report-installation-file))) 264 build-report-installation-file)
240 (insert "> " xemacs-build-report-installation-file 265 "\""))
241 " does not exist!\n\n"))) 266 (mime-edit-insert-binary-file
242 267 build-report-installation-file
243 ;;; xemacs-build-report.el ends here 268 build-report-file-encoding)
269 (setq file-begin (mime-edit-content-beginning)))
270 (setq file-begin (point))
271 (insert-file-contents
272 build-report-installation-file))
273 (unless all
274 (setq last-configure
275 (search-backward-regexp
276 "^\\(uname.*\\|osversion\\):\\s-+" file-begin t))
277 (if (and file-begin last-configure)
278 (delete-region file-begin last-configure))))
279 (insert "> " build-report-installation-file
280 " does not exist!\n\n"))
281 (buffer-string)))
282
283 (defun build-report-keep ()
284 "build-report-internal fuction of no general value."
285 (mapconcat '(lambda (item) item)
286 (cons "^--\\[\\[\\|\\]\\]$" build-report-keep-regexp) "\\|"))
287
288 (defun build-report-delete ()
289 "build-report-internal fuction of no general value."
290 (mapconcat '(lambda (item) item)
291 build-report-delete-regexp "\\|"))
292
293 ;;; build-report.el ends here