-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Add package archive fallback mechanism #6828
Conversation
core/core-configuration-layer.el
Outdated
url) | ||
(condition-case nil | ||
(if (url-http-file-exists-p url) | ||
(setq state 'avaialble) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
available
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My typing skills are weak 👀 Thanks for noticing this typo!
If |
6bbe9d1
to
fa4892e
Compare
fa4892e
to
503676a
Compare
Just pushed another commit that adds fallback functionality when one of the archives is down. You can test it by returning
So when any archive is not available, As fallback I am using snapshot provided by @zilongshanren. Thanks to melpa/melpa#4156 I've found this nice 'mirror'. The good thing is that MELPA is going to create official mirror that people could use when MELPA is down. P. S. I've made two commits for now - gonna squash them later on demand. Just wanna keep first commit for now. |
core/core-configuration-layer.el
Outdated
("gnu" . unknown)) | ||
"Status of ELPA archives.") | ||
|
||
(defvar configuration-layer-fallback-package-archive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am planning to convert it list of fallback archives.
2f55ac1
to
3414922
Compare
Pushed another commit. Instead of using one fallback url, use package-archives compatible list of fallback urls. If currently set url is not reachable, then try to connect to one of fallback urls. If all urls are unavailable - show an error with some hints and explanations. Again, you might want to change error message. But I tried to make it as useful as possible. 😸 |
And a good thing, now https://github.com/syl20bnr/spacemacs-elpa is used as primary fallback archive 😸 |
3414922
to
f699c63
Compare
core/core-configuration-layer.el
Outdated
("gnu" . unknown)) | ||
"Status of ELPA archives.") | ||
|
||
(defvar configuration-layer-fallback-package-archives |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we really need this. I mean, fallback archives can be added to the end of configuration-layer--elpa-archives
, so instead of switching to values from configuration-layer-fallback-package-archives
we can just remove first associated url and search for another. Once no urls are available for specific archive - error!
f699c63
to
4775fe4
Compare
Instead of using one fallback url, use package-archives compatible list of fallback urls. If currently set url is not reachable, then try to connect to one of fallback urls. If all urls are unavailable - show an error with some hints and explanations.
4775fe4
to
eded51e
Compare
Instead of storing fallback urls for package archives in separate variable and doing complicated operations in order to derive available url, store all urls (official and fallback ones) in `configuration-layer--elpa-archives`. This simplifies availability check and user configurations. Also get rid of `configuration-layer--elpa-archives-status` as it's really not used.
(state 'unavailable)) | ||
(condition-case nil | ||
(when (or (and (string-prefix-p "/" url) | ||
(file-readable-p url)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure that this is the best way of checking that archive url is accessible. file-accessible-directory-p
? I haven't tested situations when archive-contents
file is readable, but all other files are not readable by current user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@d12frosted Where can we find the documentation about file-readable-p
capable of checking URLs except in the C source ? This function does not block for a long time when the URL is not reachable ? What kind of tests did you do to check that file-readable-p
is not blocking for a long time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of tests did you do to check that file-readable-p is not blocking for a long time ?
I mean, did you test regular timeout method and file-readable-p
with the same input ?
Ok, I've made several changes. I simplified fallback mechanism, removed two redundant variables and improved error message. Oh and also I made it possible to use local package archive urls. |
I spammed pretty much in this PR with commits. I'll squash them once @syl20bnr give the green light 😸 For now I wish to preserve history. 😸 |
Just a quick note: this should close #7103 and provide a way for users behind corporate firewalls to use spacemacs in all it's glory. |
@ninrod is GitHub available for you behind your firewall? |
@d12frosted yes it is available. We have a severely slowed down connection pipe to and from it though. So the local clone is like heaven. But really, the local melpa solution is so awesome that I'm using it in home, even without a firewall. |
@ninrod I asked about GitHub just because some of packages used by Spacemacs are downloaded using
Indeed. Also it makes bootstrap testing much easier.
And this as well. Might be very useful for corporations, where they want to use specific stable version of Spacemacs with specific package archives snapshot (so no upstream changes break flow).
Glad you like it 💃 |
@d12frosted I should mention that I have the option of mirroring specific github repos inside an internal git server behind corp firewall. Out of curiosity, am I able to change those quelpa URLs to match my specific internal mirrors? |
We are talking about some Emacs Lisp code, so yes, it's possible to change it's behaviour 😸 There might be better way, but you always can just brutally redefine github fetcher in quelpa. 😸 |
let's do this! |
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! |
Seeing all these issues with package installation due to MELPA availability problems I decided to improve status check for all elpa archives and error about archive being unavailable instead of showing errors like 'package xxx is not available' in the future.
Also I removed timeout heuristic as it's not 100% accurate. I don't see any reason for it to be here once
configuration-layer-check-archive-status
is used.Note that
configuration-layer-check-archive-status
is a little bit beefed (more than we need at this point), but it might become handy in future.Oh, and I am not sure about the error message though. @syl20bnr, you might want to improve it. 😸
P. S. Hope I didn't miss anything.
P. P. S. Somewhat fixes #6836. Another related issue is #4453.