Skip to content

Fetching from URLs falls back to mirrors if they exist#13881

Merged
tgamblin merged 13 commits intospack:developfrom
alalazo:refactor/fetchers
Dec 20, 2019
Merged

Fetching from URLs falls back to mirrors if they exist#13881
tgamblin merged 13 commits intospack:developfrom
alalazo:refactor/fetchers

Conversation

@alalazo
Copy link
Copy Markdown
Member

@alalazo alalazo commented Nov 25, 2019

fixes #5613
fixes #4212
fixes #1090
refers to #13874

This PR permits to list mirrors of the main url in packages. If the main url is not available the url in the mirrors will be tried in order. It also defines a GNUMirrorPackage mixin to deal with the special case of GNU packages and modifies all the GNU packages in the built-in repository.

Note that the feature is implemented starting from 5b377a0 while previous commits are just trivial refactors that should reduce a bit the complexity of fetchers. If they are considered noise for a review I can split this PR into two.

@alalazo alalazo force-pushed the refactor/fetchers branch 2 times, most recently from 973cda2 to 66138d2 Compare November 25, 2019 15:01
@adamjstewart
Copy link
Copy Markdown
Member

This feature has been in demand for quite some time! I think it will be less valuable once Spack has its own source mirror on AWS, but still worth adding in my opinion!

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Nov 26, 2019

Considering the number of GNU packages that we support (latest count 55), if people agree I can go one step further and create a GNUFetcher mixin. At that point we could simplify a bit packages:

class Autoconf(AutotoolsPackage, GNUFetcher):
    gnu_path = 'autoconf/autoconf-2.69.tar.gz'

and have main url and mirrors setup automatically. This will give a single central place to change if we need to add further mirrors for GNU packages or switch the main url to something else. Waiting to receive feedback on this before proceeding.

Once the feature set of this PR is decided I'll also add docs.

@alalazo alalazo requested a review from ax3l November 26, 2019 10:55
@ax3l
Copy link
Copy Markdown
Member

ax3l commented Nov 26, 2019

Looks good so far and GNU fetcher abstraction sounds good to me!

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Nov 28, 2019

Can people have a look at f510531 and let me know what they think? If there's agreement on a solution like that I'll go on and modify the remaining 54 GNU packages.

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Nov 28, 2019

And add docs too 🙂

@nazavode
Copy link
Copy Markdown
Contributor

nazavode commented Nov 28, 2019

Just tried this patch on 008fe37 and spack fetch autoconf finally works. The certificate of the gnu mirror that is usually assigned to southern europe (https://mirror.kumi.systems/gnu/) expired yesterday. Today has been a bloodbath, had to sed my way to make GNU stuff work again.

@alalazo alalazo marked this pull request as ready for review November 29, 2019 11:06
@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Nov 29, 2019

This PR is ready for a first round of reviews

Copy link
Copy Markdown
Member

@ax3l ax3l left a comment

Choose a reason for hiding this comment

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

This is really cool, thank you so much!

I wonder if we should also re-try with the next mirror if the downloaded package archive hash does not match what we expected. This can be the case in captive portals but also if some pages moved and are wildcard redirected, or if index/404 pages are downloaded instead of the expected source.

Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

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

@alalazo: this looks awesome -- I have one minor renaming request and one request for DSL simplification.

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Dec 10, 2019

@tgamblin I think all the points raised in the review have been addressed. I have in my list further refactors involving fetchers, but if you agree I would save them for later PRs. Same for @ax3l request to try the next mirror on a failed checksum.

Copy link
Copy Markdown
Member

@tgamblin tgamblin left a comment

Choose a reason for hiding this comment

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

@alalazo: a few more change requests but this looks really good to me.

@alalazo
Copy link
Copy Markdown
Member Author

alalazo commented Dec 20, 2019

@tgamblin Let me know if there are further changes needed in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libtool: failing fetches Cannot download from sourceforge Alternate Download Locations

5 participants