AutotoolsPackage / MakefilePackage: add gmake build dependency (#40380)

This commit is contained in:
Harmen Stoppels
2023-10-18 19:56:54 +02:00
committed by GitHub
parent 55198c49e5
commit 294e659ae8
13 changed files with 133 additions and 86 deletions

View File

@@ -1,7 +1,6 @@
Name, Supported Versions, Notes, Requirement Reason
Python, 3.6--3.12, , Interpreter for Spack
C/C++ Compilers, , , Building software
make, , , Build software
patch, , , Build software
tar, , , Extract/create archives
gzip, , , Compress/Decompress archives
1 Name Supported Versions Notes Requirement Reason
2 Python 3.6--3.12 Interpreter for Spack
3 C/C++ Compilers Building software
make Build software
4 patch Build software
5 tar Extract/create archives
6 gzip Compress/Decompress archives

View File

@@ -46,6 +46,7 @@ class AutotoolsPackage(spack.package_base.PackageBase):
depends_on("gnuconfig", type="build", when="target=ppc64le:")
depends_on("gnuconfig", type="build", when="target=aarch64:")
depends_on("gnuconfig", type="build", when="target=riscv64:")
depends_on("gmake", type="build")
conflicts("platform=windows")
def flags_to_build_system_args(self, flags):

View File

@@ -9,7 +9,8 @@
import spack.builder
import spack.package_base
from spack.directives import build_system, conflicts
from spack.directives import build_system, conflicts, depends_on
from spack.multimethod import when
from ._checks import (
BaseBuilder,
@@ -29,7 +30,10 @@ class MakefilePackage(spack.package_base.PackageBase):
legacy_buildsystem = "makefile"
build_system("makefile")
conflicts("platform=windows", when="build_system=makefile")
with when("build_system=makefile"):
conflicts("platform=windows")
depends_on("gmake", type="build")
@spack.builder.builder("makefile")

View File

@@ -13,8 +13,8 @@
import spack.concretize
import spack.operating_systems
import spack.platforms
import spack.spec
import spack.target
from spack.spec import ArchSpec, CompilerSpec, Spec
@pytest.fixture(scope="module")
@@ -64,7 +64,7 @@ def test_user_input_combination(config, target_str, os_str):
the operating system match.
"""
spec_str = "libelf os={} target={}".format(os_str, target_str)
spec = spack.spec.Spec(spec_str)
spec = Spec(spec_str)
assert spec.architecture.os == str(TEST_PLATFORM.operating_system(os_str))
assert spec.architecture.target == TEST_PLATFORM.target(target_str)
@@ -114,7 +114,7 @@ def test_target_container_semantic(cpu_flag, target_name):
],
)
def test_arch_spec_container_semantic(item, architecture_str):
architecture = spack.spec.ArchSpec(architecture_str)
architecture = ArchSpec(architecture_str)
assert item in architecture
@@ -141,24 +141,24 @@ def test_optimization_flags(compiler_spec, target_name, expected_flags, config):
@pytest.mark.parametrize(
"compiler,real_version,target_str,expected_flags",
[
(spack.spec.CompilerSpec("gcc@=9.2.0"), None, "haswell", "-march=haswell -mtune=haswell"),
(CompilerSpec("gcc@=9.2.0"), None, "haswell", "-march=haswell -mtune=haswell"),
# Check that custom string versions are accepted
(
spack.spec.CompilerSpec("gcc@=10foo"),
CompilerSpec("gcc@=10foo"),
"9.2.0",
"icelake",
"-march=icelake-client -mtune=icelake-client",
),
# Check that we run version detection (4.4.0 doesn't support icelake)
(
spack.spec.CompilerSpec("gcc@=4.4.0-special"),
CompilerSpec("gcc@=4.4.0-special"),
"9.2.0",
"icelake",
"-march=icelake-client -mtune=icelake-client",
),
# Check that the special case for Apple's clang is treated correctly
# i.e. it won't try to detect the version again
(spack.spec.CompilerSpec("apple-clang@=9.1.0"), None, "x86_64", "-march=x86-64"),
(CompilerSpec("apple-clang@=9.1.0"), None, "x86_64", "-march=x86-64"),
],
)
def test_optimization_flags_with_custom_versions(
@@ -180,8 +180,8 @@ def test_optimization_flags_with_custom_versions(
],
)
def test_satisfy_strict_constraint_when_not_concrete(architecture_tuple, constraint_tuple):
architecture = spack.spec.ArchSpec(architecture_tuple)
constraint = spack.spec.ArchSpec(constraint_tuple)
architecture = ArchSpec(architecture_tuple)
constraint = ArchSpec(constraint_tuple)
assert not architecture.satisfies(constraint)
@@ -204,16 +204,10 @@ def test_satisfy_strict_constraint_when_not_concrete(architecture_tuple, constra
def test_concretize_target_ranges(root_target_range, dep_target_range, result, monkeypatch):
# Monkeypatch so that all concretization is done as if the machine is core2
monkeypatch.setattr(spack.platforms.test.Test, "default", "core2")
spec_str = "a %%gcc@10 foobar=bar target=%s ^b target=%s" % (
root_target_range,
dep_target_range,
)
spec = spack.spec.Spec(spec_str)
spec = Spec(f"a %gcc@10 foobar=bar target={root_target_range} ^b target={dep_target_range}")
with spack.concretize.disable_compiler_existence_check():
spec.concretize()
assert str(spec).count("arch=test-debian6-%s" % result) == 2
assert spec.target == spec["b"].target == result
@pytest.mark.parametrize(

View File

@@ -1080,14 +1080,17 @@ def test_push_mirror_contents(
ci.import_signing_key(_signing_key())
spack_yaml_contents = """
with tmpdir.as_cwd():
with open("spack.yaml", "w") as f:
f.write(
f"""\
spack:
definitions:
- packages: [patchelf]
specs:
- $packages
mirrors:
test-mirror: {0}
test-mirror: {mirror_url}
ci:
enable-artifacts-buildcache: True
pipeline-gen:
@@ -1107,15 +1110,8 @@ def test_push_mirror_contents(
- nonbuildtag
image: basicimage
custom_attribute: custom!
""".format(
mirror_url
)
filename = str(tmpdir.join("spack.yaml"))
with open(filename, "w") as f:
f.write(spack_yaml_contents)
with tmpdir.as_cwd():
"""
)
env_cmd("create", "test", "./spack.yaml")
with ev.read("test"):
concrete_spec = Spec("patchelf").concretized()
@@ -1126,7 +1122,8 @@ def test_push_mirror_contents(
install_cmd("--add", "--keep-stage", json_path)
ci.push_mirror_contents(concrete_spec, mirror_url, True)
for s in concrete_spec.traverse():
ci.push_mirror_contents(s, mirror_url, True)
buildcache_path = os.path.join(mirror_dir.strpath, "build_cache")

View File

@@ -719,13 +719,12 @@ def test_check_deps_status_external(install_mockery, monkeypatch):
installer = create_installer(const_arg)
request = installer.build_requests[0]
# Mock the known dependent, b, as external so assumed to be installed
# Mock the dependencies as external so assumed to be installed
monkeypatch.setattr(spack.spec.Spec, "external", True)
installer._check_deps_status(request)
# exotic architectures will add dependencies on gnuconfig, which we want to ignore
installed = [x for x in installer.installed if not x.startswith("gnuconfig")]
assert installed[0].startswith("b")
for dep in request.spec.traverse(root=False):
assert inst.package_id(dep.package) in installer.installed
def test_check_deps_status_upstream(install_mockery, monkeypatch):
@@ -733,13 +732,12 @@ def test_check_deps_status_upstream(install_mockery, monkeypatch):
installer = create_installer(const_arg)
request = installer.build_requests[0]
# Mock the known dependent, b, as installed upstream
# Mock the known dependencies as installed upstream
monkeypatch.setattr(spack.spec.Spec, "installed_upstream", True)
installer._check_deps_status(request)
# exotic architectures will add dependencies on gnuconfig, which we want to ignore
installed = [x for x in installer.installed if not x.startswith("gnuconfig")]
assert installed[0].startswith("b")
for dep in request.spec.traverse(root=False):
assert inst.package_id(dep.package) in installer.installed
def test_add_bootstrap_compilers(install_mockery, monkeypatch):