1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-01 01:41:01 -08:00

(loaddefs-generate--emacs-batch): Fix bug#79821 again

Hopefully, this one is for good.
Use `file-truename` on all the input file/dir names to try and
make sure we don't get bitten any more by symlinks or driver
letter capitalization.

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Revert last change.
(loaddefs-generate--excluded-files): Remove test that's not needed any
more now that we use all relative names.
(loaddefs-generate--emacs-batch): Apply truename to all input files/dirs.
This commit is contained in:
Stefan Monnier 2025-11-18 17:33:11 -05:00
parent be2b38ce14
commit 4532f5ae8f

View file

@ -91,7 +91,7 @@ follows:
The autoload file is assumed to contain a trailer starting with a
FormFeed character.")
;;;###autoload
(put 'generated-autoload-file 'safe-local-variable 'stringp)
(put 'generated-autoload-file 'safe-local-variable #'stringp)
(defvar generated-autoload-load-name nil
"Load name for `autoload' statements generated from autoload cookies.
@ -100,7 +100,7 @@ Typically, you need to set this when the directory containing the file
is not in `load-path'.
This also affects the generated cus-load.el file.")
;;;###autoload
(put 'generated-autoload-load-name 'safe-local-variable 'stringp)
(put 'generated-autoload-load-name 'safe-local-variable #'stringp)
(defun loaddefs-generate--file-load-name (file outfile)
"Compute the name that will be used to load FILE.
@ -406,7 +406,7 @@ expand)' among their `declare' forms."
nil))))
prefixes)))
`(register-definition-prefixes ,file ',(sort (delq nil strings)
'string<))))))
#'string<))))))
(defun loaddefs-generate--parse-file (file main-outfile &optional package-data)
"Examining FILE for ;;;###autoload statements.
@ -662,15 +662,7 @@ instead of just updating them with the new/changed autoloads."
(file-attributes file))))
;; If we're scanning for package versions, we want to look
;; at the file even if it's excluded.
(let* ((excluded
;; FIXME: In out-of-tree builds (bug#79694) `excluded-files'
;; (derived via `lisp-directory' from `invocation-directory')
;; may end up using names which don't quite match those of
;; `file' (derived from the command line arguments), w.r.t.
;; "c:/" vs "C:/" on MS-Windows, so use a test more lax
;; than `member'.
(let ((x (member-ignore-case file excluded-files)))
(and x (file-equal-p file (car x)))))
(let* ((excluded (member file excluded-files))
(package-data
(and include-package-version (if excluded 'only t))))
(when (or package-data (not excluded))
@ -789,8 +781,6 @@ instead of just updating them with the new/changed autoloads."
;; Exclude those files that are preloaded on ALL platforms.
;; These are the ones in loadup.el where "(load" is at the start
;; of the line (crude, but it works).
(unless (equal default-directory (file-name-as-directory lisp-directory))
(error "PWD is not set as expected: %S" default-directory))
(let ((excludes nil))
(with-temp-buffer
(insert-file-contents "loadup.el")
@ -821,11 +811,11 @@ use."
"Generate the loaddefs for the Emacs build.
This is like `loaddefs-generate-batch', but has some specific
rules for built-in packages and excluded files."
(let* ((args (mapcar #'expand-file-name command-line-args-left))
(let* ((args (mapcar #'file-truename command-line-args-left))
;; We're run from $BUILDDIR/lisp but all the .el(c) files reside
;; (and are generated) in `lisp-directory' which is in $SRCDIR,
;; so go there and don't look back.
(default-directory lisp-directory)
(default-directory (file-truename lisp-directory))
(output-file (expand-file-name "loaddefs.el")))
(setq command-line-args-left nil)
(loaddefs-generate