From: "Lennart Borgman" <lennart.borgman.073@student.lu.se>
Cc: emacs-devel@gnu.org
Subject: Re: Current CVS doesn't bootstrap
Date: Sun, 14 Nov 2004 22:20:39 +0100 [thread overview]
Message-ID: <032801c4ca8f$d1bfd280$0200a8c0@sedrcw11488> (raw)
In-Reply-To: 01c4c56c$Blat.v2.2.2$34b60360@zahav.net.il
[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]
----- Original Message -----
From: "Eli Zaretskii" <eliz@gnu.org>
> > 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
[-- Attachment #2: elisp-dep.el --]
[-- Type: application/octet-stream, Size: 12242 bytes --]
;;; 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 ())
(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 =")
(forward-line)
(while more
(if (search-forward-regexp "\\=\\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
;;(("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 (= let-state 0)
(setq sexp (cdr sexp))
;;(message "new sexp=%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))
(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=%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=%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=%s mod=%s" sym mod)
;;(message "2 get-s-d.dependon=%s" dependon)
)))
(when (listp sym)
;;(when (listp (cdr sym)) ;; must use cdr to distinguish cons/list
;;(message "ord=%s" ord)
(unless (and has-args (= ord 3))
;;(error ";; FIX-ME: take care of the return value!!!:")
(mapc (lambda (sym)
(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)))
(defun elisp-dep-get-buffer-depends()
;;(message "get-buffer-depends=%s" (buffer-string))
(let ((depon ()))
(goto-char (point-min))
(while (forward-comment 1))
(while (not (eobp))
;;(message "substring=%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=%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=%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=%s isdir=%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=%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)
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2004-11-14 21:20 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-06 11:25 Current CVS doesn't bootstrap Eli Zaretskii
2004-11-06 14:16 ` Andreas Schwab
2004-11-06 14:40 ` Andreas Schwab
2004-11-06 16:16 ` Eli Zaretskii
2004-11-06 22:48 ` Luc Teirlinck
2004-11-07 0:35 ` Andreas Schwab
2004-11-07 1:25 ` Luc Teirlinck
2004-11-07 1:45 ` Andreas Schwab
2004-11-07 2:42 ` Satyaki Das
2004-11-07 3:15 ` Luc Teirlinck
2004-11-07 1:33 ` Luc Teirlinck
2004-11-07 2:07 ` Andreas Schwab
2004-11-07 18:04 ` Richard Stallman
2004-11-07 18:55 ` Luc Teirlinck
2004-11-07 22:10 ` Luc Teirlinck
2004-11-08 16:58 ` Richard Stallman
2004-11-07 23:26 ` Kim F. Storm
2004-11-07 23:45 ` Luc Teirlinck
2004-11-08 7:27 ` Eli Zaretskii
2004-11-09 0:50 ` Luc Teirlinck
2004-11-07 5:07 ` Eli Zaretskii
2004-11-07 17:43 ` Luc Teirlinck
2004-11-07 18:25 ` Han Boetes
2004-11-07 19:05 ` Luc Teirlinck
2004-11-07 18:38 ` David Kastrup
2004-11-07 19:33 ` Luc Teirlinck
2004-11-07 19:42 ` David Kastrup
2004-11-07 20:21 ` Luc Teirlinck
2004-11-08 0:15 ` Robert J. Chassell
2004-11-07 20:34 ` Piet van Oostrum
2004-11-07 20:37 ` Piet van Oostrum
2004-11-07 21:09 ` Luc Teirlinck
2004-11-07 21:20 ` Luc Teirlinck
2004-11-07 22:28 ` Eli Zaretskii
2004-11-07 23:05 ` Luc Teirlinck
2004-11-08 1:32 ` Lennart Borgman
2004-11-08 8:22 ` Eli Zaretskii
2004-11-14 21:20 ` Lennart Borgman [this message]
2004-11-08 2:03 ` Luc Teirlinck
2004-11-08 2:31 ` Luc Teirlinck
2004-11-08 7:20 ` Eli Zaretskii
2004-11-08 17:16 ` Drew Adams
2004-11-08 19:07 ` Stefan Monnier
2004-11-07 18:07 ` Luc Teirlinck
2004-11-07 18:47 ` Luc Teirlinck
-- strict thread matches above, loose matches on Subject: below --
2005-02-14 11:12 Andreas Schwab
2005-02-14 12:51 ` Lute Kamstra
2005-02-14 13:36 ` Reiner Steib
2005-02-15 17:27 ` Richard Stallman
2005-02-15 20:56 ` Reiner Steib
2005-02-17 10:35 ` Richard Stallman
2005-02-15 17:27 ` Richard Stallman
2005-02-15 19:12 ` Lute Kamstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='032801c4ca8f$d1bfd280$0200a8c0@sedrcw11488' \
--to=lennart.borgman.073@student.lu.se \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).