unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 45316@debbugs.gnu.org
Subject: bug#45316: [PATCH]: Re-introduce Emacs packages specific installation prefix.
Date: Fri, 18 Dec 2020 17:00:10 -0500	[thread overview]
Message-ID: <87y2huepw5.fsf@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2631 bytes --]

Hello Guix!

tl;dr: The Emacs build system and site-start.el loader are modified so
that Emacs packages are installed in their own distinct installation
directory.

The Emacs packages built with the Emacs built system used to be
installed in a sub-directory under the share/emacs/guix.d/ directory,
but this was changed in commit 65a7dd2950ca13a8b942b2836260a2192351b271
shortly after having accommodated the site-start.el machinery to enable
loading packages from any profile (via the EMACSLOADPATH search path
specification).

While this change allowed to expose simply and directly the packages
found in EMACSLOADPATH, it does introduce the risk of file name
collisions when multiple Emacs packages are joined in the same profile,
especially with Emacs packages increasing in complexity (e.g., using
more than a single .el file!) and expecting to have both their sources
and resources extracted under their own nested directory rather than as
a flat collection (ELPA, MELPA).

One recent example I stumbled on was attempting to use the
emacs-yasnippet-snippets package along with emacs-elpy; both wanted to
install a 'snippets' directory to share/emacs/site-lisp/snippets,
collided and resulted in problems that prove difficult to understand.

This is what motivated this patch series, where the site-start.el
auxiliary code used for package discovery is extended to support
packages installed in their own directory under a 'share/emacs/guix'
installation prefix, via Emacs' own package library!

The emacs-build-system is updated for this new installation prefix, as
well as existing packages and documentation.  Parting with a directly
usable EMACSLOADPATH means that site-start.el *must* run for packages to
appear in the load-path; that means for running a test suite, the -Q or
--quick Emacs options cannot be used, since it implies --no-site-file.

Benefits of using this approach:

+ Avoid inter-package file name collisions.

+ Better integration with user installed packages via M-x
package-install.  The Guix-installed packages are listed in M-x
package-list as 'external'.

Cons include:

- Slightly more complex loader (although much of it is offloaded to
  package.el), thus slightly slower (see the comparison below).

- Requires to ensure every package's test suite doesn't make use of -Q.

In my opinion the benefits outweighs the cons by a comfortable margin,
especially with the boring work of adapting the package collection
already done.

To test the performance of the new approach, the following manifest file
was used to test the rebuild of the ~900 Emacs packages making use of
the Emacs build system:


[-- Attachment #2: emacs-packages-manifest.scm --]
[-- Type: text/plain, Size: 806 bytes --]

(use-modules (gnu packages)
             (guix build-system)
             (guix packages)
             (srfi srfi-1))

(define %broken-emacs-packages
  (map specification->package
       '("emacs-picpocket"              ;tests fail
         "emacs-twittering-mode"        ;build fails

         ;; Broken only on current master, without new changes.
         "emacs-md4rd"
         "emacs-el-patch"
         "emacs-flymake-shellcheck"
         )))

