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