Skip to content
Snippets Groups Projects
Commit 5eed196f authored by Dr. Christian Tacke's avatar Dr. Christian Tacke Committed by Adam J. Stewart
Browse files

Use util.url.join for URLs in GNU Mirrors / reorder Mirrors (#14395)

* Reorder GNU mirrors (#14395)

As @adamjstewart commented in #14395, GNU suggests to use
their mirror. So reorder the mirror to the top.

GNU Doc: https://www.gnu.org/prep/ftp.en.html

* Use spack.util.url.join for URLs in GNU mirrors (#14395)

One should not use os.path.join for URLs. This does only
work on POSIX systems.

Instead use spack.util.url.join.
So every part in spack uses the same url joining method.
parent 54ecc4e5
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path import spack.util.url
import spack.package import spack.package
...@@ -15,8 +14,8 @@ class GNUMirrorPackage(spack.package.PackageBase): ...@@ -15,8 +14,8 @@ class GNUMirrorPackage(spack.package.PackageBase):
#: List of GNU mirrors used by Spack #: List of GNU mirrors used by Spack
base_mirrors = [ base_mirrors = [
'https://ftp.gnu.org/gnu',
'https://ftpmirror.gnu.org/', 'https://ftpmirror.gnu.org/',
'https://ftp.gnu.org/gnu/',
# Fall back to http if https didn't work (for instance because # Fall back to http if https didn't work (for instance because
# Spack is bootstrapping curl) # Spack is bootstrapping curl)
'http://ftpmirror.gnu.org/' 'http://ftpmirror.gnu.org/'
...@@ -26,7 +25,8 @@ class GNUMirrorPackage(spack.package.PackageBase): ...@@ -26,7 +25,8 @@ class GNUMirrorPackage(spack.package.PackageBase):
def urls(self): def urls(self):
self._ensure_gnu_mirror_path_is_set_or_raise() self._ensure_gnu_mirror_path_is_set_or_raise()
return [ return [
os.path.join(m, self.gnu_mirror_path) for m in self.base_mirrors spack.util.url.join(m, self.gnu_mirror_path, resolve_href=True)
for m in self.base_mirrors
] ]
def _ensure_gnu_mirror_path_is_set_or_raise(self): def _ensure_gnu_mirror_path_is_set_or_raise(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment