From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Lennart Borgman" Newsgroups: gmane.emacs.devel Subject: Re: Current CVS doesn't bootstrap Date: Sun, 14 Nov 2004 22:20:39 +0100 Message-ID: <032801c4ca8f$d1bfd280$0200a8c0@sedrcw11488> References: <01c4c3f3$Blat.v2.2.2$7e8aa060@zahav.net.il> <01c4c41c$Blat.v2.2.2$0fa338a0@zahav.net.il> <200411062248.iA6MmEm29919@raven.dms.auburn.edu> <01c4c487$Blat.v2.2.2$d4c31400@zahav.net.il> <200411071743.iA7Hhfi01732@raven.dms.auburn.edu> <01c4c519$Blat.v2.2.2$30b5eda0@zahav.net.il> <01e401c4c532$de74f4e0$0200a8c0@sedrcw11488> <01c4c56c$Blat.v2.2.2$34b60360@zahav.net.il> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0325_01C4CA98.2BE675E0" X-Trace: sea.gmane.org 1100467300 17334 80.91.229.6 (14 Nov 2004 21:21:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 14 Nov 2004 21:21:40 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 14 22:21:27 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CTRoK-0007Sa-00 for ; Sun, 14 Nov 2004 22:21:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTRwz-0006HG-2n for ged-emacs-devel@m.gmane.org; Sun, 14 Nov 2004 16:30:21 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CTRwq-0006H7-LT for emacs-devel@gnu.org; Sun, 14 Nov 2004 16:30:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CTRwq-0006Gv-73 for emacs-devel@gnu.org; Sun, 14 Nov 2004 16:30:12 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CTRwq-0006Gs-4k for emacs-devel@gnu.org; Sun, 14 Nov 2004 16:30:12 -0500 Original-Received: from [81.228.10.116] (helo=av1-1-sn4.m-sp.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CTRnu-0003Fw-Sy; Sun, 14 Nov 2004 16:20:59 -0500 Original-Received: by av1-1-sn4.m-sp.skanova.net (Postfix, from userid 502) id 39ACB37EC2; Sun, 14 Nov 2004 22:20:58 +0100 (CET) Original-Received: from smtp2-2-sn4.m-sp.skanova.net (smtp2-2-sn4.m-sp.skanova.net [81.228.10.182]) by av1-1-sn4.m-sp.skanova.net (Postfix) with ESMTP id 2A02537EB0; Sun, 14 Nov 2004 22:20:58 +0100 (CET) Original-Received: from sedrcw11488 (t5o58p194.telia.com [195.67.196.194]) by smtp2-2-sn4.m-sp.skanova.net (Postfix) with SMTP id 24FF337E43; Sun, 14 Nov 2004 22:20:55 +0100 (CET) Original-To: "Eli Zaretskii" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:29832 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:29832 This is a multi-part message in MIME format. ------=_NextPart_000_0325_01C4CA98.2BE675E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit ----- Original Message ----- From: "Eli Zaretskii" > > What would in practice have to be checked? (require ...) and it cousins? > > Yes. > > > What about autoload.el - can it write a dependency list for the autoloaded > > objects? > > Autoloads could be picked up from loaddefs.el, yes. > > > Can everything be automatically checked or is an hand-written > > supplement needed? > > In principle, it could all be done automatically. > > But this is probably not something to do right now, when we are trying > to start a pretest VSN. Though this may not be the write time I tried to write some routines that checks the dependencies. It is not at all integrated with the build process, I just wrote the routines to check dependencies. I am sending it here for a review to see if the routines do what they are supposed to do (except for any errors I might have done). Some more routines may also have to be written to make it useful. When the attached file is loaded it will go through the lisp files in the Emacs tree and write two files lisp\dep.lst and lisp\dep.warnings. - Lennart ------=_NextPart_000_0325_01C4CA98.2BE675E0 Content-Type: application/octet-stream; name="elisp-dep.el" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="elisp-dep.el" ;;; Bugs: ;; ;; - Does not handle file names in require. ;; - Does not handle abs file names in load. ;; From starup.el: ;; (load (concat term-file-prefix ;; (symbol-name window-system) ;; "-win") (defconst elisp-dep-autoloads-hash (make-hash-table :test 'equal :size = 1500)) (defconst elisp-dep-files-hash (make-hash-table :test 'equal :size = 1500)) (defvar elisp-dep-warnings ()) ;;(defvar elisp-dep-processing-file nil) (defvar elisp-dep-dontcompile ()) =20 (defun elisp-dep-warning(msg) (save-excursion (backward-sexp) (let* ((line-no (+ (count-lines (point-min) (point)) 1)) (line-no-str (format "line %s" line-no))) (message "WARNING (%s): %s" line-no-str msg) (add-to-list 'elisp-dep-warnings (cons (cons elisp-dep-processing-module line-no-str) msg))))) (defun elisp-dep-get-dontcompile() (message "Reading DONTCOMPILE in makefile") (save-excursion (let ((makefile (expand-file-name "../lisp/makefile" = exec-directory)) (more t)) (setq elisp-dep-dontcompile nil) (find-file makefile) (goto-char (point-min)) (search-forward-regexp "^DONTCOMPILE =3D") (forward-line) (while more (if (search-forward-regexp "\\=3D\\s-\\$(lisp).*?/\\([^/]*?\\).el\\(?: = \\|$\\)" nil t) (progn (add-to-list 'elisp-dep-dontcompile (match-string-no-properties = 1)) (forward-line)) (setq more nil))) (kill-buffer (current-buffer))))) ;;(elisp-dep-get-dontcompile) ;;(member "version" elisp-dep-dontcompile) (defun elisp-dep-get-autoloads() (message "Reading autoloads..") (setq elisp-dep-autoloads-hash (make-hash-table :test 'equal :size = 1500)) (find-file (expand-file-name "../lisp/loaddefs.el" exec-directory)) (goto-char (point-min)) (let ((sexp) (count 1)) (while (forward-comment 1)) (while (not (eobp)) (setq sexp (read (current-buffer))) (when (equal (car sexp) 'autoload) (let ((objname (car (cdr sexp))) (objmodule (nth 2 sexp))) ;;(error "%s" objmodule) (unless (equal (car objname) 'quote) (error "expected quote")) (setq objname (car (cdr objname))) (puthash objname objmodule elisp-dep-autoloads-hash) (setq count (+ count 1)) ) ) (while (forward-comment 1)) ) (message "Number of autoloads: %s" count) (sleep-for 1) (kill-buffer (current-buffer)) ) ) (defun elisp-dep-add-1-extra-dep(module extra-dep) (let ((depends (gethash module elisp-dep-files-hash))) (mapc (lambda(sym) (add-to-list 'depends sym)) extra-dep) (message "add-1-extra: %s %s" module depends) (puthash module depends elisp-dep-files-hash))) (defun elisp-dep-add-extra-dep() "Add dependencies not found with the static search." ;; FIX ME: not completed. (message "Adding known dependencies that can not be found by = elisp-dep") (elisp-dep-add-1-extra-dep "edt" '(edt-lk201 edt-pc edt-vt100)) ) (defun elisp-dep-warn-load-but-not-string(sexp) "Avoid warning for known things." ;; FIX ME: not completed. (cond=20 ;;(("abbrev" . "line 174") . "load but not string: (load (if (and = file (> (length file) 0)) file abbrev-file-name) nil quietly)") ((equal sexp '(load (if (and file (> (length file) 0)) file abbrev-file-name) nil = quietly))) ;;(("battery" . "line 244") . "load but not string: (load file-name = nil t t)") ((equal sexp '(load file-name nil t t))) ;;(("byte-opt" . "line 256") . "load but not string: (load (nth 1 = fn))") ((equal sexp '(load (nth 1 fn)))) ;;(("bytecomp" . "line 1323") . "load but not string: (load = target-file)") ((equal sexp '(load target-file))) ;;(("cc-bytecomp" . "line 149") . "load but not string: (load cc-file = nil t t)") ((equal sexp '(load cc-file nil t t))) ;;(("cc-bytecomp" . "line 188") . "load but not string: (load (, = cc-part) nil t nil)") ((equal sexp '(load ,cc-part nil t nil))) ;;(("cl-macs" . "line 2429") . "load but not string: (load (nth 1 = (symbol-function func)))") ((equal sexp '(load (nth 1 (symbol-function func))))) ;;(("cus-edit" . "line 1816") . "load but not string: (load-library = load)") ((equal sexp '(load-library load))) ;;(("cus-edit" . "line 892") . "load but not string: (load file)") ((equal sexp '(load file))) ;;(("desktop" . "line 565") . "load but not string: (load = (expand-file-name desktop-basefilename desktop-dirname) t t t)") ((equal sexp '(load (expand-file-name desktop-basefilename desktop-dirname) t t = t))) ;;(("dired-aux" . "line 717") . "load but not string: (load file nil = nil t)") ((equal sexp '(load file nil nil t))) ;;(("disass" . "line 73") . "load but not string: (load (nth 1 = obj))") ((equal sexp '(load (nth 1 obj)))) ;;(("edt" . "line 2141") . "load but not string: (load (concat edt- = term) t t)") ((equal sexp '(load (concat "edt-" term) t t))) ;;(("esh-mode" . "line 292") . "load but not string: (load = module-shortname)") ((equal sexp '(load module-shortname))) (t (elisp-dep-warning (format "load but not string: %s" sexp))))) (defun elisp-dep-get-sexp-depends(sexp &optional let-state) ;;(message "get-sexp-depends %s %S" let-state sexp) (if (not (consp sexp)) (progn ;; This can only happen on top level! (elisp-dep-warning (format "top-level sexp is not list: %s" sexp)) nil) (let ((dependon ()) (fun (car sexp)) (new-let-state)) (when let-state ;; Skip let variables: (when (=3D let-state 0) (setq sexp (cdr sexp)) ;;(message "new sexp=3D%S" sexp) ) (setq new-let-state (- let-state 1)) (when (< let-state 0) (setq new-let-state nil))) (when (or (equal fun 'let) (equal fun 'let*)) (setq new-let-state 1)) =20 (when (equal fun 'require) (let ((reqarg (car (cdr sexp)))) (if (listp reqarg) (if (equal (car reqarg) 'quote) (let ((mod (car (cdr reqarg)))) ;;(message "require.mod=3D%s" mod) (add-to-list 'dependon mod)) (elisp-dep-warning (format "require but not quote: %s" sexp))) (elisp-dep-warning (format "require but not listp: %s" sexp)) ))) ;;(message "get-s-d.dependon=3D%s" dependon))) (when (or (equal fun 'load) (equal fun 'load-library) ) (let ((mod (car (cdr sexp)))) ;;(message "load %s" mod) (if (stringp mod) (cond ((file-name-absolute-p mod) (elisp-dep-warning (format "skipping %s - absolute file name" mod))) ;;((> (length (file-name-extension mod)) 0) ;;(elisp-dep-warning (format "skipping %s - file name has extension" = mod))) (t (setq mod (file-name-sans-extension (file-name-nondirectory mod))) (add-to-list 'dependon mod))) (elisp-dep-warn-load-but-not-string sexp)))) ;; skip arguments for functions etc (let ((has-args (or (equal fun 'defun) (equal fun 'defmacro))) (ord 0) ) (while sexp (setq ord (+ ord 1)) (let ((sym (if (consp sexp) (car sexp) sexp))) (when sym (when (atom sym) (let ((mod (gethash sym elisp-dep-autoloads-hash))) (when mod (add-to-list 'dependon mod) ;;(message "sym=3D%s mod=3D%s" sym mod) ;;(message "2 get-s-d.dependon=3D%s" dependon) ))) (when (listp sym) ;;(when (listp (cdr sym)) ;; must use cdr to distinguish cons/list ;;(message "ord=3D%s" ord) (unless (and has-args (=3D ord 3)) ;;(error ";; FIX-ME: take care of the return value!!!:") (mapc (lambda (sym)=20 (add-to-list 'dependon sym)) (elisp-dep-get-sexp-depends sym new-let-state))) ;; Only the first list after let is declares -> reset counter (when (equal new-let-state 1) (setq new-let-state nil)))) ;;) (setq sexp (when (consp sexp) (cdr sexp)))))) dependon))) =20 (defun elisp-dep-get-buffer-depends() ;;(message "get-buffer-depends=3D%s" (buffer-string)) (let ((depon ())) (goto-char (point-min)) (while (forward-comment 1)) (while (not (eobp)) ;;(message "substring=3D%s" (buffer-substring (point) (min = (point-max) (+ (point) 50)))) (let* ((sexp (read (current-buffer))) (sexpdep (elisp-dep-get-sexp-depends sexp)) ) (mapc (lambda(sym) (add-to-list 'depon sym)) sexpdep)) (while (forward-comment 1)) ;;(message "(%s)" (buffer-substring (point) (point-max))) ) ;;(message "depon=3D%s" depon) depon)) (defun elisp-dep-get-file-depends(file) (message "**** get-file-depends: %s" file) ;;(sleep-for 0 500) ;;(with-temp-buffer ;;(emacs-lisp-mode) ;;(insert-file-contents file) (find-file file) (let* ((module (file-name-nondirectory (file-name-sans-extension = file))) (elisp-dep-processing-module module) (depends) ) (if (member module elisp-dep-dontcompile) (elisp-dep-warning (format "skipping %s - member of DONTCOMPILE" = module)) (setq depends (elisp-dep-get-buffer-depends)) ;;(message "%s=3D%s" module depends) (puthash module depends elisp-dep-files-hash))) (kill-buffer (current-buffer))) (defun elisp-dep-search-dir(dir) ;;(message "search-dir: %s" dir) (let ((files (directory-files dir))) ;;(message "%s" files) (mapc (lambda (file) (let ((full (expand-file-name file dir))) ;;(message "full=3D%s isdir=3D%s" full (file-directory-p full)) (cond ((equal "." file)) ((equal ".." file)) ((file-directory-p full) (elisp-dep-search-dir full)) ((equal (substring full -3) ".el") (when (file-regular-p full) (elisp-dep-get-file-depends full) )) ))) files))) (defconst elisp-dep-dep-lst-file (expand-file-name "../lisp/dep.lst" = exec-directory)) (defun elisp-dep-write-dep-lst() (save-excursion (find-file elisp-dep-dep-lst-file) (maphash (lambda (key value) (princ (format "(%s %s)\n" key value) (current-buffer))) elisp-dep-files-hash) (sort-lines nil (point-min) (point-max)) (save-buffer) (kill-buffer (current-buffer)) (message "New dependency file written: %s" elisp-dep-dep-lst-file))) (defun elisp-dep-mk-new-dep-lst() (message "Will create new lisp depencency file") (sleep-for 2) (elisp-dep-get-autoloads) (elisp-dep-search-dir (expand-file-name "../lisp" exec-directory)) (elisp-dep-add-extra-dep) (elisp-dep-write-dep-lst) ) (defun elisp-dep-update-dep-lst() (message "Found old lisp depencency file, will update this") (sleep-for 2) (error "NIY") ) (defun elisp-dep-save-warnings() (let ((warn-file (concat (file-name-sans-extension = elisp-dep-dep-lst-file) ".warnings"))) (find-file warn-file) (erase-buffer) (mapc (lambda (warning) (princ (format "%S\n" warning) = (current-buffer))) elisp-dep-warnings) (sort-lines nil (point-min) (point-max)) (save-buffer) (kill-buffer (current-buffer)) )) (defun elisp-dep-mk-dep-lst() (save-excursion (set-buffer "*Messages*") (erase-buffer)) (message "Started at %s" (current-time-string)) (setq elisp-dep-warnings ()) (setq elisp-dep-files-hash (make-hash-table :test 'equal :size = 1500)) (elisp-dep-get-dontcompile) ;; Must set message-log-max here, otherwise messages disappear when it = is set back (setq message-log-max t) (let ((start-time (current-time)) (stop-time) (used-time) (max-lisp-eval-depth 500) (enable-local-eval nil)) (if (file-readable-p elisp-dep-dep-lst-file) (elisp-dep-update-dep-lst) (elisp-dep-mk-new-dep-lst)) (setq stop-time (current-time)) (setq used-time (- (+ (* (nth 0 stop-time) (expt 2 16)) (nth 1 = stop-time)) (+ (* (nth 0 start-time) (expt 2 16)) (nth 1 start-time)))) (message "Ready at %s" (current-time-string)) (message "Used time: %s" used-time) (message "hash count=3D%s" (hash-table-count elisp-dep-files-hash)) (message "%s" elisp-dep-files-hash) (elisp-dep-save-warnings) )) (elisp-dep-mk-dep-lst) (provide 'elisp-dep) ------=_NextPart_000_0325_01C4CA98.2BE675E0 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel ------=_NextPart_000_0325_01C4CA98.2BE675E0--