Compare commits
4 Commits
develop-20
...
features/v
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3ed077fc39 | ||
![]() |
847d172bb9 | ||
![]() |
8b004c29e1 | ||
![]() |
8b1731688b |
@@ -566,6 +566,9 @@ def stringify(sym):
|
||||
if isinstance(sym, (list, tuple)):
|
||||
return tuple(stringify(a) for a in sym)
|
||||
|
||||
if str(sym.type) == "Function": # TODO GBB: Find appropriate test for this
|
||||
return tuple(stringify(a) for a in sym.arguments)
|
||||
|
||||
if clingo_cffi:
|
||||
# Clingo w/ CFFI will throw an exception on failure
|
||||
try:
|
||||
@@ -781,7 +784,7 @@ def on_model(model):
|
||||
for sym in best_model:
|
||||
if sym.name not in ("attr", "error", "opt_criterion"):
|
||||
tty.debug(
|
||||
"UNKNOWN SYMBOL: %s(%s)" % (sym.name, ", ".join(stringify(sym.arguments)))
|
||||
"UNKNOWN SYMBOL: %s%s" % (sym.name, stringify(sym.arguments))
|
||||
)
|
||||
|
||||
elif cores:
|
||||
@@ -1590,7 +1593,7 @@ class Body(object):
|
||||
|
||||
return clauses
|
||||
|
||||
def build_version_dict(self, possible_pkgs):
|
||||
def build_version_dict(self):
|
||||
"""Declare any versions in specs not declared in packages."""
|
||||
self.declared_versions = collections.defaultdict(list)
|
||||
self.possible_versions = collections.defaultdict(set)
|
||||
@@ -1598,7 +1601,7 @@ def build_version_dict(self, possible_pkgs):
|
||||
|
||||
packages_yaml = spack.config.get("packages")
|
||||
packages_yaml = _normalize_packages_yaml(packages_yaml)
|
||||
for pkg_name in possible_pkgs:
|
||||
for pkg_name in self.pkgs:
|
||||
pkg_cls = spack.repo.path.get_pkg_class(pkg_name)
|
||||
|
||||
# All the versions from the corresponding package.py file. Since concepts
|
||||
@@ -1969,11 +1972,11 @@ def define_variant_values(self):
|
||||
for pkg, variant, value in self.variant_values_from_specs:
|
||||
self.gen.fact(fn.variant_possible_value(pkg, variant, value))
|
||||
|
||||
def _facts_from_concrete_spec(self, spec, possible):
|
||||
def _facts_from_concrete_spec(self, spec):
|
||||
# tell the solver about any installed packages that could
|
||||
# be dependencies (don't tell it about the others)
|
||||
h = spec.dag_hash()
|
||||
if spec.name in possible and h not in self.seen_hashes:
|
||||
if spec.name in self.pkgs and h not in self.seen_hashes:
|
||||
self.reusable_and_possible[h] = spec
|
||||
try:
|
||||
# Only consider installed packages for repo we know
|
||||
@@ -2003,12 +2006,12 @@ def _facts_from_concrete_spec(self, spec, possible):
|
||||
# add the hash to the one seen so far
|
||||
self.seen_hashes.add(h)
|
||||
|
||||
def define_concrete_input_specs(self, specs, possible):
|
||||
def define_concrete_input_specs(self, specs):
|
||||
# any concrete specs in the input spec list
|
||||
for input_spec in specs:
|
||||
for spec in input_spec.traverse():
|
||||
if spec.concrete:
|
||||
self._facts_from_concrete_spec(spec, possible)
|
||||
self._facts_from_concrete_spec(spec)
|
||||
|
||||
def setup(self, driver, specs, reuse=None):
|
||||
"""Generate an ASP program with relevant constraints for specs.
|
||||
@@ -2029,20 +2032,28 @@ def setup(self, driver, specs, reuse=None):
|
||||
|
||||
# get list of all possible dependencies
|
||||
self.possible_virtuals = set(x.name for x in specs if x.virtual)
|
||||
possible = spack.package_base.possible_dependencies(
|
||||
*specs, virtuals=self.possible_virtuals, deptype=spack.dependency.all_deptypes
|
||||
self.pkgs = set(
|
||||
spack.package_base.possible_dependencies(
|
||||
*specs, virtuals=self.possible_virtuals, deptype=spack.dependency.all_deptypes
|
||||
)
|
||||
)
|
||||
|
||||
# TODO GBB: This only gets packages that can only appear as pure build deps,
|
||||
# need to rethink it to get packages that can appear as link/run or as pure build deps
|
||||
self.build_pkgs = self.pkgs - set(
|
||||
spack.package_base.possible_dependencies(
|
||||
*specs, virtuals=self.possible_virtuals, deptype=("link", "run")
|
||||
)
|
||||
)
|
||||
|
||||
# Fail if we already know an unreachable node is requested
|
||||
for spec in specs:
|
||||
missing_deps = [
|
||||
str(d) for d in spec.traverse() if d.name not in possible and not d.virtual
|
||||
str(d) for d in spec.traverse() if d.name not in self.pkgs and not d.virtual
|
||||
]
|
||||
if missing_deps:
|
||||
raise spack.spec.InvalidDependencyError(spec.name, missing_deps)
|
||||
|
||||
self.pkgs = set(possible)
|
||||
|
||||
# driver is used by all the functions below to add facts and
|
||||
# rules to generate an ASP program.
|
||||
self.gen = driver
|
||||
@@ -2066,18 +2077,18 @@ def setup(self, driver, specs, reuse=None):
|
||||
self.possible_compilers = self.generate_possible_compilers(specs)
|
||||
|
||||
# traverse all specs and packages to build dict of possible versions
|
||||
self.build_version_dict(possible)
|
||||
self.build_version_dict()
|
||||
self.add_concrete_versions_from_specs(specs, version_provenance.spec)
|
||||
self.add_concrete_versions_from_specs(dev_specs, version_provenance.dev_spec)
|
||||
|
||||
self.gen.h1("Concrete input spec definitions")
|
||||
self.define_concrete_input_specs(specs, possible)
|
||||
self.define_concrete_input_specs(specs)
|
||||
|
||||
if reuse:
|
||||
self.gen.h1("Reusable specs")
|
||||
self.gen.fact(fn.optimize_for_reuse())
|
||||
for reusable_spec in reuse:
|
||||
self._facts_from_concrete_spec(reusable_spec, possible)
|
||||
self._facts_from_concrete_spec(reusable_spec)
|
||||
|
||||
self.gen.h1("General Constraints")
|
||||
self.available_compilers()
|
||||
@@ -2103,6 +2114,10 @@ def setup(self, driver, specs, reuse=None):
|
||||
self.preferred_variants(pkg)
|
||||
self.target_preferences(pkg)
|
||||
|
||||
self.gen.h1("Package Alternates")
|
||||
for pkg in sorted(self.pkgs): # TODO GBB: Can we cleverly reduce the size of this?
|
||||
self.gen.fact(fn.name_mangled(pkg, 3))
|
||||
|
||||
# Inject dev_path from environment
|
||||
for ds in dev_specs:
|
||||
self.condition(spack.spec.Spec(ds.name), ds, msg="%s is a develop spec" % ds.name)
|
||||
@@ -2176,8 +2191,10 @@ def hash(self, pkg, h):
|
||||
self._specs[pkg] = self._hash_lookup[h]
|
||||
|
||||
def node(self, pkg):
|
||||
print(pkg)
|
||||
name = pkg[0] if isinstance(pkg, tuple) else pkg
|
||||
if pkg not in self._specs:
|
||||
self._specs[pkg] = spack.spec.Spec(pkg)
|
||||
self._specs[pkg] = spack.spec.Spec(name)
|
||||
|
||||
def _arch(self, pkg):
|
||||
arch = self._specs[pkg].architecture
|
||||
@@ -2370,7 +2387,8 @@ def build_specs(self, function_tuples):
|
||||
# predicates on virtual packages.
|
||||
if name != "error":
|
||||
pkg = args[0]
|
||||
if spack.repo.path.is_virtual(pkg):
|
||||
pkg_name = pkg[0] if isinstance(pkg, tuple) else pkg
|
||||
if spack.repo.path.is_virtual(pkg_name):
|
||||
continue
|
||||
|
||||
# if we've already gotten a concrete spec for this pkg,
|
||||
|
@@ -40,6 +40,167 @@ attr(Name, A1, A2, A3, A4) :- literal(LiteralID, Name, A1, A2, A3, A4), literal_
|
||||
#defined literal/5.
|
||||
#defined literal/6.
|
||||
|
||||
%--------------------------------------------------
|
||||
% Map package attributes to mangled names
|
||||
%--------------------------------------------------
|
||||
|
||||
%package_attr((Name, N), A1) :- package_attr(Name, A1), name_mangled(name, M, N)
|
||||
%package_attr((Name, N), A1, A2) :- package_attr(Name, A1, A2), name_mangled(name, M, N)
|
||||
%package_attr((Name, N), A1, A2, A3) :- package_attr(Name, A1, A2, A3), name_mangled(name, M, N)
|
||||
%package_attr((Name, N), A1, A2, A3, A4) :- package_attr(Name, A1, A2, A3, A4), name_mangled(name, M, N)
|
||||
|
||||
package_alternate(Name, (Name, N)) :- name_mangled(Name, M), N=1..M.
|
||||
package_alternate(Package, Package) :- name_mangled(Package, _). %TODO GBB: stand in for "name exists"
|
||||
|
||||
version_declared((Package, N), Version, Weight, Origin)
|
||||
:- version_declared(Package, Version, Weight, Origin),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
version_equivalent((Package, N), Version, RefVersion)
|
||||
:- version_equivalent(Package, Version, RefVersion),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
deprecated_version((Package, N), Version)
|
||||
:- deprecated_version(Package, Version),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
conflict((Package, N), (Trigger, N), (Constraint, N), Msg)
|
||||
:- conflict(Package, Trigger, Constraint, Msg),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
node_compiler_preference((Package, N), Compiler, CompilerVersion, Weight)
|
||||
:- node_compiler_preference(Package, Compiler, CompilerVersion, Weight),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant((Package, N), Variant)
|
||||
:- variant(Package, Variant),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant_condition((Condition, N), (Package, N), Variant)
|
||||
:- variant_condition(Condition, Package, Variant),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant_single_value((Package, N), Name)
|
||||
:- variant_single_value(Package, Name),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant_default_value_from_package_py((Package, N), Variant, Value)
|
||||
:- variant_default_value_from_package_py(Package, Variant, Value),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant_value_from_disjoint_sets((Package, N), Variant, Value, SetID)
|
||||
:- variant_value_from_disjoint_sets(Package, Variant, Value, SetID),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant_possible_value((Package, N), Variant, Value)
|
||||
:- variant_possible_value(Package, Variant, Value),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant_sticky((Package, N), Variant)
|
||||
:- variant_sticky(Package, Variant),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
pkg_provider_preference((Package, N), Virtual, Provider, Weight)
|
||||
:- pkg_provider_preference(Package, Virtual, Provider, Weight),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
condition((Condition, N))
|
||||
:- condition(Condition),
|
||||
condition_requirement((Condition, N), _, _).
|
||||
condition((Condition, N))
|
||||
:- condition(Condition),
|
||||
condition_requirement((Condition, N), _, _, _).
|
||||
condition((Condition, N))
|
||||
:- condition(Condition),
|
||||
condition_requirement((Condition, N), _, _, _, _).
|
||||
condition((Condition, N))
|
||||
:- condition(Condition),
|
||||
condition_requirement((Condition, N), _, _, _, _).
|
||||
|
||||
condition_requirement((Condition, N), Name, (Package, N))
|
||||
:- condition_requirement(Condition, Name, Package),
|
||||
package_alternate(Package, (Package, N)).
|
||||
condition_requirement((Condition, N), Name, (Package, N), A2)
|
||||
:- condition_requirement(Condition, Name, Package, A2),
|
||||
package_alternate(Package, (Package, N)).
|
||||
condition_requirement((Condition, N), Name, (Package, N), A2, A3)
|
||||
:- condition_requirement(Condition, Name, Package, A2, A3),
|
||||
package_alternate(Package, (Package, N)).
|
||||
condition_requirement((Condition, N), Name, (Package, N), A2, A3, A4)
|
||||
:- condition_requirement(Condition, Name, Package, A2, A3, A4),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
imposed_constraint((Condition, N), Name, (Package, N))
|
||||
:- imposed_constraint(Condition, Name, Package),
|
||||
package_alternate(Package, (Package, N)).
|
||||
imposed_constraint((Condition, N), Name, (Package, N), A2)
|
||||
:- imposed_constraint(Condition, Name, Package, A2),
|
||||
package_alternate(Package, (Package, N)).
|
||||
imposed_constraint((Condition, N), Name, (Package, N), A2, A3)
|
||||
:- imposed_constraint(Condition, Name, Package, A2, A3),
|
||||
package_alternate(Package, (Package, N)).
|
||||
imposed_constraint((Condition, N), Name, (Package, N), A2, A3, A4)
|
||||
:- imposed_constraint(Condition, Name, Package, A2, A3, A4),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
possible_provider((Package, N), Virtual)
|
||||
:- possible_provider(Package, Virtual),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
provider_condition((Condition, N), (Package, N), Virtual)
|
||||
:- provider_condition(Condition, Package, Virtual),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
dependency_condition((Condition, N), (Package, N), Dependency)
|
||||
:- dependency_condition(Condition, Package, Dependency),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
dependency_type((Condition, N), Type)
|
||||
:- dependency_condition((Condition, N), (_, N), _),
|
||||
dependency_type(Condition, Type).
|
||||
|
||||
% Do we need one for default_provider_preference?
|
||||
|
||||
requirement_group((Package, N), RGroupID)
|
||||
:- requirement_group(Package, RGroupID),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
requirement_policy((Package, N), RGroupID, Policy)
|
||||
:- requirement_policy(Package, RGroupID, Policy),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
requirement_group_member((MemberID, N), (Package, N), RGroupID)
|
||||
:- requirement_group_member(MemberID, Package, RGroupID),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
requirement_has_weight((MemberID, N), Weight)
|
||||
:- requirement_has_weight(MemberID, Weight),
|
||||
requirement_group_member((MemberID, N), (_, N), _).
|
||||
|
||||
buildable_false((Package, N))
|
||||
:- buildable_false(Package),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
possible_external((Condition, N), (Package, N), Index)
|
||||
:- possible_external(Condition, Package, Index),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
variant_default_value_from_packages_yaml((Package, N), Variant, Value)
|
||||
:- variant_default_value_from_packages_yaml(Package, Variant, Value),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
target_weight((Package, N), Target, Weight)
|
||||
:- target_weight(Package, Target, Weight),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
version_satisfies((Package, N), Constraint, Version)
|
||||
:- version_satisfies(Package, Constraint, Version),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
installed_hash((Package, N), Hash)
|
||||
:- installed_hash(Package, Hash),
|
||||
package_alternate(Package, (Package, N)).
|
||||
|
||||
%-----------------------------------------------------------------------------
|
||||
% Version semantics
|
||||
%-----------------------------------------------------------------------------
|
||||
@@ -134,18 +295,21 @@ possible_version_weight(Package, Weight)
|
||||
% versions, virtual nodes with version constraints require this rule to be
|
||||
% able to choose versions
|
||||
{ attr("version", Package, Version) : version_satisfies(Package, Constraint, Version) }
|
||||
:- attr("node_version_satisfies", Package, Constraint).
|
||||
:- attr("node_version_satisfies", Package, Constraint),
|
||||
attr("node", Package).
|
||||
|
||||
% If there is at least a version that satisfy the constraint, impose a lower
|
||||
% bound on the choice rule to avoid false positives with the error below
|
||||
1 { attr("version", Package, Version) : version_satisfies(Package, Constraint, Version) }
|
||||
:- attr("node_version_satisfies", Package, Constraint),
|
||||
version_satisfies(Package, Constraint, _).
|
||||
version_satisfies(Package, Constraint, _),
|
||||
attr("node", Package).
|
||||
|
||||
% More specific error message if the version cannot satisfy some constraint
|
||||
% Otherwise covered by `no_version_error` and `versions_conflict_error`.
|
||||
error(1, "No valid version for '{0}' satisfies '@{1}'", Package, Constraint)
|
||||
:- attr("node_version_satisfies", Package, Constraint),
|
||||
attr("node", Package),
|
||||
C = #count{ Version : attr("version", Package, Version), version_satisfies(Package, Constraint, Version)},
|
||||
C < 1.
|
||||
|
||||
@@ -240,6 +404,19 @@ do_not_impose(ID) :-
|
||||
% They're only triggered if the associated dependnecy condition holds.
|
||||
attr("depends_on", Package, Dependency, Type)
|
||||
:- dependency_holds(Package, Dependency, Type),
|
||||
Type != "build",
|
||||
not virtual(Dependency).
|
||||
|
||||
attr("depends_on", Package, Dependency, "build")
|
||||
:- dependency_holds(Package, Dependency, "build"),
|
||||
dependency_holds(Package, Dependency, Type),
|
||||
Type != "build",
|
||||
not virtual(Dependency).
|
||||
|
||||
1 { attr("depends_on", Package, DepMangled, "build") : package_alternate(Dependency, DepMangled) } 1
|
||||
:- dependency_holds(Package, Dependency, "build"),
|
||||
not dependency_holds(Package, Dependency, "link"),
|
||||
not dependency_holds(Package, Dependency, "run"),
|
||||
not virtual(Dependency).
|
||||
|
||||
% every root must be a node
|
||||
@@ -289,9 +466,24 @@ error(0, Msg) :- attr("node", Package),
|
||||
% provider for that virtual then it depends on the provider
|
||||
attr("depends_on", Package, Provider, Type)
|
||||
:- dependency_holds(Package, Virtual, Type),
|
||||
Type != "build",
|
||||
provider(Provider, Virtual),
|
||||
not external(Package).
|
||||
|
||||
attr("depends_on", Package, Provider, "build")
|
||||
:- dependency_holds(Package, Virtual, "build"),
|
||||
dependency_holds(Package, Virtual, Type),
|
||||
Type != "build",
|
||||
provider(Provider, Virtual),
|
||||
not external(Package).
|
||||
|
||||
1 { attr("depends_on", Package, ProviderMangled, "build") : package_alternate(Provider, ProviderMangled) } 1
|
||||
:- dependency_holds(Package, Virtual, "build"),
|
||||
not dependency_holds(Package, Virtual, "link"),
|
||||
not dependency_holds(Package, Virtual, "run"),
|
||||
provider(Provider, Virtual),
|
||||
not external(Package).
|
||||
|
||||
% dependencies on virtuals also imply that the virtual is a virtual node
|
||||
attr("virtual_node", Virtual)
|
||||
:- dependency_holds(Package, Virtual, Type),
|
||||
@@ -1132,6 +1324,9 @@ opt_criterion(100, "number of packages to build (vs. reuse)").
|
||||
#minimize { 1@100,Package : build(Package), optimize_for_reuse() }.
|
||||
#defined optimize_for_reuse/0.
|
||||
|
||||
#minimize { 0@99: #true }.
|
||||
#minimize { PSID@99,Package,PSID : attr("node", (Package, PSID)) }.
|
||||
|
||||
% A condition group specifies one or more specs that must be satisfied.
|
||||
% Specs declared first are preferred, so we assign increasing weights and
|
||||
% minimize the weights.
|
||||
|
@@ -26,3 +26,15 @@
|
||||
#show error/7.
|
||||
|
||||
% debug
|
||||
#show provider/2.
|
||||
#show virtual_condition_holds/2.
|
||||
#show provider_condition/3.
|
||||
#show possible_provider/2.
|
||||
#show dependency_condition/3.
|
||||
#show condition_holds/1.
|
||||
#show condition_requirement/3.
|
||||
#show condition_requirement/4.
|
||||
#show condition_requirement/5.
|
||||
#show condition_requirement/6.
|
||||
#show dependency_holds/3.
|
||||
#show dependency_type/2.
|
@@ -48,6 +48,7 @@ class Ncurses(AutotoolsPackage, GNUMirrorPackage):
|
||||
conflicts("abi=6", when="@:5.9", msg="6 is not compatible with this release")
|
||||
|
||||
depends_on("pkgconfig", type="build")
|
||||
depends_on("pkgconf@1.8.0", type="build")
|
||||
|
||||
patch("patch_gcc_5.txt", when="@6.0%gcc@5.0:")
|
||||
patch("sed_pgi.patch", when="@:6.0")
|
||||
|
@@ -56,6 +56,9 @@ class Zlib(MakefilePackage, Package):
|
||||
patch("w_patch.patch", when="@1.2.11%cce")
|
||||
patch("configure-cc.patch", when="@1.2.12")
|
||||
|
||||
depends_on("pkgconf@:1.7", type="build")
|
||||
# depends_on("pkgconfig", type="build")
|
||||
|
||||
@property
|
||||
def libs(self):
|
||||
shared = "+shared" in self.spec
|
||||
|
Reference in New Issue
Block a user