Use composite stage also for develop specs (#44950)

This commit is contained in:
Harmen Stoppels 2024-07-01 11:24:16 +02:00 committed by Harmen Stoppels
parent eb2b5739b2
commit 45fca040c3
3 changed files with 9 additions and 16 deletions

View file

@ -1119,9 +1119,8 @@ def _make_stage(self):
if not link_format: if not link_format:
link_format = "build-{arch}-{hash:7}" link_format = "build-{arch}-{hash:7}"
stage_link = self.spec.format_path(link_format) stage_link = self.spec.format_path(link_format)
return DevelopStage(compute_stage_name(self.spec), dev_path, stage_link) source_stage = DevelopStage(compute_stage_name(self.spec), dev_path, stage_link)
else:
# To fetch the current version
source_stage = self._make_root_stage(self.fetcher) source_stage = self._make_root_stage(self.fetcher)
# all_stages is source + resources + patches # all_stages is source + resources + patches
@ -1451,10 +1450,8 @@ def do_fetch(self, mirror_only=False):
return return
checksum = spack.config.get("config:checksum") checksum = spack.config.get("config:checksum")
fetch = self.stage.needs_fetching
if ( if (
checksum checksum
and fetch
and (self.version not in self.versions) and (self.version not in self.versions)
and (not isinstance(self.version, GitVersion)) and (not isinstance(self.version, GitVersion))
): ):

View file

@ -346,8 +346,6 @@ class Stage(LockableStagingDir):
similar, and are intended to persist for only one run of spack. similar, and are intended to persist for only one run of spack.
""" """
#: Most staging is managed by Spack. DevelopStage is one exception.
needs_fetching = True
requires_patch_success = True requires_patch_success = True
def __init__( def __init__(
@ -772,8 +770,6 @@ def __init__(self):
"cache_mirror", "cache_mirror",
"steal_source", "steal_source",
"disable_mirrors", "disable_mirrors",
"needs_fetching",
"requires_patch_success",
] ]
) )
@ -812,6 +808,10 @@ def path(self):
def archive_file(self): def archive_file(self):
return self[0].archive_file return self[0].archive_file
@property
def requires_patch_success(self):
return self[0].requires_patch_success
@property @property
def keep(self): def keep(self):
return self[0].keep return self[0].keep
@ -823,7 +823,6 @@ def keep(self, value):
class DevelopStage(LockableStagingDir): class DevelopStage(LockableStagingDir):
needs_fetching = False
requires_patch_success = False requires_patch_success = False
def __init__(self, name, dev_path, reference_link): def __init__(self, name, dev_path, reference_link):

View file

@ -270,12 +270,9 @@ def trigger_bad_patch(pkg):
def test_patch_failure_develop_spec_exits_gracefully( def test_patch_failure_develop_spec_exits_gracefully(
mock_packages, config, install_mockery, mock_fetch, tmpdir, mock_stage mock_packages, config, install_mockery, mock_fetch, tmpdir, mock_stage
): ):
""" """ensure that a failing patch does not trigger exceptions for develop specs"""
ensure that a failing patch does not trigger exceptions
for develop specs
"""
spec = Spec("patch-a-dependency " "^libelf dev_path=%s" % str(tmpdir)) spec = Spec(f"patch-a-dependency ^libelf dev_path={tmpdir}")
spec.concretize() spec.concretize()
libelf = spec["libelf"] libelf = spec["libelf"]
assert "patches" in list(libelf.variants.keys()) assert "patches" in list(libelf.variants.keys())