Mercurial > hg > xemacs-beta
comparison lisp/build-report.el @ 3006:dcfb8ec6859a
[xemacs-hg @ 2005-10-21 10:23:15 by stephent]
Make build-report play nicely in batch. <87k6g7kw4q.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Fri, 21 Oct 2005 10:23:16 +0000 |
parents | 0fb57d74601d |
children | b34066456742 |
comparison
equal
deleted
inserted
replaced
3005:d3dcb668d6c8 | 3006:dcfb8ec6859a |
---|---|
1 ;;; 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-2003 Adrian Aichner | 3 ;; Copyright (C) 1997-2003 Adrian Aichner |
4 | 4 |
5 ;; Author: Adrian Aichner <adrian@xemacs.org> | 5 ;; Author: Adrian Aichner <adrian@xemacs.org> |
6 ;; Date: $Date: 2005/10/05 04:11:25 $ | 6 ;; Date: $Date: 2005/10/21 10:23:16 $ |
7 ;; Version: $Revision: 1.12 $ | 7 ;; Version: $Revision: 1.13 $ |
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 |
316 (if (listp (car hist)) | 316 (if (listp (car hist)) |
317 (setq hist (car hist))) | 317 (setq hist (car hist))) |
318 (setq prompts (cdr prompts)) | 318 (setq prompts (cdr prompts)) |
319 (setq arg (cons (read-string prompt "" 'hist) arg))) | 319 (setq arg (cons (read-string prompt "" 'hist) arg))) |
320 arg))) | 320 arg))) |
321 (let ((destination-address | |
322 ;; `build-report-destination' used to be a single string, so | |
323 ;; let's test if we really get a list of destinations. | |
324 (if (listp build-report-destination) | |
325 (read-string | |
326 "Build Report Destination: " | |
327 (car build-report-destination) | |
328 'build-report-destination) | |
329 (read-string | |
330 "Build Report Destination: " | |
331 build-report-destination) | |
332 ))) | |
333 (save-excursion | |
334 (build-report-create-report destination-address args)))) | |
335 | |
336 ;;;###autoload | |
337 (defun batch-build-report (&optional status destination) | |
338 "Format a build report. Save it as \"./BUILD-REPORT\". | |
339 If the file \"./BUILD-REPORT-COMMENT\" is readable, insert its contents. | |
340 Optional STATUS is a string to insert in the subject. It defaults to | |
341 \"Success\". \(This will be made customizable.) | |
342 Optional DESTINATION is a string containing the destination mailbox. It | |
343 defaults to \"XEmacs Build Reports <xemacs-buildreports@xemacs.org>\". | |
344 \(This will be made customizable.) | |
345 This function may be invoked as a command." | |
346 (interactive) | |
347 (unless (stringp status) (setq status "Success")) | |
348 (unless (stringp destination) | |
349 (setq destination "XEmacs Build Reports <xemacs-buildreports@xemacs.org>")) | |
321 (save-excursion | 350 (save-excursion |
351 (build-report-create-report destination | |
352 ;; #### listify in the internal function? | |
353 (list status))) | |
354 (when (file-readable-p "BUILD-REPORT-COMMENT") | |
355 (insert-file "BUILD-REPORT-COMMENT")) | |
356 (write-file "BUILD-REPORT")) | |
357 | |
358 (defun build-report-create-report (destination status) | |
359 "Format current buffer as an XEmacs build report to DESTINATION. | |
360 | |
361 DESTINATION is the mailbox to which the report will be submitted. | |
362 STATUS is the status of the build. | |
363 You probably don't want to use this function; see `build-report' for the | |
364 interactive command, and `batch-build-report' for a command suitable for | |
365 use in shell scripts and Makefiles." | |
366 (if (file-exists-p build-report-installation-file) | |
367 (multiple-value-bind | |
368 (major minor beta codename extraname configuration) | |
369 (build-report-installation-data build-report-installation-file) | |
370 (setq build-report-subject | |
371 (format "[%%s] XEmacs %s.%s%s \"%s\" %s%s" | |
372 major minor beta codename extraname configuration))) | |
373 (multiple-value-bind | |
374 (major minor beta codename extraname) | |
375 (build-report-version-file-data build-report-version-file) | |
376 (setq build-report-subject | |
377 (format "[%%s] XEmacs %s.%s%s \"%s\" %s%s" | |
378 major minor beta codename extraname system-configuration)))) | |
379 (compose-mail destination | |
380 (apply 'format build-report-subject status) | |
381 nil nil nil nil nil) | |
382 (let* ((report-begin (point)) | |
383 (files (reverse (build-report-make-output-get))) | |
384 (file (car files))) | |
385 (while file | |
386 (if (file-exists-p file) | |
387 (insert (build-report-insert-make-output report-begin file)) | |
388 (insert (format "%s not found!\n" file))) | |
389 (insert "\n") | |
390 (setq files (cdr files)) | |
391 (setq file (car files))) | |
322 (if (file-exists-p build-report-installation-file) | 392 (if (file-exists-p build-report-installation-file) |
323 (multiple-value-bind | 393 (insert (build-report-insert-installation-file |
324 (major minor beta codename extraname configuration) | 394 report-begin |
325 (build-report-installation-data build-report-installation-file) | 395 build-report-installation-insert-all)) |
326 (setq build-report-subject | 396 (insert (format "%s not found!\n" build-report-installation-file))) |
327 (format "[%%s] XEmacs %s.%s%s \"%s\" %s%s" | 397 (insert "\n") |
328 major minor beta codename extraname configuration))) | 398 (insert (build-report-insert-header report-begin)) |
329 (multiple-value-bind | 399 (goto-char report-begin))) |
330 (major minor beta codename extraname) | |
331 (build-report-version-file-data build-report-version-file) | |
332 (setq build-report-subject | |
333 (format "[%%s] XEmacs %s.%s%s \"%s\" %s%s" | |
334 major minor beta codename extraname system-configuration)))) | |
335 (compose-mail | |
336 ;; `build-report-destination' used to be a single string, so | |
337 ;; let's test if we really get a list of destinations. | |
338 (if (listp build-report-destination) | |
339 (read-string | |
340 "Build Report Destination: " | |
341 (car build-report-destination) | |
342 'build-report-destination) | |
343 (read-string | |
344 "Build Report Destination: " | |
345 build-report-destination) | |
346 ) | |
347 (apply 'format build-report-subject args) | |
348 nil | |
349 nil | |
350 nil | |
351 nil | |
352 nil) | |
353 (let* ((report-begin (point)) | |
354 (files (reverse (build-report-make-output-get))) | |
355 (file (car files))) | |
356 (while file | |
357 (if (file-exists-p file) | |
358 (insert (build-report-insert-make-output report-begin file)) | |
359 (insert (format "%s not found!\n" file))) | |
360 (insert "\n") | |
361 (setq files (cdr files)) | |
362 (setq file (car files))) | |
363 (if (file-exists-p build-report-installation-file) | |
364 (insert (build-report-insert-installation-file | |
365 report-begin | |
366 build-report-installation-insert-all)) | |
367 (insert (format "%s not found!\n" build-report-installation-file))) | |
368 ;;; (when (and (>= major 21) (>= minor 2) (or (null beta) (>= beta 32))) | |
369 ;;; (insert "\n") | |
370 ;;; (insert (build-report-insert-config-inc report-begin))) | |
371 (insert "\n") | |
372 (insert (build-report-insert-header report-begin)) | |
373 (goto-char report-begin)))) | |
374 | 400 |
375 (defun build-report-insert-header (where) | 401 (defun build-report-insert-header (where) |
376 "Inserts the build-report-header at the point specified by `where'." | 402 "Inserts the build-report-header at the point specified by `where'." |
377 (goto-char where) | 403 (goto-char where) |
378 (with-temp-buffer | 404 (with-temp-buffer |