Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eic_tools
Spack
Commits
c35994d5
Commit
c35994d5
authored
9 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Plain Diff
Merge pull request #850 from mathstuf/partial-downloads
fetch_strategy: download to temporary files
parents
b75a3e11
e53571d2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/spack/spack/fetch_strategy.py
+22
-2
22 additions, 2 deletions
lib/spack/spack/fetch_strategy.py
lib/spack/spack/stage.py
+12
-0
12 additions, 0 deletions
lib/spack/spack/stage.py
with
34 additions
and
2 deletions
lib/spack/spack/fetch_strategy.py
+
22
−
2
View file @
c35994d5
...
@@ -157,12 +157,26 @@ def fetch(self):
...
@@ -157,12 +157,26 @@ def fetch(self):
tty
.
msg
(
"
Already downloaded %s
"
%
self
.
archive_file
)
tty
.
msg
(
"
Already downloaded %s
"
%
self
.
archive_file
)
return
return
possible_files
=
self
.
stage
.
expected_archive_files
save_file
=
None
partial_file
=
None
if
possible_files
:
save_file
=
self
.
stage
.
expected_archive_files
[
0
]
partial_file
=
self
.
stage
.
expected_archive_files
[
0
]
+
'
.part
'
tty
.
msg
(
"
Trying to fetch from %s
"
%
self
.
url
)
tty
.
msg
(
"
Trying to fetch from %s
"
%
self
.
url
)
curl_args
=
[
'
-O
'
,
# save file to disk
if
partial_file
:
save_args
=
[
'
-C
'
,
'
-
'
,
# continue partial downloads
'
-o
'
,
partial_file
]
# use a .part file
else
:
save_args
=
[
'
-O
'
]
curl_args
=
save_args
+
[
'
-f
'
,
# fail on >400 errors
'
-f
'
,
# fail on >400 errors
'
-D
'
,
'
-
'
,
# print out HTML headers
'
-D
'
,
'
-
'
,
# print out HTML headers
'
-L
'
,
self
.
url
,
]
'
-L
'
,
# resolve 3xx redirects
self
.
url
,
]
if
sys
.
stdout
.
isatty
():
if
sys
.
stdout
.
isatty
():
curl_args
.
append
(
'
-#
'
)
# status bar when using a tty
curl_args
.
append
(
'
-#
'
)
# status bar when using a tty
...
@@ -178,6 +192,9 @@ def fetch(self):
...
@@ -178,6 +192,9 @@ def fetch(self):
if
self
.
archive_file
:
if
self
.
archive_file
:
os
.
remove
(
self
.
archive_file
)
os
.
remove
(
self
.
archive_file
)
if
partial_file
and
os
.
path
.
exists
(
partial_file
):
os
.
remove
(
partial_file
)
if
spack
.
curl
.
returncode
==
22
:
if
spack
.
curl
.
returncode
==
22
:
# This is a 404. Curl will print the error.
# This is a 404. Curl will print the error.
raise
FailedDownloadError
(
raise
FailedDownloadError
(
...
@@ -209,6 +226,9 @@ def fetch(self):
...
@@ -209,6 +226,9 @@ def fetch(self):
"'
spack clean <package>
'
to remove the bad archive, then fix
"
,
"'
spack clean <package>
'
to remove the bad archive, then fix
"
,
"
your internet gateway issue and install again.
"
)
"
your internet gateway issue and install again.
"
)
if
save_file
:
os
.
rename
(
partial_file
,
save_file
)
if
not
self
.
archive_file
:
if
not
self
.
archive_file
:
raise
FailedDownloadError
(
self
.
url
)
raise
FailedDownloadError
(
self
.
url
)
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/stage.py
+
12
−
0
View file @
c35994d5
...
@@ -210,6 +210,18 @@ def _need_to_create_path(self):
...
@@ -210,6 +210,18 @@ def _need_to_create_path(self):
return
False
return
False
@property
def
expected_archive_files
(
self
):
"""
Possible archive file paths.
"""
paths
=
[]
if
isinstance
(
self
.
fetcher
,
fs
.
URLFetchStrategy
):
paths
.
append
(
os
.
path
.
join
(
self
.
path
,
os
.
path
.
basename
(
self
.
fetcher
.
url
)))
if
self
.
mirror_path
:
paths
.
append
(
os
.
path
.
join
(
self
.
path
,
os
.
path
.
basename
(
self
.
mirror_path
)))
return
paths
@property
@property
def
archive_file
(
self
):
def
archive_file
(
self
):
"""
Path to the source archive within this stage directory.
"""
"""
Path to the source archive within this stage directory.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment