Compare commits

...

8 Commits

Author SHA1 Message Date
Gregory Becker
89b4d2a33e wrote test case backwards 2025-02-10 15:20:46 -08:00
Gregory Becker
546e5a9a54 expand test further 2025-02-07 15:01:51 -08:00
Gregory Becker
401c183de9 expand on test and add comments on expected behaviors 2025-02-07 15:00:33 -08:00
Gregory Becker
b757500d9e add clarifying comment 2025-02-07 14:51:07 -08:00
Gregory Becker
2b759cf853 reuse: allow filtering by namespace 2025-02-07 10:54:49 +01:00
Massimiliano Culpo
a8e2da5bb8 Fix regression due to dyninst update (#48935) 2025-02-07 10:46:42 +01:00
Harmen Stoppels
97750189b6 clingo-bootstrap: fix +optimized build (#48931)
* fix regression `apple-clang` vs `%apple-clang`
* use f-strings
* remove --verbose flag from LDFLAGS
2025-02-07 09:46:05 +01:00
Teague Sterling
bcd40835a0 py-maturin: add v1.8.2 and refined dependencies (#48915) 2025-02-07 01:23:33 -07:00
7 changed files with 55 additions and 10 deletions

View File

@@ -34,6 +34,7 @@ an object, with the following keys:
1. ``roots``: if ``true`` root specs are reused, if ``false`` only dependencies of root specs are reused
2. ``from``: list of sources from which reused specs are taken
3. ``namespaces``: list of namespaces from which to reuse specs, or the string ``"any"``.
Each source in ``from`` is itself an object:
@@ -56,6 +57,7 @@ For instance, the following configuration:
concretizer:
reuse:
roots: true
namespaces: [builtin]
from:
- type: local
include:
@@ -63,7 +65,8 @@ For instance, the following configuration:
- "%clang"
tells the concretizer to reuse all specs compiled with either ``gcc`` or ``clang``, that are installed
in the local store. Any spec from remote buildcaches is disregarded.
in the local store. Any spec from remote buildcaches is disregarded. Any spec from a namespace other than
Spack's builtin repo is disregarded.
To reduce the boilerplate in configuration files, default values for the ``include`` and
``exclude`` options can be pushed up one level:

View File

@@ -25,6 +25,12 @@
"roots": {"type": "boolean"},
"include": LIST_OF_SPECS,
"exclude": LIST_OF_SPECS,
"namespaces": {
"oneOf": [
{"type": "string", "enum": ["any"]},
{"type": "array", "items": {"type": "string"}},
]
},
"from": {
"type": "array",
"items": {

View File

@@ -3986,6 +3986,7 @@ def __init__(self, configuration: spack.config.Configuration) -> None:
self.configuration = configuration
self.store = spack.store.create(configuration)
self.reuse_strategy = ReuseStrategy.ROOTS
self.reuse_namespaces = "any"
reuse_yaml = self.configuration.get("concretizer:reuse", False)
self.reuse_sources = []
@@ -4016,6 +4017,7 @@ def __init__(self, configuration: spack.config.Configuration) -> None:
self.reuse_strategy = ReuseStrategy.ROOTS
else:
self.reuse_strategy = ReuseStrategy.DEPENDENCIES
self.reuse_namespaces = reuse_yaml.get("namespaces", "any")
default_include = reuse_yaml.get("include", [])
default_exclude = reuse_yaml.get("exclude", [])
default_sources = [{"type": "local"}, {"type": "buildcache"}]
@@ -4083,6 +4085,9 @@ def reusable_specs(self, specs: List[spack.spec.Spec]) -> List[spack.spec.Spec]:
if self.reuse_strategy == ReuseStrategy.DEPENDENCIES:
result = [spec for spec in result if not any(root in spec for root in specs)]
if self.reuse_namespaces != "any":
result = [spec for spec in result if spec.namespace in self.reuse_namespaces]
return result

View File

@@ -1460,6 +1460,35 @@ def test_no_reuse_when_variant_condition_does_not_hold(self, mutable_database, m
new2 = spack.concretize.concretize_one("conditional-variant-pkg +two_whens")
assert new2.satisfies("@2 +two_whens +version_based")
def test_reuse_by_namespace(self, mutable_database, mock_packages):
spack.config.set("concretizer:reuse", True)
# Set spack to prefer an older version when doing new builds, but prioritize reuse higher
spack.config.set("packages:libelf", {"version": ["0.8.10"]})
# Expected behavior is to reuse the libelf@0.8.13 from mutable database
# despite configured preference for older version
reuse = spack.concretize.concretize_one("libelf")
assert reuse.installed
assert reuse.satisfies("@0.8.13")
# Reuse is turned off, so preference will be respected
spack.config.set("concretizer:reuse", {"namespaces": []})
noreuse = spack.concretize.concretize_one("libelf")
assert not noreuse.installed
assert noreuse.satisfies("@0.8.10")
# Expected behavior same as first concretization
spack.config.set("concretizer:reuse", {"namespaces": ["builtin.mock"]})
noreuse = spack.concretize.concretize_one("libelf")
assert noreuse.installed
assert noreuse.satisfies("@0.8.13")
# Expected behavior same as second concretization
spack.config.set("concretizer:reuse", {"namespaces": ["foobar"]})
noreuse = spack.concretize.concretize_one("libelf")
assert not noreuse.installed
assert noreuse.satisfies("@0.8.10")
def test_reuse_with_flags(self, mutable_database, mutable_config):
spack.config.set("concretizer:reuse", True)
spec = spack.concretize.concretize_one("pkg-a cflags=-g cxxflags=-g")

View File

@@ -36,7 +36,7 @@ bin/spack -h
bin/spack help -a
# Profile and print top 20 lines for a simple call to spack spec
spack -p --lines 20 spec mpileaks%gcc ^dyninst@10.0.0 ^elfutils@0.170
spack -p --lines 20 spec mpileaks%gcc
$coverage_run $(which spack) bootstrap status --dev --optional
# Check that we can import Spack packages directly as a first import

View File

@@ -92,9 +92,9 @@ def pgo_train(self):
# Set PGO training flags.
generate_mods = EnvironmentModifications()
generate_mods.append_flags("CFLAGS", "-fprofile-generate={}".format(reports))
generate_mods.append_flags("CXXFLAGS", "-fprofile-generate={}".format(reports))
generate_mods.append_flags("LDFLAGS", "-fprofile-generate={} --verbose".format(reports))
generate_mods.append_flags("CFLAGS", f"-fprofile-generate={reports}")
generate_mods.append_flags("CXXFLAGS", f"-fprofile-generate={reports}")
generate_mods.append_flags("LDFLAGS", f"-fprofile-generate={reports}")
with working_dir(self.build_directory, create=True):
cmake(*cmake_options, sources, extra_env=generate_mods)
@@ -118,14 +118,14 @@ def pgo_train(self):
# Clean the build dir.
rmtree(self.build_directory, ignore_errors=True)
if self.spec.satisfies("%clang") or self.spec.satisfies("apple-clang"):
if self.spec.satisfies("%clang") or self.spec.satisfies("%apple-clang"):
# merge reports
use_report = join_path(reports, "merged.prof")
raw_files = glob.glob(join_path(reports, "*.profraw"))
llvm_profdata("merge", "--output={}".format(use_report), *raw_files)
use_flag = "-fprofile-instr-use={}".format(use_report)
llvm_profdata("merge", f"--output={use_report}", *raw_files)
use_flag = f"-fprofile-instr-use={use_report}"
else:
use_flag = "-fprofile-use={}".format(reports)
use_flag = f"-fprofile-use={reports}"
# Set PGO use flags for next cmake phase.
use_mods = EnvironmentModifications()

View File

@@ -17,6 +17,7 @@ class PyMaturin(PythonPackage):
license("Apache-2.0")
version("1.8.2", sha256="e31abc70f6f93285d6e63d2f4459c079c94c259dd757370482d2d4ceb9ec1fa0")
version("1.6.0", sha256="b955025c24c8babc808db49e0ff90db8b4b1320dcc16b14eb26132841737230d")
version("1.5.1", sha256="3dd834ece80edb866af18cbd4635e0ecac40139c726428d5f1849ae154b26dca")
version("1.4.0", sha256="ed12e1768094a7adeafc3a74ebdb8dc2201fa64c4e7e31f14cfc70378bf93790")
@@ -42,4 +43,5 @@ class PyMaturin(PythonPackage):
# May be an accidental dependency, remove in the future
# https://git.alpinelinux.org/aports/commit/?id=7ad298b467403b96a6b97d050170e367f147a75f
# https://patchwork.yoctoproject.org/project/oe-core/patch/8803dc101b641c948805cab9e5784c38f43b0e51.1702791173.git.tim.orling@konsulko.com/
depends_on("bzip2", when="platform=darwin")
# This seems to still be an issue for others
depends_on("bzip2")