(define %emacs-packages
  (fold-packages (lambda (package lst)
                   (if (eq? (build-system-name (package-build-system package))
                            'emacs)
                       (cons package lst)
                       lst))
                 '()))

(packages->manifest
 (lset-difference eqv? %emacs-packages %broken-emacs-packages))

[-- Attachment #3: Type: text/plain, Size: 2772 bytes --]


A simple benchmark testing the performance of the activation of the
hundreds of Emacs packages was then run using:

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix environment --pure -m emacs-packages-manifest.scm \
                                  --ad-hoc emacs
[env]$ /run/setuid-programs/sudo /bin/sh -c 'echo 3 > /proc/sys/vm/drop_caches'
[env]$ emacs --batch --no-site-file \
    --eval="(progn (require 'guix-emacs) \
                   (require 'benchmark) \
                   (message \"(total gc-count gc-time) = %s\" \
                            (benchmark-run 1 (guix-emacs-autoload-packages))))"
--8<---------------cut here---------------end--------------->8---

On the master branch:

--8<---------------cut here---------------start------------->8---
[...]
Loading /gnu/store/qajc70c7nqycs1301ram8s3x7k9ibg5f-profile/share/emacs/site-lisp/zotxt-autoloads...
Loading /gnu/store/qajc70c7nqycs1301ram8s3x7k9ibg5f-profile/share/emacs/site-lisp/zoutline-autoloads...
Loading /gnu/store/qajc70c7nqycs1301ram8s3x7k9ibg5f-profile/share/emacs/site-lisp/ztree-autoloads...
(total gc-count gc-time) = (25.242400751 13 0.189669369)
--8<---------------cut here---------------end--------------->8---

Or about 0.65 s on a warm cache.

On a branch with these changes:

--8<---------------cut here---------------start------------->8---
Error loading autoloads: (file-missing Cannot open load file No such file or directory kotl/kotl-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory helm-easymenu)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /gnu/store/ryh0rasi9frm98dkd3kbck6hya6hn2qr-profile/share/emacs/site-lisp/guix/flycheck-cpplint-0.1-1.1d8a090/flycheck-cpplint-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /gnu/store/ryh0rasi9frm98dkd3kbck6hya6hn2qr-profile/share/emacs/site-lisp/guix/evil-anzu-0.03/evil-anzu-autoloads)
Error loading autoloads: (file-missing Cannot open load file No such file or directory /gnu/store/ryh0rasi9frm98dkd3kbck6hya6hn2qr-profile/share/emacs/site-lisp/guix/erc-image-0-3.82fb387/erc-image-autoloads)
ad-handle-definition: `ido-completing-read' got redefined
Error loading autoloads: (file-missing Cannot open load file No such file or directory tex-site)
(total gc-count gc-time) = (26.175704339 47 0.783184412)
--8<---------------cut here---------------end--------------->8---

Or about 3 seconds on a warm cache.

There a 6 errors that would need to be looked into, but I these look
like actual packaging problems rather than new issues.  The previously
used way to load the autoloads, '(load f 'noerror)' would have masked
them.

Thanks,

Maxim

             reply	other threads:[~2020-12-18 22:08 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 22:00 Maxim Cournoyer [this message]
2020-12-18 22:16 ` bug#45316: [PATCH 01/26] build-systems/emacs: Install packages in their own directory Maxim Cournoyer
2020-12-18 22:16   ` bug#45316: [PATCH 02/26] gnu: emacs-ert-runner: Adjust following emacs-build-system changes Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 03/26] gnu: emacs-xyz: Do not use --quick or -Q Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 04/26] gnu: cedille: Adjust following emacs-build-system changes Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 05/26] gnu: emacs-libgit: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 06/26] gnu: emacs-typit: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 07/26] gnu: emacs-flycheck-grammalecte: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 08/26] gnu: emacs-scel: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 09/26] gnu: emacs-chess: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 10/26] gnu: emacs-org-contrib: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 11/26] gnu: emacs-edbi: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 12/26] gnu: emacs-telega: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 13/26] gnu: emacs-rime: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 14/26] gnu: emacs-haskell-snippets: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 15/26] gnu: guile-wisp: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 16/26] gnu: emacs-pdf-tools: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 17/26] gnu: emacs-emacsql: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 18/26] gnu: emacs-racer: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 19/26] gnu: emacs-magit: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 20/26] gnu: emacs-org-super-agenda: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 21/26] gnu: notmuch: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 22/26] gnu: emacs-howm: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 23/26] gnu: emacs-rjsx-mode: " Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 24/26] gnu: emacs-sudo-edit: Update to commit 0e2c32b, fix tests Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 25/26] gnu: emacs-sly-named-readtables: Adjust following emacs-build-system changes Maxim Cournoyer
2020-12-18 22:17   ` bug#45316: [PATCH 26/26] gnu: emacs-realgud: " Maxim Cournoyer
2021-03-30  9:45 ` bug#45316: [WIP PATCH 1/3] profiles: Add hook for Emacs subdirs Leo Prikler
2021-03-30  9:45   ` bug#45316: [WIP PATCH 2/3] build-system: emacs: Use subdirectories again Leo Prikler
2021-03-30  9:45   ` bug#45316: [WIP PATCH 3/3] gnu: emacs-libgit: Adjust to changes in emacs-build-system Leo Prikler
     [not found] <87ft3ysen7.fsf@gmail.com>
2020-12-22  8:51 ` bug#45316: [PATCH]: Re-introduce Emacs packages specific installation prefix Leo Prikler
2020-12-22 18:09   ` Maxim Cournoyer
2020-12-22 19:10     ` Leo Prikler
2020-12-26  5:01       ` Maxim Cournoyer
2020-12-26 10:56         ` Leo Prikler
2020-12-27  4:44           ` Maxim Cournoyer
2020-12-27  8:46             ` Leo Prikler

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://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2huepw5.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=45316@debbugs.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/guix.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).