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

request to consider local package archives #4230

Closed
emacs18 opened this issue Dec 19, 2015 · 4 comments
Closed

request to consider local package archives #4230

emacs18 opened this issue Dec 19, 2015 · 4 comments
Labels
stale marked as a stale issue/pr (usually by a bot) User Configuration

Comments

@emacs18
Copy link
Contributor

emacs18 commented Dec 19, 2015

I would like to request that you not make too many assumptions regarding
package-archives, so that those of us who use custom package archives don't
have to do too much work.

Recent changes in spacemacs develop branch make it more difficult to use custom
archives. By custom I mean setting package-archives to a value such as

    '(("my" . "/u/me/public_html/elpa/"))

rather than a value such as

    '(("melpa" . "https://melpa.org/packages/")
      ("gnu"   . "https://elpa.gnu.org/packages/"))

Why use custom archive? To make it easier to support many users in my
organization. Some of the advantages of local archives are
(a) packages are updated at a time of my choosing and not left up to someone
else on internet
(b) everyone in the group is assured of using the same packages to make things
more consistent which simplifies debugging problems
(c) no need to waste internet bandwidth to download packages
(d) better security

Until about two weeks ago, I had to make just a few lines of change in
spacemacs to use custom archives, e.g., few lines of change such as these were
all that was needed:

    diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el
    index 76c287d..1be471c 100644
    --- a/core/core-configuration-layer.el
    +++ b/core/core-configuration-layer.el
    @@ -112,9 +112,8 @@
                  "If non-nil this package is excluded from all layers.")))

     (defvar configuration-layer--elpa-archives
    -  '(("melpa" . "melpa.org/packages/")
    -    ("org"   . "orgmode.org/elpa/")
    -    ("gnu"   . "elpa.gnu.org/packages/"))
    +  '(("my-elpa" . "http://localhost/~my/elpa/elpa/")
    +    ("my-org" . "http://localhost/~my/elpa/orgmode/"))
       "List of ELPA archives required by Spacemacs.")

     (defvar configuration-layer--package-archives-refreshed nil

    diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el
    index 76a4158..2c489b1 100644
    --- a/core/core-dotspacemacs.el
    +++ b/core/core-dotspacemacs.el
    @@ -252,7 +252,7 @@ declared in a layer which is not a member of
       "List of search tool executable names. Spacemacs uses the first installed
     tool of the list. Supported tools are `ag', `pt', `ack' and `grep'.")

    -(defvar dotspacemacs-default-package-repository 'melpa-stable
    +(defvar dotspacemacs-default-package-repository 'my-elpa
       "The default package repository used if no explicit repository has been
     specified with an installed package.
     NOT USED FOR NOW :-)")

In recent weeks, more layers of code are being added. For example I now have to
make changes such as this to undo a recent change:

    diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el
    index 76c287d..1be471c 100644
    --- a/core/core-configuration-layer.el
    +++ b/core/core-configuration-layer.el
    @@ -176,21 +175,7 @@ of all reachable ones.
     If the address of an archive already contains the protocol then this address is
     left untouched.
     The returned list has a `package-archives' compliant format."
    -  (mapcar
    -   (lambda (x)
    -     (cons (car x)
    -           (if (string-match-p "http" (cdr x))
    -               (cdr x)
    -             (concat (if (and dotspacemacs-elpa-https
    -                              ;; for now org ELPA repository does
    -                              ;; not support HTTPS
    -                              ;; TODO when org ELPA repo support
    -                              ;; HTTPS remove the check
    -                              ;; `(not (equal "org" (car x)))'
    -                              (not (equal "org" (car x))))
    -                         "https://"
    -                       "http://") (cdr x)))))
    -   archives))
    +  archives)

     (defun configuration-layer/retrieve-package-archives (&optional quiet force)
       "Retrieve all archives declared in current `package-archives'.

Also my package-archive used point to local directories such as

    '(("my" . "/u/me/public_html/elpa/"))

However recent changes force me to change this to something like

    '(("my" . "http://localhost/~me/elpa/"))

where HTTP had to be used, because support for local archive was removed in the
past two weeks.

I hope that you bear in mind those of us who need to or want to use local
package archives and not make changes that make our lives more difficult.

@github-actions
Copy link

This issue 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 issue is still valid!

@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 don't need this any more, because I found alternatives.

@emacs18 emacs18 closed this as completed Mar 1, 2020
@duianto
Copy link
Contributor

duianto commented Mar 15, 2020

It could help others if you are able to provide some notes on what the alternatives are.

@emacs18
Copy link
Contributor Author

emacs18 commented Mar 15, 2020

I branched spacemacs to make my custom changes as detailed below.
The change below was to just remove code within spacemacs that changed package related settings.
These are setup within my own init file before spacemacs setup code is loaded.

This and other changes that I made can be found on 'site' branch at https://github.com/emacs18/spacemacs.

diff --git a/.lock b/.lock
index 958c7524a..1833d4b14 100644
--- a/.lock
+++ b/.lock
@@ -12,10 +12,3 @@
     ("org"      . "orgmode.org/elpa/")
     ("gnu"      . "elpa.gnu.org/packages/")
     ("spacelpa" . ,(concat configuration-layer-stable-elpa-archive "/packages/"))))
-
-(setq package-archive-priorities
-      '(("spacelpa" . 8)
-        ("melpa"    . 4)
-        ("org"      . 2)
-        ("gnu"      . 1)))
-
diff --git a/core/core-configuration-layer.el b/core/core-configuration-layer.el
index 9f14733b2..0ba42473d 100644
--- a/core/core-configuration-layer.el
+++ b/core/core-configuration-layer.el
@@ -436,8 +436,6 @@ cache folder.")
     (setq package-user-dir
           (configuration-layer/elpa-directory
            configuration-layer--elpa-root-directory))
-    (setq package-archives (configuration-layer//resolve-package-archives
-                            configuration-layer-elpa-archives))
     ;; optimization, no need to activate all the packages so early
     (setq package-enable-at-startup nil)
     (package-initialize 'noactivate)
@@ -2560,10 +2558,7 @@ Original code from dochang at https://github.com/dochang/elpa-clone"
 (defun configuration-layer/create-elpa-repository (name output-dir)
   "Create an ELPA repository containing all packages supported by Spacemacs."
   (configuration-layer/make-all-packages 'no-discover)
-  (let (package-archive-contents
-        (package-archives '(("melpa" . "https://melpa.org/packages/")
-                            ("org"   . "https://orgmode.org/elpa/")
-                            ("gnu"   . "https://elpa.gnu.org/packages/"))))
+  (let (package-archive-contents)
     (package-refresh-contents)
     (package-read-all-archive-contents)
     (let* ((packages (configuration-layer//get-indexed-elpa-package-names))

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) User Configuration
Projects
None yet
Development

No branches or pull requests

3 participants