Mercurial > hg > xemacs-beta
annotate lisp/build-report.el @ 5839:d139eb1fead8
Check return value of fseek.
| author | Marcus Crestani <marcus@crestani.de> |
|---|---|
| date | Sat, 13 Dec 2014 14:09:33 +0100 |
| parents | 308d34e9f07d |
| children |
| rev | line source |
|---|---|
| 428 | 1 ;;; build-report.el --- Automatically formatted build reports for XEmacs |
| 2 | |
| 2976 | 3 ;; Copyright (C) 1997-2003 Adrian Aichner |
| 428 | 4 |
| 434 | 5 ;; Author: Adrian Aichner <adrian@xemacs.org> |
| 4021 | 6 ;; Date: $Date: 2007/06/21 13:39:10 $ |
| 7 ;; Version: $Revision: 1.15 $ | |
| 428 | 8 ;; Keywords: internal |
| 9 | |
| 10 ;; This file is part of XEmacs. | |
| 11 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
12 ;; XEmacs is free software: you can redistribute it and/or modify it |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
13 ;; under the terms of the GNU General Public License as published by the |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
14 ;; Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
15 ;; option) any later version. |
| 428 | 16 |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
17 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
18 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
19 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
20 ;; for more details. |
| 428 | 21 |
| 22 ;; You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4419
diff
changeset
|
23 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
| 428 | 24 |
| 3008 | 25 ;;; Synched up with: XEmacs build package build-report.el Revision 1.49. |
| 428 | 26 |
| 27 ;;; Commentary: | |
| 28 | |
| 29 ;; The Idea: | |
| 30 ;; Let XEmacs report interesting aspects of how it was built. | |
| 31 | |
| 32 ;; The Concept: | |
| 33 ;; User creates an XEmacs Build Report by just calling | |
| 34 ;; M-x build-report | |
| 35 ;; which will initialize a mail buffer with relevant information | |
| 36 ;; derived from the XEmacs build process. Point is left at the | |
| 37 ;; beginning of the report for user to input some personal notes and | |
| 38 ;; send the report. | |
| 39 | |
| 40 ;; The Status: | |
| 41 ;; This is the first `Proof of Concept'. | |
| 42 | |
| 43 ;; The Author: | |
| 44 ;; Adrian Aichner, Teradyne GmbH Munich, Sun., Apr. 20, 1997. | |
| 45 | |
| 46 ;;; Code: | |
| 47 | |
| 48 (require 'config) | |
| 442 | 49 (require 'custom) |
| 50 (require 'cl) | |
| 428 | 51 (provide 'build-report) |
| 52 | |
| 442 | 53 ;;; Constant definitions used internally by `build-report'. These are not |
| 54 ;;; anticipated to be changed by users of `build-report'. | |
| 55 ;;; If users do need to change the value of any of these, they need to do | |
| 56 ;;; it after `build-report' has been loaded (not just required). Please | |
| 57 ;;; report it to the maintainers of `build-report' when you think you | |
| 58 ;;; need to do this. | |
| 59 (defconst build-report-installation-version-regexp | |
| 975 | 60 "XEmacs\\s-+\\([0-9]+\\)\\.\\([0-9]+\\)\\(\\(-b\\|\\.\\)\\([0-9]+\\)\\)?\\s-+\\\\?\"\\([^\\\"]+\\)\\\\?\"\\s-+\\(.*\\)?configured\\s-+for\\s-+`\\(.+\\)'\\." |
| 442 | 61 "*REGEXP matching XEmacs Beta Version string in |
| 62 `build-report-installation-file' file. This variable is used by | |
| 63 `build-report-installation-data'.") | |
| 64 | |
| 65 (defconst build-report-version-file-regexp | |
| 66 "emacs_major_version\\s-*=\\s-*\\([0-9]+\\) | |
| 67 emacs_minor_version\\s-*=\\s-*\\([0-9]+\\) | |
| 68 emacs_beta_version\\s-*=\\s-*\\([0-9]+\\)? | |
| 2976 | 69 xemacs_codename\\s-*=\\s-*\"\\([^\"]+\\)\"\\( |
|
4419
eb82fbb675ea
Use Mercurial changeset hash to identify build version.
Mike Sperber <sperber@deinprogramm.de>
parents:
4021
diff
changeset
|
70 xemacs_extra_name\\s-*=\\s-*\"?\\([^\"]+\\)\"?\\)?" |
| 442 | 71 "*REGEXP matching XEmacs Beta Version variable assignments in |
| 72 `build-report-version-file' file. This variable is used by | |
| 73 `build-report-version-file-data'.") | |
| 74 | |
| 75 (defconst build-report-installation-srcdir-regexp | |
| 76 "\\s-*Where should the build process find the source code\\?\\s-*\\(.*\\)$" | |
| 77 "REGEXP matching XEmacs Beta srcdir as the first substring match in | |
| 78 `build-report-installation-file' file. This variable is used by | |
| 79 `build-report-installation-data'.") | |
| 80 | |
| 81 ;;; Customization support for build-report starts here. | |
| 428 | 82 |
| 83 (defgroup build-report nil | |
| 442 | 84 "Standardizes the Creation of XEmacs Build Reports." |
| 85 :load 'build-report | |
| 428 | 86 :group 'build) |
| 87 | |
| 88 (defcustom build-report-destination | |
| 460 | 89 (list |
| 90 "XEmacs Build Reports List <xemacs-buildreports@xemacs.org>" | |
| 91 "XEmacs Beta List <xemacs-beta@xemacs.org>") | |
| 442 | 92 "*The list of mail addresses XEmacs Build Reports should most likely |
| 93 go to." | |
| 94 :type '(repeat | |
| 95 :custom-show t | |
| 96 :documentation-shown t | |
| 97 string) | |
| 428 | 98 :group 'build-report) |
| 99 | |
| 100 (defcustom build-report-keep-regexp | |
| 460 | 101 (list |
| 102 "^\\(cd\\|n?make\\)\\s-" | |
| 103 "errors?" | |
| 104 "warnings?" | |
| 105 "pure.*\\(space\\|size\\)" | |
| 106 "hides\\b" | |
| 107 "strange" | |
| 108 "shadowings" | |
| 109 "^Compil\\(ing\\s-+in\\|ation\\)" | |
| 110 "^Using" | |
| 111 "not\\s-+found" | |
| 112 "^While\\s-+compiling.*\\(\n\\s-+.+\\)*" | |
| 113 "^Note:" | |
| 114 "Installing" | |
| 115 "[Ff]ile(s) copied" | |
| 2976 | 116 "\\s-+tests\\s-+" |
| 117 "^[A-Z] [^ ]+$" | |
| 118 "^Wrong number of arguments:" | |
| 119 "^ \\*\\* " | |
| 120 "^\\(FAIL\\|SKIP\\):") | |
| 442 | 121 "*Regexp of make process output lines to keep in the report." |
| 122 :type '(repeat | |
| 123 :custom-show t | |
| 124 :documentation-shown t | |
| 125 regexp) | |
| 428 | 126 :group 'build-report) |
| 127 | |
| 128 (defcustom build-report-delete-regexp | |
| 460 | 129 (list |
| 130 "confl.*with.*auto-inlining" | |
| 131 "^Formatting:" | |
| 2976 | 132 "^\\s-*0 .*\\(failure\\|error\\)s?" |
| 133 "^PASS:" | |
| 460 | 134 "(100%) tests successful") |
| 442 | 135 "*Regexp of make process output lines to delete from the report." |
| 136 :type '(repeat | |
| 137 :custom-show t | |
| 138 :documentation-shown t | |
| 139 regexp) | |
| 428 | 140 :group 'build-report) |
| 141 | |
| 442 | 142 (defcustom build-report-make-output-dir |
| 143 (cond | |
| 144 ((equal system-type 'windows-nt) | |
| 145 (expand-file-name "nt" | |
| 146 (gethash 'blddir (config-value-hash-table)))) | |
| 147 (t | |
| 148 (gethash 'blddir (config-value-hash-table)))) | |
| 149 "*Directory where the build report file is found. | |
| 150 If this is empty or nil, the default, it is replaced by the value of | |
| 151 the XEmacs build directory." | |
| 152 :type '(directory | |
| 153 :custom-show t | |
| 154 :documentation-shown t) | |
| 155 :group 'build-report) | |
| 156 | |
| 157 (defcustom build-report-make-output-files | |
| 460 | 158 (list |
| 159 "beta.err" | |
| 160 "xemacs-make-all.err" | |
| 161 "xemacs-make-check-temacs.err" | |
| 162 "xemacs-make-check.err" | |
| 163 "xemacs-make-install.err") | |
| 442 | 164 "*List of Filenames where stdout and stderr of XEmacs make process |
| 165 have been stored. These are relative to | |
| 166 `build-report-make-output-dir`. You'll have to run make with output | |
| 167 redirection or use the `build' XEmacs package to save this output. You | |
| 168 may use following alias | |
| 169 | |
| 428 | 170 alias mk 'make \!* >>&\! \!$.err &' |
| 442 | 171 |
| 501 | 172 under csh, so that you get beta.err when you run `mk beta'." |
| 442 | 173 :type '(repeat |
| 174 :custom-show t | |
| 175 :documentation-shown t | |
| 176 file) | |
| 428 | 177 :group 'build-report) |
| 178 | |
| 179 (defcustom build-report-installation-file | |
| 442 | 180 (expand-file-name "Installation" |
| 181 (gethash 'blddir (config-value-hash-table))) | |
| 182 "*Installation file produced by XEmacs configure process." | |
| 183 :type '(file | |
| 184 :custom-show t | |
| 185 :documentation-shown t) | |
| 428 | 186 :group 'build-report) |
| 187 | |
| 442 | 188 (defcustom build-report-version-file |
| 189 (expand-file-name | |
| 190 "version.sh" | |
| 191 (gethash 'blddir (config-value-hash-table))) | |
| 192 "*version.sh file identifying XEmacs (Beta) Distribution." | |
| 193 :type '(file | |
| 194 :custom-show t | |
| 195 :documentation-shown t) | |
| 196 :group 'build-report) | |
| 197 | |
| 198 (defcustom build-report-installation-insert-all | |
| 199 nil | |
| 200 "*Tell build-report to insert the whole Installation file | |
| 201 instead of just the last report." | |
| 428 | 202 :type 'boolean |
| 203 :group 'build-report) | |
| 204 | |
| 205 (defcustom build-report-subject | |
| 206 (concat "[%s] " emacs-version " on " system-configuration) | |
| 2976 | 207 ;; #### this should allow variable names which will be evalled and |
| 208 ;; formatted using %s, see `build-report-prompts' | |
| 442 | 209 "*XEmacs Build Report Subject Line. %s-sequences will be substituted |
| 210 with user input through `build-report' according to | |
| 211 `build-report-prompts' using `format'." | |
| 212 :type '(string | |
| 213 :custom-show t | |
| 214 :documentation-shown t) | |
| 428 | 215 :group 'build-report) |
| 216 | |
| 217 (defcustom build-report-prompts | |
| 442 | 218 (quote (("Status?: " ("Success" "Failure")))) |
| 2976 | 219 ;; #### this should allow variable names which will be evalled and |
| 220 ;; formatted using %s, see `build-report-prompts' | |
| 442 | 221 "*XEmacs Build Report Prompt(s). This is a list of prompt-string |
| 222 lists used by `build-report' in conjunction with | |
| 223 `build-report-subject'. Each list consists of a prompt string | |
| 224 followed by any number of strings which can be chosen via the history | |
| 225 mechanism." | |
| 226 :type '(repeat | |
| 227 :custom-show t | |
| 228 :documentation-shown t | |
| 229 (list | |
| 230 :tag "Prompt" | |
| 231 string | |
| 232 (repeat | |
| 233 :tag "Values" | |
| 234 string))) | |
| 428 | 235 :group 'build-report) |
| 236 | |
| 237 (defcustom build-report-file-encoding | |
| 238 "7bit" | |
| 442 | 239 "*XEmacs Build Report File Encoding to be used when MIME support is |
| 240 available." | |
| 428 | 241 :group 'build-report) |
| 242 | |
| 243 ;; Symbol Name mappings from TM to SEMI serving as Compatibility | |
| 244 ;; Bandaid | |
| 245 (when (featurep 'mime-setup) | |
| 246 ;; No (defvaralias ...) so far. Thanks to "Didier Verna" | |
| 442 | 247 ;; <didier@xemacs.org> for reporting my incorrect defvaraliasing of |
| 428 | 248 ;; `mime-editor/insert-tag'. |
| 249 ;; Thanks to Jens-Ulrik Holger Petersen | |
| 250 ;; <petersen@kurims.kyoto-u.ac.jp> for suggesting the conditional | |
| 251 ;; aliasing of SEMI functions. | |
| 252 (unless (fboundp 'mime-edit-content-beginning) | |
| 253 (defalias 'mime-edit-content-beginning 'mime-editor/content-beginning)) | |
| 254 (unless (fboundp 'mime-edit-insert-tag) | |
| 255 (defalias 'mime-edit-insert-tag 'mime-editor/insert-tag)) | |
| 256 (unless (fboundp 'mime-edit-insert-binary-file) | |
| 257 (defalias 'mime-edit-insert-binary-file | |
| 258 'mime-editor/insert-binary-file))) | |
| 259 | |
| 442 | 260 (defun build-report-make-output-get () |
| 2976 | 261 "Return the filename the XEmacs make output is saved in." |
| 442 | 262 (interactive) |
| 263 (if (or (string-equal build-report-make-output-dir "") | |
| 264 (null build-report-make-output-dir)) | |
| 265 (mapcar | |
| 266 (function | |
| 267 (lambda (f) | |
| 268 (expand-file-name | |
| 269 f | |
| 270 (file-name-as-directory | |
| 271 (gethash 'blddir (config-value-hash-table)))))) | |
| 272 build-report-make-output-files) | |
| 273 (mapcar | |
| 274 (function | |
| 275 (lambda (f) | |
| 276 (expand-file-name | |
| 277 f | |
| 278 (file-name-as-directory build-report-make-output-dir)))) | |
| 279 build-report-make-output-files))) | |
| 280 | |
| 281 ;;;###autoload | |
| 428 | 282 (defun build-report (&rest args) |
| 462 | 283 "Report build information including Installation and make output. |
| 284 | |
| 285 Prompts for status (usually \"Success\" or \"Failure\"). Then uses | |
| 286 `compose-mail' to create a mail message. The Subject header contains | |
| 287 status and version information. Point is left at the beginning of the | |
| 288 mail text. Add some notes if you like, and send the report. | |
| 289 | |
| 290 Looks for Installation and the make output file (`beta.err' by | |
| 291 default, customizable via `build-report-make-output-files') in the | |
| 292 build directory of the running XEmacs by default (customizable via | |
| 293 `build-report-make-output-dir'). The output from make is filtered | |
| 294 through `build-report-keep-regexp' and `build-report-delete-regexp' | |
| 295 before including in the message. | |
| 296 | |
| 297 See also `mail-user-agent', `build-report-destination', and | |
| 298 `build-report-installation-file'." | |
| 442 | 299 ;; `interactive' form returns value for formal parameter `args'. |
| 428 | 300 (interactive |
| 301 (let (prompt | |
| 442 | 302 hist |
| 303 arg | |
| 304 (prompts build-report-prompts)) | |
| 428 | 305 (progn |
| 306 (while prompts | |
| 442 | 307 (defvar hist) |
| 308 (setq prompt (caar prompts)) | |
| 309 (setq hist (cdar prompts)) | |
| 310 ;; `build-report-prompts' used to be a list of lists, the | |
| 311 ;; first element of each list being the prompt, the rest being | |
| 312 ;; the history. The history is now in a separate list. We | |
| 313 ;; better check for that. | |
| 314 (if (listp (car hist)) | |
| 315 (setq hist (car hist))) | |
| 316 (setq prompts (cdr prompts)) | |
| 317 (setq arg (cons (read-string prompt "" 'hist) arg))) | |
| 428 | 318 arg))) |
| 3006 | 319 (let ((destination-address |
| 320 ;; `build-report-destination' used to be a single string, so | |
| 321 ;; let's test if we really get a list of destinations. | |
| 322 (if (listp build-report-destination) | |
| 323 (read-string | |
| 324 "Build Report Destination: " | |
| 325 (car build-report-destination) | |
| 326 'build-report-destination) | |
| 327 (read-string | |
| 328 "Build Report Destination: " | |
| 329 build-report-destination) | |
| 330 ))) | |
| 331 (save-excursion | |
| 332 (build-report-create-report destination-address args)))) | |
| 333 | |
| 334 ;;;###autoload | |
| 335 (defun batch-build-report (&optional status destination) | |
| 336 "Format a build report. Save it as \"./BUILD-REPORT\". | |
| 337 If the file \"./BUILD-REPORT-COMMENT\" is readable, insert its contents. | |
| 338 Optional STATUS is a string to insert in the subject. It defaults to | |
| 339 \"Success\". \(This will be made customizable.) | |
| 340 Optional DESTINATION is a string containing the destination mailbox. It | |
| 341 defaults to \"XEmacs Build Reports <xemacs-buildreports@xemacs.org>\". | |
| 342 \(This will be made customizable.) | |
| 343 This function may be invoked as a command." | |
| 344 (interactive) | |
| 345 (unless (stringp status) (setq status "Success")) | |
| 346 (unless (stringp destination) | |
| 347 (setq destination "XEmacs Build Reports <xemacs-buildreports@xemacs.org>")) | |
| 428 | 348 (save-excursion |
| 3006 | 349 (build-report-create-report destination |
| 350 ;; #### listify in the internal function? | |
| 351 (list status))) | |
| 352 (when (file-readable-p "BUILD-REPORT-COMMENT") | |
| 353 (insert-file "BUILD-REPORT-COMMENT")) | |
| 354 (write-file "BUILD-REPORT")) | |
| 355 | |
| 356 (defun build-report-create-report (destination status) | |
| 357 "Format current buffer as an XEmacs build report to DESTINATION. | |
| 358 | |
| 359 DESTINATION is the mailbox to which the report will be submitted. | |
| 360 STATUS is the status of the build. | |
| 361 You probably don't want to use this function; see `build-report' for the | |
| 362 interactive command, and `batch-build-report' for a command suitable for | |
| 363 use in shell scripts and Makefiles." | |
| 364 (if (file-exists-p build-report-installation-file) | |
| 442 | 365 (multiple-value-bind |
| 3006 | 366 (major minor beta codename extraname configuration) |
| 367 (build-report-installation-data build-report-installation-file) | |
| 368 (setq build-report-subject | |
| 369 (format "[%%s] XEmacs %s.%s%s \"%s\" %s%s" | |
| 370 major minor beta codename extraname configuration))) | |
| 371 (multiple-value-bind | |
| 372 (major minor beta codename extraname) | |
| 373 (build-report-version-file-data build-report-version-file) | |
| 374 (setq build-report-subject | |
| 375 (format "[%%s] XEmacs %s.%s%s \"%s\" %s%s" | |
| 376 major minor beta codename extraname system-configuration)))) | |
| 377 (compose-mail destination | |
| 378 (apply 'format build-report-subject status) | |
| 379 nil nil nil nil nil) | |
| 380 (let* ((report-begin (point)) | |
| 381 (files (reverse (build-report-make-output-get))) | |
| 382 (file (car files))) | |
| 383 (while file | |
| 384 (if (file-exists-p file) | |
| 385 (insert (build-report-insert-make-output report-begin file)) | |
| 386 (insert (format "%s not found!\n" file))) | |
| 442 | 387 (insert "\n") |
| 3006 | 388 (setq files (cdr files)) |
| 389 (setq file (car files))) | |
| 390 (if (file-exists-p build-report-installation-file) | |
| 391 (insert (build-report-insert-installation-file | |
| 392 report-begin | |
| 393 build-report-installation-insert-all)) | |
| 394 (insert (format "%s not found!\n" build-report-installation-file))) | |
| 395 (insert "\n") | |
| 396 (insert (build-report-insert-header report-begin)) | |
| 397 (goto-char report-begin))) | |
| 428 | 398 |
| 399 (defun build-report-insert-header (where) | |
| 400 "Inserts the build-report-header at the point specified by `where'." | |
| 401 (goto-char where) | |
| 402 (with-temp-buffer | |
| 442 | 403 (insert |
| 404 (format " | |
| 405 > XEmacs Build Report generated by emacs-version | |
| 406 > %s | |
| 407 > with system-configuration | |
| 408 > %s | |
| 409 > follows:\n\n" emacs-version system-configuration)) | |
| 428 | 410 (buffer-string))) |
| 411 | |
| 442 | 412 (defun build-report-insert-make-output (where file) |
| 413 "Inserts the output of the XEmacs Beta make run in the | |
| 414 current buffer at position WHERE. | |
| 428 | 415 The make process output must have been saved in |
| 442 | 416 `build-report-make-output-files' during the XEmacs Beta building." |
| 428 | 417 (goto-char where) |
| 418 (with-temp-buffer | |
| 442 | 419 (if (file-exists-p file) |
| 420 (progn | |
| 421 (if (featurep 'mime-setup) | |
| 422 (progn | |
| 423 (mime-edit-insert-tag | |
| 424 "text" | |
| 425 "plain" | |
| 426 (concat | |
| 427 "\nContent-Disposition: attachment;" | |
| 428 " filename=\"" | |
| 429 (file-name-nondirectory | |
| 430 file) | |
| 431 "\"")) | |
| 432 (mime-edit-insert-binary-file | |
| 433 file | |
| 434 build-report-file-encoding)) | |
| 435 (insert-file-contents file)) | |
| 436 (when build-report-keep-regexp | |
| 437 (goto-char (point-min)) | |
| 438 (delete-non-matching-lines (build-report-keep))) | |
| 439 (when build-report-delete-regexp | |
| 440 (goto-char (point-min)) | |
| 441 (delete-matching-lines (build-report-delete))) | |
| 442 (goto-char (point-min)) | |
| 443 (if build-report-keep-regexp | |
| 444 (insert | |
| 445 (format | |
| 446 "> keeping lines matching | |
| 447 > \"%s\" | |
| 448 " | |
| 449 (build-report-keep)))) | |
| 450 (if build-report-delete-regexp | |
| 451 (insert | |
| 452 (format | |
| 453 "> %sdeleting lines matching | |
| 454 > \"%s\" | |
| 455 " | |
| 456 (if build-report-keep-regexp | |
| 457 "and then " | |
| 458 "") | |
| 459 (build-report-delete)))) | |
| 460 (insert "\n") | |
| 461 (goto-char (point-min)) | |
| 462 (insert | |
| 463 (format "> Contents of %s\n" file))) | |
| 464 (insert "> " file | |
| 465 " does not exist!\n\n")) | |
| 428 | 466 (buffer-string))) |
| 442 | 467 |
| 428 | 468 (defun build-report-insert-installation-file (where all) |
| 469 "Inserts the contents of the `build-report-installation-file' | |
| 470 created by the XEmacs Beta configure process." | |
| 471 (goto-char where) | |
| 472 (with-temp-buffer | |
| 473 (if (file-exists-p build-report-installation-file) | |
| 442 | 474 (let (file-begin last-configure) |
| 475 (insert "> Contents of " | |
| 476 build-report-installation-file | |
| 477 ":\n") | |
| 478 (insert | |
| 479 (format | |
| 480 "> (Output from %s of ./configure)\n\n" | |
| 481 (if all "all runs" "most recent run"))) | |
| 482 (if (featurep 'mime-setup) | |
| 483 (progn | |
| 484 (mime-edit-insert-tag | |
| 485 "text" | |
| 486 "plain" | |
| 487 (concat | |
| 488 "\nContent-Disposition: attachment;" | |
| 489 " filename=\"" | |
| 490 (file-name-nondirectory | |
| 491 build-report-installation-file) | |
| 492 "\"")) | |
| 493 (mime-edit-insert-binary-file | |
| 494 build-report-installation-file | |
| 495 build-report-file-encoding) | |
| 496 (setq file-begin (mime-edit-content-beginning))) | |
| 497 (setq file-begin (point)) | |
| 498 (insert-file-contents | |
| 499 build-report-installation-file)) | |
| 500 (unless all | |
| 501 (setq last-configure | |
| 502 (search-backward-regexp | |
| 503 "^\\(uname.*\\|osversion\\|OS\\):\\s-+" file-begin t)) | |
| 504 (if (and file-begin last-configure) | |
| 505 (delete-region file-begin last-configure)))) | |
| 428 | 506 (insert "> " build-report-installation-file |
| 442 | 507 " does not exist!\n\n")) |
| 428 | 508 (buffer-string))) |
| 509 | |
| 510 (defun build-report-keep () | |
| 442 | 511 "Concatenate elements of `build-report-keep-regexp' and a general |
| 512 MIME tag REGEXP. The result is a REGEXP string matching either of the | |
| 513 REGEXPs in `build-report-keep-regexp' or a general MIME tag REGEXP." | |
| 428 | 514 (mapconcat #'identity |
| 442 | 515 (cons "^--\\[\\[\\|\\]\\]$" build-report-keep-regexp) "\\|")) |
| 428 | 516 |
| 517 (defun build-report-delete () | |
| 442 | 518 "Concatenate elements of `build-report-delete-regexp' and a general |
| 519 MIME tag REGEXP. The result is a REGEXP string matching either of the | |
| 520 REGEXPs in `build-report-delete-regexp' or a general MIME tag REGEXP." | |
| 4021 | 521 (mapconcat #'identity |
| 442 | 522 build-report-delete-regexp "\\|")) |
| 523 | |
| 524 (defun build-report-installation-data (&optional file) | |
| 525 "Return a list of XEmacs installation data containing MAJOR_NUMBER | |
| 526 MINOR_NUMBER BETA_STRING CODENAME CONFIGURATION SRCDIR from FILE, | |
| 527 which defaults to `build-report-installation-file'." | |
| 528 (interactive "fInstallation file: ") | |
| 529 (unless file | |
| 530 (setq file build-report-installation-file)) | |
| 531 (let | |
| 975 | 532 (major minor beta codename extraname configuration srcdir) |
| 442 | 533 (save-window-excursion |
| 534 (find-file-read-only file) | |
| 535 (goto-char (point-min)) | |
| 536 (while (< (point) (point-max)) | |
| 537 (cond | |
| 538 ((looking-at build-report-installation-version-regexp) | |
| 539 (goto-char (match-end 0)) | |
| 2976 | 540 (setq major (or (match-string 1) "")) |
| 541 (setq minor (or (match-string 2) "")) | |
| 542 (setq beta (or (match-string 3) "")) | |
| 543 (setq codename (or (match-string 6) "")) | |
| 544 (setq extraname (or (match-string 7) "")) | |
| 545 (setq configuration (or (match-string 8) ""))) | |
| 442 | 546 ((looking-at build-report-installation-srcdir-regexp) |
| 547 (goto-char (match-end 0)) | |
| 2976 | 548 (setq srcdir (or (match-string 1) ""))) |
| 442 | 549 ;; We avoid matching a potentially zero-length string to avoid |
| 550 ;; infinite looping. | |
| 551 ((looking-at | |
| 552 "^.+$") | |
| 553 (goto-char (match-end 0))) | |
| 554 ((looking-at "\n") | |
| 555 (goto-char (match-end 0))))) | |
| 975 | 556 (values major minor (or beta "") codename extraname configuration srcdir)))) |
| 442 | 557 |
| 558 (defun build-report-version-file-data (&optional file) | |
| 559 "Return a list of XEmacs version information containing | |
| 560 MAJOR_NUMBER MINOR_NUMBER BETA_STRING CODENAME from FILE, which | |
| 561 defaults to `build-report-version-file'." | |
| 562 (interactive "fversion.sh file: ") | |
| 563 (unless file | |
| 564 (setq file build-report-version-file)) | |
| 565 (let | |
| 975 | 566 (major minor beta codename extraname) |
| 442 | 567 (save-window-excursion |
| 568 (find-file-read-only file) | |
| 569 (goto-char (point-min)) | |
| 570 (while (< (point) (point-max)) | |
| 571 (cond | |
| 572 ((looking-at build-report-version-file-regexp) | |
| 573 (goto-char (match-end 0)) | |
| 2976 | 574 (setq major (or (match-string 1) "")) |
| 575 (setq minor (or (match-string 2) "")) | |
| 576 (setq beta (or (match-string 3) "")) | |
| 577 (setq codename (or (match-string 4) "")) | |
| 578 (setq extraname (or (match-string 6) ""))) | |
| 442 | 579 ;; We avoid matching a potentially zero-length string to avoid |
| 580 ;; infinite looping. | |
| 581 ((looking-at | |
| 582 "^.+$") | |
| 583 (goto-char (match-end 0))) | |
| 584 ((looking-at "\n") | |
| 585 (goto-char (match-end 0))))) | |
| 975 | 586 (values major minor (or beta "") codename extraname)))) |
| 428 | 587 |
| 588 ;;; build-report.el ends here |
