commit:     a5dbc32a6e327775a55eba8583262d7bb761ec3a
Author:     Mats Lidell <matsl <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 27 21:33:34 2022 +0000
Commit:     Mats Lidell <matsl <AT> gentoo <DOT> org>
CommitDate: Mon Jun 27 21:39:26 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5dbc32a

app-editors/xemacs: No lock on finder-inf creation

Patch from upstream to not use a lock file when creating finder-inf.

Bug: https://bugs.gentoo.org/854417
Signed-off-by: Mats Lidell <matsl <AT> gentoo.org>

 .../xemacs-21.5.34-no-lock-on-finder-inf.patch     | 99 ++++++++++++++++++++++
 app-editors/xemacs/xemacs-21.5.34-r9.ebuild        |  1 +
 2 files changed, 100 insertions(+)

diff --git 
a/app-editors/xemacs/files/xemacs-21.5.34-no-lock-on-finder-inf.patch 
b/app-editors/xemacs/files/xemacs-21.5.34-no-lock-on-finder-inf.patch
new file mode 100644
index 000000000000..a37fc5e95fe0
--- /dev/null
+++ b/app-editors/xemacs/files/xemacs-21.5.34-no-lock-on-finder-inf.patch
@@ -0,0 +1,99 @@
+# HG changeset patch
+# User Aidan Kehoe <keh...@parhasard.net>
+# Date 1656333099 -3600
+#      Mon Jun 27 13:31:39 2022 +0100
+# Node ID c6966a009d0dc3b546c9d843141c1fb5daa89b9e
+# Parent  16e37125d7ea85048e89197ce8fe83f44b00ccc5
+Don't create a lock file when generating finder-inf.el
+
+lisp/ChangeLog addition:
+
+2022-06-27  Aidan Kehoe  <keh...@parhasard.net>
+
+       * finder.el (finder-compile-keywords):
+       Don't use the save-buffer infrastructure when generating
+       finder-inf.el, since that leads to lock files, making parallel
+       builds less likely to work. Thank you Mats Lidell and the Gentoo
+       users!
+
+src/ChangeLog addition:
+
+2022-06-27  Aidan Kehoe  <keh...@parhasard.net>
+
+       * Makefile.in.in ($(LISP)/finder-inf.el):
+       Don't remove finder-inf.el before regenerating it, Lisp will
+       overwrite it.
+
+diff -r 16e37125d7ea -r c6966a009d0d lisp/finder.el
+--- a/lisp/finder.el   Sun Jun 26 19:14:02 2022 +0300
++++ b/lisp/finder.el   Mon Jun 27 13:31:39 2022 +0100
+@@ -151,7 +151,7 @@
+ arguments compiles from `load-path'."
+   (save-excursion
+     ;; XEmacs change
+-    (find-file (expand-file-name "finder-inf.el" lisp-directory))
++    (set-buffer (generate-new-buffer "finder-inf.el"))
+     (let ((processed nil)
+         (directory-abbrev-alist
+          (append
+@@ -160,11 +160,12 @@
+                                      "")))
+                   finder-abbreviate-directory-list)
+           directory-abbrev-alist))
+-        (using-load-path))
++        using-load-path second-line-marker finder-scratch)
+       (or dirs (setq dirs load-path))
+       (setq using-load-path (equal dirs load-path))
+       (erase-buffer)
+       (insert ";;; finder-inf.el --- keyword-to-package mapping\n")
++      (setq second-line-marker (point-marker))
+       (insert ";; Keywords: help\n")
+       (insert ";;; Commentary:\n")
+       (insert ";; Don't edit this file.  It's generated by finder.el\n\n")
+@@ -180,7 +181,8 @@
+               (if (not finder-compile-keywords-quiet)
+                   (message "Processing %s ..." f))
+               (save-excursion
+-                (set-buffer (get-buffer-create "*finder-scratch*"))
++                (set-buffer (setq finder-scratch
++                                    (get-buffer-create "*finder-scratch*")))
+                 (buffer-disable-undo (current-buffer))
+                 (erase-buffer)
+                 (insert-file-contents (expand-file-name f d))
+@@ -210,10 +212,23 @@
+           (directory-files d nil "^[^=].*\\.el$"))))
+        dirs)
+       (insert "))\n\n(provide 'finder-inf)\n\n;;; finder-inf.el ends here\n")
+-      (kill-buffer "*finder-scratch*")
++      (if finder-scratch (kill-buffer finder-scratch))
+       (unless noninteractive
+       (eval-current-buffer)) ; So we get the new keyword list immediately
+-      (basic-save-buffer))))
++      (goto-char (point-min))
++      (if (re-search-forward "[^\x00-\x7f]" nil t)
++          (progn
++            (goto-char (point-min))
++            (if (re-search-forward "[^\x00-\xff]" nil t)
++                (progn (goto-char second-line-marker)
++                       (insert ";;; -*- coding: escape-quoted -*-\n")
++                       (setq buffer-file-coding-system 'iso-8859-1-unix))
++              (goto-char second-line-marker)
++              (insert ";;; -*- coding: iso-8859-1 -*-\n")
++              (setq buffer-file-coding-system 'escape-quoted-unix)))
++        (setq buffer-file-coding-system 'no-conversion-unix))
++      (write-region (point-min) (point-max)
++                    (expand-file-name "finder-inf.el" lisp-directory)))))
+ 
+ (defun finder-compile-keywords-make-dist ()
+   "Regenerate `finder-inf.el' for the Emacs distribution."
+diff -r 16e37125d7ea -r c6966a009d0d src/Makefile.in.in
+--- a/src/Makefile.in.in       Sun Jun 26 19:14:02 2022 +0300
++++ b/src/Makefile.in.in       Mon Jun 27 13:31:39 2022 +0100
+@@ -590,7 +590,6 @@
+ 
+ $(LISP)/finder-inf.el: update-elc-2
+       @echo "Building finder database ..."
+-      $(RM) $(LISP)/finder-inf.el
+       $(XEMACS_BATCH) -eval "(setq finder-compile-keywords-quiet t)" \
+               -eval "(setq lisp-directory \"$(LISP)\")" \
+               -l finder -f finder-compile-keywords

diff --git a/app-editors/xemacs/xemacs-21.5.34-r9.ebuild 
b/app-editors/xemacs/xemacs-21.5.34-r9.ebuild
index e0099ac478ba..cbf425e1c83b 100644
--- a/app-editors/xemacs/xemacs-21.5.34-r9.ebuild
+++ b/app-editors/xemacs/xemacs-21.5.34-r9.ebuild
@@ -68,6 +68,7 @@ src_prepare() {
        eapply "${FILESDIR}/${P}-strsignal.patch"
        eapply "${FILESDIR}/${P}-process-test-qa.patch"
        eapply "${FILESDIR}/${P}-autoloads-parallell-make.patch"
+       eapply "${FILESDIR}/${P}-no-lock-on-finder-inf.patch"
 
        eapply_user
 

Reply via email to