From xemacs-m  Tue Aug  5 08:06:47 1997
Received: from inf.enst.fr (i1CwHtUYkVkujUXJCn4pi5tuRBY1etEm@inf.enst.fr [137.194.2.81])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id IAA12933
	for <xemacs-beta@xemacs.org>; Tue, 5 Aug 1997 08:06:44 -0500 (CDT)
Received: from metheny.enst.fr (metheny.enst.fr [137.194.160.27])
          by inf.enst.fr (8.8.4/8.8.4) with ESMTP
	  id PAA28196 for <xemacs-beta@xemacs.org>; Tue, 5 Aug 1997 15:06:40 +0200 (MET DST)
Received: (from verna@localhost)
          by metheny.enst.fr (8.8.4/8.8.4)
	  id PAA29071; Tue, 5 Aug 1997 15:06:36 +0200 (MET DST)
Date: Tue, 5 Aug 1997 15:06:36 +0200 (MET DST)
Message-Id: <199708051306.PAA29071@metheny.enst.fr>
From: Didier Verna <verna@inf.enst.fr>
MIME-Version: 1.0
To: xemacs-beta@xemacs.org
Subject: build-report modif.
X-Mailer: VM 6.33 under 20.3 "Budapest" XEmacs  Lucid (beta16)
Reply-To: verna@inf.enst.fr
X-Attribution: Did
X-Url: http://www-inf.enst.fr/~verna/
X-Face: 6o|eiKqaHN.ANh8HXDzntcWUOCg\]RsOd.ctvm~*y}Y^R&*a+Co,\s#=HWsw3x$b_n2kJ#g
 (7u?J^@^xP)f,jUF|0Z'J:|G/bMA5O12*b,7`-Q`=pKsCRIpso07.Y>YB2H{7`?u&yh;C_ZtLHfj<!
 $J=.i&Al'?,ax]MZd4tcm)_wF3$n*:f/lgS.;?Jr3T;Fl^q<qP**'tw
X-Face: |j}\)O|k##MrRz#VK$Jy=0r=3Qc,,a/Tr6*JQbE73dy17]<u3$*$]4O\1|h\|O\EDT9d$n+
 MTB{U&>2YcmW$9Z&H21e}#~#pgc>dn(is5Bv1l!{1re+Q9suKIOUmOqZs2>QMxHlR;;}kaGYA@HR3D
 C6
Content-Type: multipart/mixed;
 boundary="Multipart_Tue_Aug__5_15:06:36_1997-1"
Content-Transfer-Encoding: 7bit

--Multipart_Tue_Aug__5_15:06:36_1997-1
Content-Type: text/plain; charset=US-ASCII



		Adrian (and others), if you are interested, I propose a 
		modification of build-report.el, allowing to insert only
        `	the last report appended to the Installation file.
       / |
      /  /	There's a new variable (nil by default) :
      `||	`xemacs-build-report-installation-insert-all' (buuuah)
       ||
       ||	Caveat: I search-backward for "uname" in the file, and insert
       ||	only from here ... but I don't know of platforms which don't
   _   ||	include the line "uname -a ..." in the report ?
  //|  ||	Maybe another variable would be needed for this.
  || \_||
   \\           Didier Verna
   //  __
  //  {__}   E.N.S.T. INF C-214        http://www-inf.enst.fr/~verna/
 ||    __      46 rue Barrault            mailto:verna@inf.enst.fr
 \\   {__}   75634 Paris  cedex 13       Tel.   (33) 01 45 81 80 72
  \\
   ``----         France
------------------------------------------------------------------------------

--Multipart_Tue_Aug__5_15:06:36_1997-1
Content-Type: application/octet-stream; type=emacs-lisp
Content-Disposition: attachment; filename="build-report.el"
Content-Transfer-Encoding: 7bit

;; 	$Id: xemacs-build-report.el,v 1.22 1997/08/05 10:58:14 aichner Exp $	
;; The Idea:
;; Let XEmacs report interesting aspects of how it was built.

;; The Concept:
;; User creates an XEmacs Build Report by just calling
;; M-x xemacs-create-build-report
;; which will initialize a message buffer with relevant information
;; derived from the XEmacs build process. Point is left at the
;; beginning of the report for user to input some personal notes and
;; send the report.

;; The Status:
;; This is the first `Proof of Concept'.

;; The Author:
;; Adrian Aichner, Teradyne GmbH Munich, Sun., Apr. 20, 1997.

