Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Share installed packages among multiple users #6872

Closed
wants to merge 1 commit into from
Closed

Share installed packages among multiple users #6872

wants to merge 1 commit into from

Conversation

emacs18
Copy link
Contributor

@emacs18 emacs18 commented Aug 20, 2016

This PR allows me to install packages once which then can be used by all my colleagues without each
of them having to install the same pacakges. There are potentially hundreds of my colleagues
who can be using the same shared file system so that the ability to share files is important not
only to save disk space, but also to reduce startup time.

Created dotspacemacs-use-shared-packages user option, so that if it is
set to non-nil, then directories listed in package-directory-list are
also searched for installed packages in addition to package-user-dir.
Site administrator can then install packages in one or more of the
directories in package-directory-list so that all users at the site can
share the same installed packages without each user having to install
them.

This change has no impact unless dotspacemacs-use-shared-packages is
explicitly changed to non-nil from the default value of nil.

Created dotspacemacs-use-shared-packages user option, so that if it is
set to non-nil, then directories listed in package-directory-list are
also searched for installed packages in addition to package-user-dir.
Site administrator can then install packages in one or more of the
directories in package-directory-list so that all users at the site can
share the same installed packages without each user having to install
them.

This change has no impact unless dotspacemacs-use-shared-packages is
explicitly changed to non-nil from the default value of nil.
@emacs18
Copy link
Contributor Author

emacs18 commented Aug 20, 2016

This is an update of PR #5464 which is now obsolete.

@bmag
Copy link
Contributor

bmag commented Aug 20, 2016

I support the idea, but there must be a better way than this, no? AFAIK site-lisp (e.g. /usr/local/share/emacs/24.5/site-lisp) is intended for shared Emacs config, including shared packages. Can you explain what are the problems with it?

Also, I'm not sure why change spacemacs//get-package-directory, but not configuration-layer//get-package-directory. Is there a reason? Can you please explain the technical reasoning and impact of this PR?

(dir (car (directory-files elpa-dir 'full pkg-match))))
(when dir (file-name-as-directory dir))))))
"Return the installed directory of PKG. Return `nil' if not found."
(let ((directories (cons package-user-dir
Copy link
Contributor

@bmag bmag Aug 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of this cons is not a list. I think you want append instead. Example from IELM session:

ELISP> (cons (list 1 2 3 4) (list 5 6))
((1 2 3 4)
 5 6)

ELISP> (append (list 1 2 3 4) (list 5 6))
(1 2 3 4 5 6)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, realised my mistake (that package-user-dir is not a list).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is nothing wrong with site-lisp. In fact I want to put installed packaged under site-lisp. With the proposed code, I do have the installed files under site-lisp. The issue is how does spacemacs know that the packages are installed already so that it does not install them under package-user-dir?

AFAIK package-directory-list was created to solve this problem, i.e., to allow site administrators to install packages under site-lisp directories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not change configuration-layer//get-package-directory?
It never occurred to me. In my testing just applying the change in this PR was sufficient in that
spacemacs honored the packages installed under site-lisp and so it did not install them under
package-user-dir.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After examining the value of package-alist, it appears that this variable already has the correct paths, i.e., 'dir' field of package-desc struct points to site-lisp directory rather than package-user-dir.

This brings up a question I had for a while. Why does spacemacs not use package-alist to figure out the location of the installed package, and instead have its own code to search the file system?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If spacemacs used package-alist to figure out package installation directory instead of searching package-user-dir, then I think this PR would not be needed. All I would have to do is just install packages under site-lisp, and package.el would take care of things.

@bmag
Copy link
Contributor

bmag commented Aug 24, 2016

@emacs18 I was trying to understand the idea behind the PR, because it looked weird to me that we need one. My questions were partly to help me understand the code, and partly to make you aware to parts of the code that I didn't know if you're aware of. I still don't understand all the background behind this PR, so I'll stop spamming this PR.

@syl20bnr
Copy link
Owner

@emacs18 What's your current solution ? Can you provide more details about your use case ? What are the technologies involved, what is the OS etc ... ?

Users cannot mount the shared file system at the correct place to get Spacemacs happy ?

@emacs18
Copy link
Contributor Author

emacs18 commented Jun 22, 2017 via email

@github-actions
Copy link

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this PR is still need merging!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Feb 29, 2020
@emacs18
Copy link
Contributor Author

emacs18 commented Mar 1, 2020

I've adopted the following method to deploy emacs that multiple folks can use within my group.

  • build emacs. The install directory will be referred to as $root.
  • install packages to $root/share/emacs/site-lisp/elpa
  • install spacemacs under $root/share/emacs/site-lisp/spacemacs
  • provide a common startup file anyone can use.

@emacs18 emacs18 closed this Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants