From 79cf257c783e42d6bdb1dfb1dd3fcf1f9b0a2d26 Mon Sep 17 00:00:00 2001 From: Xiyue Deng Date: Sun, 20 Oct 2024 18:16:53 -0700 Subject: [PATCH] Make loaddefs generation predictable When generating autoload files, the sequence of directories and files are random, resulting in the generated autoload files not reproducible on multiple runs. This patch attempts to sort the directories and files so that the generated file contents are reproducible. * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): sort directories and files to make generated autoload files reproducible. --- lisp/emacs-lisp/loaddefs-gen.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 50e90cdf94c..fcab1faf92d 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -596,9 +596,13 @@ instead of just updating them with the new/changed autoloads." (concat "\\`[^=.].*" (regexp-opt tmp t) "\\'"))) (files (apply #'nconc (mapcar (lambda (d) - (directory-files (expand-file-name d) - t files-re)) - (if (consp dir) dir (list dir))))) + (sort + (directory-files (expand-file-name d) + t files-re) + 'string<)) + (if (consp dir) + (sort dir 'string<) + (list dir))))) (updating (and (file-exists-p output-file) (not generate-full))) (defs nil)) ;; Allow the excluded files to be relative. -- 2.45.2