(require 'config)
(provide 'xemacs-build-report)

;; Building the version from the RCS Revision keyword was lifted from
;; lisp/packages/auto-save.el.
;; This was later taken out due to recommandation by developers on
;; xemacs-beta@xemacs.org. Release versions are to be checked out
;; using `co -u -kv ...'.
(defconst xemacs-build-report-version
  "$Revision: 1.22 $"
  "Version number of xemacs-build-report.")

(defgroup xemacs-build-report nil
  "Package automating the process of sending Xemacs Build Reports.")

(defcustom xemacs-build-report-destination
  "xemacs-beta@xemacs.org"
  "The mail address XEmacs Build Reports should go to."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-keep-regexp
  "make\\[\\|warn\\|pure.*\\(space\\|size\\)"
  "Regexp of make process output lines to keep in the report."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-delete-regexp
  "confl.*with.*auto-inlining"
  "Regexp of make process output lines to delete from the report."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-make-output-file
  (concat (car (gethash 'srcdir (config-value-hash-table))) "/mk.err")
  "Filename where stdout and stderr of XEmacs make process have been stored.
mk.err will not be created automatically. You'll have to run make with
output redirection. I use an alias
alias mk 'make \!* >>&\! \!$.err &'
for that, so that I get mk.err went I run mk."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-installation-file
  (concat (car (gethash 'srcdir (config-value-hash-table))) "/Installation")
  "Installation file produced by XEmacs configure process."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-installation-insert-all nil
  "Tell xemacs-build-report to insert the whole Installation file
instead of just the last report."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-subject
  (concat "Build %s: " emacs-version " on " system-configuration)
  "XEmacs Build Report Subject Line. %s-sequences will be substituted
with user input through `xemacs-create-build-report' according to
`xemacs-build-report-prompts' using `format'."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-prompts
  '(("Status?: "  "Success" "Failure"))
  "XEmacs Build Report Prompt(s). This is a list of prompt-string
lists used by `xemacs-create-build-report' in conjunction with
`xemacs-build-report-subject'. Each list consists of a prompt string
followed by any number of strings which can be chosen via the history
mechanism."
  :group 'xemacs-build-report)

(defcustom xemacs-build-report-file-encoding
  "7bit"
  "XEmacs Build Report File Encoding used to include files when the
feature `mime-setup' is available."
  :group 'xemacs-build-report)


(defun xemacs-build-report-insert-installation-file (buffer all)
  "Inserts the contents of `xemacs-build-report-installation-file'.
If `all' is t, insert all the file. Otherwise, insert only the last
report."
  
  (if all
      (insert-file-contents xemacs-build-report-installation-file)
    (let ((buf (create-file-buffer xemacs-build-report-installation-file)))
      (set-buffer buf)
      (insert-file-contents xemacs-build-report-installation-file)
      (end-of-buffer)
      (let ((min (search-backward "uname")) (max (point-max)))
	(set-buffer buffer)
	(insert-buffer-substring buf min max)
	(kill-buffer buf)))))

(defun xemacs-create-build-report (&rest args)
  "Initializes a fresh message-mode buffer with the contents of XEmacs 
Installation file and excerpts from XEmacs make output and errors and
leaves point at the beginning of the message body. See also
`xemacs-build-report-destination',
`xemacs-build-report-keep-regexp',
`xemacs-build-report-delete-regexp',
`xemacs-build-report-make-output-file' and
`xemacs-build-report-installation-file'."
  (interactive
   (let (prompt
	 hist
	 arg
	 (prompts xemacs-build-report-prompts))
     (progn
       (while prompts
	 (setq prompt (caar prompts))
	 (setq hist (cdar prompts))
	 (setq prompts (cdr prompts))
	 (setq arg (cons (read-string prompt "" 'hist) arg)))
       arg)))
  (save-excursion
    (message-mail
     xemacs-build-report-destination
     (apply 'format xemacs-build-report-subject args))
    (let ((report-begin (message-goto-body)))
      (if (file-exists-p xemacs-build-report-make-output-file)
	  (progn
 	    (if (featurep 'mime-setup)
		(progn
		  (setq xemacs-build-report-keep-regexp
			(concat "^--\\[\\[\\|\\]\\]$\\|"
				xemacs-build-report-keep-regexp))
		  (mime-editor/insert-tag
		   "application"
		   "octet-stream" 
		   (concat
		    "\nContent-Disposition: attachment;"
		    " filename=\""
		    (file-name-nondirectory
		     xemacs-build-report-make-output-file)
		    "\""))
		  (mime-editor/insert-binary-file
		   xemacs-build-report-make-output-file
		   xemacs-build-report-file-encoding))
	      (insert-file-contents xemacs-build-report-make-output-file))
	    (goto-char report-begin)
	    (delete-non-matching-lines
	     xemacs-build-report-keep-regexp)
	    (goto-char report-begin)
	    (delete-matching-lines xemacs-build-report-delete-regexp)
	    (goto-char report-begin)
	    (insert "> Contents of " 
		    xemacs-build-report-make-output-file
		    "\n> keeping lines matching\n> \""
		    xemacs-build-report-keep-regexp
		    "\"\n> and then deleting lines matching\n> \""
		    xemacs-build-report-delete-regexp
		    "\"\n\n"))
	(insert "> " xemacs-build-report-make-output-file
		" does not exist!\n\n"))
      (goto-char report-begin)
      (insert "\n> XEmacs Build Report as generated\n> by "
	      "xemacs-build-report-version "
	      xemacs-build-report-version
	      " follows:\n\n")
      (if (file-exists-p xemacs-build-report-installation-file)
	  (progn
	    (insert "> Contents of "
		    xemacs-build-report-installation-file
		    ":\n\n")
	    (if (featurep 'mime-setup)
		(progn
		  (mime-editor/insert-tag
		   "application"
		   "octet-stream" 
		   (concat
		    "\nContent-Disposition: attachment;"
		    " filename=\""
		    (file-name-nondirectory
		     xemacs-build-report-installation-file)
		    "\""))
		  (mime-editor/insert-binary-file
		   xemacs-build-report-installation-file
		   xemacs-build-report-file-encoding))
	      (xemacs-build-report-insert-installation-file 
	       (current-buffer)
	       xemacs-build-report-installation-insert-all)))
	(insert "> " xemacs-build-report-installation-file
		" does not exist!\n\n"))
      (goto-char report-begin))))

;;; <build-report.el>  ends here. 

--Multipart_Tue_Aug__5_15:06:36_1997-1--

