1 ;;; build-report.el --- Automatically formatted build reports for XEmacs
3 ;; Copyright (C) 1997 Adrian Aichner
5 ;; Author: Adrian Aichner, Teradyne GmbH Munich <aichner@ecf.teradyne.com>
6 ;; Date: Sun., Apr. 20, 1997.
10 ;; This file is part of XEmacs.
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)
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.
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
27 ;;; Synched up with: Not synched.
32 ;; Let XEmacs report interesting aspects of how it was built.
35 ;; User creates an XEmacs Build Report by just calling
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
43 ;; This is the first `Proof of Concept'.
46 ;; Adrian Aichner, Teradyne GmbH Munich, Sun., Apr. 20, 1997.
51 (provide 'build-report)
53 ;; Due to recommendation by developers on xemacs-beta@xemacs.org,
54 ;; release versions are to be checked out using `co -u -kv ...'.
55 (defconst build-report-version
57 "Version number of build-report.")
59 (defgroup build-report nil
60 "Package automating the process of sending XEmacs Build Reports."
63 (defcustom build-report-destination
64 "xemacs-build-reports@xemacs.org"
65 "The mail address XEmacs Build Reports should go to."
69 (defcustom build-report-keep-regexp
74 "pure.*\\(space\\|size\\)"
80 "Regexp of make process output lines to keep in the report."
81 :type '(repeat regexp)
84 (defcustom build-report-delete-regexp
86 "confl.*with.*auto-inlining"
87 (concat (regexp-quote (gethash 'blddir (config-value-hash-table))) "/lisp/[^ \t\n]+ hides "))
88 "Regexp of make process output lines to delete from the report."
89 :type '(repeat regexp)
92 (defcustom build-report-make-output-file
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'."
100 :group 'build-report)
102 (defcustom build-report-installation-file
103 (concat (gethash 'blddir (config-value-hash-table)) "/Installation")
104 "Installation file produced by XEmacs configure process."
106 :group 'build-report)
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."
112 :group 'build-report)
114 (defcustom build-report-subject
115 (concat "[%s] " emacs-version " on " system-configuration)
116 "XEmacs Build Report Subject Line. %s-sequences will be substituted
117 with user input through `build-report' according to
118 `build-report-prompts' using `format'."
120 :group 'build-report)
122 (defcustom build-report-prompts
123 '(("Status?: " "Success" "Failure"))
124 "XEmacs Build Report Prompt(s). This is a list of prompt-string
125 lists used by `build-report' in conjunction with
126 `build-report-subject'. Each list consists of a prompt string
127 followed by any number of strings which can be chosen via the history
129 :group 'build-report)
131 (defcustom build-report-file-encoding
133 "XEmacs Build Report File Encoding to be used when MIME support is
135 :group 'build-report)
137 ;; Symbol Name mappings from TM to SEMI serving as Compatibility
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)))
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.
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'."
169 (prompts build-report-prompts))
173 (setq prompt (caar prompts))
174 (setq hist (cdar prompts))
175 (setq prompts (cdr prompts))
176 (setq arg (cons (read-string prompt "" 'hist) arg)))
180 build-report-destination
181 (apply 'format build-report-subject args)
187 (let ((report-begin (point)))
188 (insert (build-report-insert-make-output report-begin))
189 (insert (build-report-insert-installation-file
191 build-report-installation-insert-all))
192 (insert (build-report-insert-header report-begin))
193 (goto-char report-begin))))
195 (defun build-report-insert-header (where)
196 "Inserts the build-report-header at the point specified by `where'."
199 (insert "\n> XEmacs Build Report as generated\n> by"
200 " build-report-version "
201 build-report-version " follows:\n\n")
204 (defun build-report-insert-make-output (where)
205 "Inserts the output of the XEmacs Beta make run.
206 The make process output must have been saved in
207 `build-report-make-output-file' during the XEmacs Beta building."
210 (if (file-exists-p build-report-make-output-file)
212 (if (featurep 'mime-setup)
214 (mime-edit-insert-tag
218 "\nContent-Disposition: attachment;"
220 (file-name-nondirectory
221 build-report-make-output-file)
223 (mime-edit-insert-binary-file
224 build-report-make-output-file
225 build-report-file-encoding))
226 (insert-file-contents build-report-make-output-file))
227 (goto-char (point-min))
228 (delete-non-matching-lines (build-report-keep))
229 (goto-char (point-min))
230 (delete-matching-lines (build-report-delete))
231 (goto-char (point-min))
232 (insert "> Contents of "
233 build-report-make-output-file
234 "\n> keeping lines matching\n> \""
236 "\"\n> and then deleting lines matching\n> \""
237 (build-report-delete)
239 (insert "> " build-report-make-output-file
240 " does not exist!\n\n"))
243 (defun build-report-insert-installation-file (where all)
244 "Inserts the contents of the `build-report-installation-file'
245 created by the XEmacs Beta configure process."
248 (if (file-exists-p build-report-installation-file)
249 (let (file-begin last-configure)
250 (insert "> Contents of "
251 build-report-installation-file
255 "> (Output from %s of ./configure)\n\n"
256 (if all "all runs" "most recent run")))
257 (if (featurep 'mime-setup)
259 (mime-edit-insert-tag
263 "\nContent-Disposition: attachment;"
265 (file-name-nondirectory
266 build-report-installation-file)
268 (mime-edit-insert-binary-file
269 build-report-installation-file
270 build-report-file-encoding)
271 (setq file-begin (mime-edit-content-beginning)))
272 (setq file-begin (point))
273 (insert-file-contents
274 build-report-installation-file))
277 (search-backward-regexp
278 "^\\(uname.*\\|osversion\\):\\s-+" file-begin t))
279 (if (and file-begin last-configure)
280 (delete-region file-begin last-configure))))
281 (insert "> " build-report-installation-file
282 " does not exist!\n\n"))
285 (defun build-report-keep ()
286 "build-report-internal function of no general value."
287 (mapconcat #'identity
288 (cons "^--\\[\\[\\|\\]\\]$" build-report-keep-regexp) "\\|"))
290 (defun build-report-delete ()
291 "build-report-internal function of no general value."
292 (mapconcat #'identity
293 build-report-delete-regexp "\\|"))
295 ;;; build-report.el ends here