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
344e902b
Commit
344e902b
authored
11 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Patches
Plain Diff
More stage tests.
parent
ff2018bc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/spack/spack/package.py
+13
-10
13 additions, 10 deletions
lib/spack/spack/package.py
lib/spack/spack/test/stage.py
+36
-4
36 additions, 4 deletions
lib/spack/spack/test/stage.py
with
49 additions
and
14 deletions
lib/spack/spack/package.py
+
13
−
10
View file @
344e902b
...
@@ -247,17 +247,16 @@ class SomePackage(Package):
...
@@ -247,17 +247,16 @@ class SomePackage(Package):
"""
"""
#
#
# These variables are per-package metadata will be defined by subclasses.
# These variables are defaults for the various relations defined on
# packages. Subclasses will have their own versions of these.
#
#
"""
By default a package has no dependencies
.
"""
"""
Specs of dependency packages, keyed by name
.
"""
dependencies
=
{}
dependencies
=
{}
"""
List of s
pecs of virtual packages provided by this package.
"""
"""
S
pecs of virtual packages provided by this package
, keyed by name
.
"""
provided
=
{}
provided
=
{}
"""
List of specs of conflicting packages.
"""
Specs of conflicting packages, keyed by name.
"""
TODO: implement conflicts.
"""
conflicted
=
{}
conflicted
=
{}
#
#
...
@@ -272,6 +271,7 @@ class SomePackage(Package):
...
@@ -272,6 +271,7 @@ class SomePackage(Package):
"""
Controls whether install and uninstall check deps before running.
"""
"""
Controls whether install and uninstall check deps before running.
"""
ignore_dependencies
=
False
ignore_dependencies
=
False
def
__init__
(
self
,
spec
):
def
__init__
(
self
,
spec
):
# These attributes are required for all packages.
# These attributes are required for all packages.
attr_required
(
self
,
'
homepage
'
)
attr_required
(
self
,
'
homepage
'
)
...
@@ -292,18 +292,17 @@ def __init__(self, spec):
...
@@ -292,18 +292,17 @@ def __init__(self, spec):
validate
.
url
(
self
.
url
)
validate
.
url
(
self
.
url
)
# Set up version
# Set up version
# TODO: get rid of version attr and use spec
# TODO: roll this into available_versions
if
not
hasattr
(
self
,
'
version
'
):
if
not
hasattr
(
self
,
'
version
'
):
try
:
try
:
self
.
version
=
url
.
parse_version
(
self
.
url
)
self
.
version
=
url
.
parse_version
(
self
.
url
)
except
UndetectableVersionError
:
except
UndetectableVersionError
:
tty
.
die
(
"
Couldn
'
t extract a default version from %s. You
"
+
tty
.
die
(
"
Couldn
'
t extract a default version from %s. You
"
+
"
must specify it explicitly in the package.
"
%
self
.
url
)
"
must specify it explicitly in the package.
"
%
self
.
url
)
elif
type
(
self
.
version
)
=
=
string
:
elif
type
(
self
.
version
)
!
=
Version
:
self
.
version
=
Version
(
self
.
version
)
self
.
version
=
Version
(
self
.
version
)
# Empty at first; only compute dependent packages if necessary
self
.
_dependents
=
None
# This is set by scraping a web page.
# This is set by scraping a web page.
self
.
_available_versions
=
None
self
.
_available_versions
=
None
...
@@ -312,6 +311,9 @@ def __init__(self, spec):
...
@@ -312,6 +311,9 @@ def __init__(self, spec):
if
self
.
versions
and
type
(
self
.
versions
)
!=
VersionList
:
if
self
.
versions
and
type
(
self
.
versions
)
!=
VersionList
:
self
.
versions
=
VersionList
(
self
.
versions
)
self
.
versions
=
VersionList
(
self
.
versions
)
# Empty at first; only compute dependent packages if necessary
self
.
_dependents
=
None
# stage used to build this package.
# stage used to build this package.
# TODO: hash the concrete spec and use that as the stage name.
# TODO: hash the concrete spec and use that as the stage name.
self
.
stage
=
Stage
(
self
.
url
,
"
%s-%s
"
%
(
self
.
name
,
self
.
version
))
self
.
stage
=
Stage
(
self
.
url
,
"
%s-%s
"
%
(
self
.
name
,
self
.
version
))
...
@@ -390,6 +392,7 @@ def dependents(self):
...
@@ -390,6 +392,7 @@ def dependents(self):
def
preorder_traversal
(
self
,
visited
=
None
):
def
preorder_traversal
(
self
,
visited
=
None
):
"""
This does a preorder traversal of the package
'
s dependence DAG.
"""
if
visited
is
None
:
if
visited
is
None
:
visited
=
set
()
visited
=
set
()
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/test/stage.py
+
36
−
4
View file @
344e902b
...
@@ -118,15 +118,19 @@ def check_setup(self, stage, stage_name):
...
@@ -118,15 +118,19 @@ def check_setup(self, stage, stage_name):
def
check_fetch
(
self
,
stage
,
stage_name
):
def
check_fetch
(
self
,
stage
,
stage_name
):
stage_path
=
self
.
get_stage_path
(
stage
,
stage_name
)
stage_path
=
self
.
get_stage_path
(
stage
,
stage_name
)
self
.
assert
True
(
archive_name
in
os
.
listdir
(
stage_path
))
self
.
assert
In
(
archive_name
,
os
.
listdir
(
stage_path
))
self
.
assertEqual
(
new_path
(
stage_path
,
archive_name
),
self
.
assertEqual
(
new_path
(
stage_path
,
archive_name
),
stage
.
archive_file
)
stage
.
archive_file
)
def
check_expand_archive
(
self
,
stage
,
stage_name
):
def
check_expand_archive
(
self
,
stage
,
stage_name
):
stage_path
=
self
.
get_stage_path
(
stage
,
stage_name
)
stage_path
=
self
.
get_stage_path
(
stage
,
stage_name
)
self
.
assertTrue
(
archive_name
in
os
.
listdir
(
stage_path
))
self
.
assertIn
(
archive_name
,
os
.
listdir
(
stage_path
))
self
.
assertTrue
(
archive_dir
in
os
.
listdir
(
stage_path
))
self
.
assertIn
(
archive_dir
,
os
.
listdir
(
stage_path
))
self
.
assertEqual
(
new_path
(
stage_path
,
archive_dir
),
stage
.
expanded_archive_path
)
readme
=
new_path
(
stage_path
,
archive_dir
,
readme_name
)
readme
=
new_path
(
stage_path
,
archive_dir
,
readme_name
)
self
.
assertTrue
(
os
.
path
.
isfile
(
readme
))
self
.
assertTrue
(
os
.
path
.
isfile
(
readme
))
...
@@ -226,7 +230,7 @@ def test_expand_archive(self):
...
@@ -226,7 +230,7 @@ def test_expand_archive(self):
self
.
check_destroy
(
stage
,
stage_name
)
self
.
check_destroy
(
stage
,
stage_name
)
def
test_
z
expand_archive
(
self
):
def
test_expand_archive
(
self
):
stage
=
Stage
(
archive_url
,
stage_name
)
stage
=
Stage
(
archive_url
,
stage_name
)
stage
.
fetch
()
stage
.
fetch
()
...
@@ -240,3 +244,31 @@ def test_zexpand_archive(self):
...
@@ -240,3 +244,31 @@ def test_zexpand_archive(self):
stage
.
destroy
()
stage
.
destroy
()
self
.
check_destroy
(
stage
,
stage_name
)
self
.
check_destroy
(
stage
,
stage_name
)
def
test_restage
(
self
):
stage
=
Stage
(
archive_url
,
stage_name
)
stage
.
fetch
()
stage
.
expand_archive
()
stage
.
chdir_to_archive
()
self
.
check_expand_archive
(
stage
,
stage_name
)
self
.
check_chdir_to_archive
(
stage
,
stage_name
)
# Try to make a file in the old archive dir
with
closing
(
open
(
'
foobar
'
,
'
w
'
))
as
file
:
file
.
write
(
"
this file is to be destroyed.
"
)
self
.
assertIn
(
'
foobar
'
,
os
.
listdir
(
stage
.
expanded_archive_path
))
# Make sure the file is not there after restage.
stage
.
restage
()
self
.
check_chdir
(
stage
,
stage_name
)
self
.
check_fetch
(
stage
,
stage_name
)
stage
.
chdir_to_archive
()
self
.
check_chdir_to_archive
(
stage
,
stage_name
)
self
.
assertNotIn
(
'
foobar
'
,
os
.
listdir
(
stage
.
expanded_archive_path
))
stage
.
destroy
()
self
.
check_destroy
(
stage
,
stage_name
)
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