Skip to content

Spec constraints under the "all" attribute in package requirements should not be validated #35026

@alalazo

Description

@alalazo

Steps to reproduce

Using the following packages.yaml:

packages:
  all:
    require:
    -  any_of: ["~shared", "@:"]

we cannot concretize:

$ spack spec hdf5~mpi
==> Error: variant "shared" not found in package "alsa-lib" [required from package "alsa-lib"]

Error message

$ spack -d spec hdf5~mpi
==> [2023-01-19-16:52:46.806926] Imported spec from built-in commands
==> [2023-01-19-16:52:46.807517] Imported spec from built-in commands
==> [2023-01-19-16:52:46.808670] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/config.yaml
==> [2023-01-19-16:52:46.825069] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/bootstrap.yaml
==> [2023-01-19-16:52:46.853263] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/repos.yaml
==> [2023-01-19-16:52:46.856945] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/config.yaml
==> [2023-01-19-16:52:46.874094] DATABASE LOCK TIMEOUT: 3s
==> [2023-01-19-16:52:46.874207] PACKAGE LOCK TIMEOUT: No timeout
==> [2023-01-19-16:52:46.874739] DATABASE LOCK TIMEOUT: 3s
==> [2023-01-19-16:52:46.874774] PACKAGE LOCK TIMEOUT: No timeout
==> [2023-01-19-16:52:46.874822] [BOOTSTRAP CONFIG SCOPE] name=_builtin
==> [2023-01-19-16:52:46.875196] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/bootstrap.yaml
==> [2023-01-19-16:52:46.880118] [BOOTSTRAP CONFIG SCOPE] name=defaults, path=/home/culpo/PycharmProjects/spack/etc/spack/defaults
==> [2023-01-19-16:52:46.880165] [BOOTSTRAP CONFIG SCOPE] name=defaults/linux, path=/home/culpo/PycharmProjects/spack/etc/spack/defaults/linux
==> [2023-01-19-16:52:46.880190] [BOOTSTRAP CONFIG SCOPE] name=bootstrap, path=/home/culpo/.spack/bootstrap/config
==> [2023-01-19-16:52:46.880208] [BOOTSTRAP CONFIG SCOPE] name=bootstrap/linux, path=/home/culpo/.spack/bootstrap/config/linux
==> [2023-01-19-16:52:46.880439] Reading config from file /home/culpo/.spack/bootstrap/config/linux/compilers.yaml
==> [2023-01-19-16:52:46.898910] [BOOTSTRAP ROOT SPEC] [email protected]: %gcc target=x86_64
==> [2023-01-19-16:52:46.899167] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/bootstrap.yaml
==> [2023-01-19-16:52:46.906232] [BOOTSTRAP EXECUTABLES patchelf] Try installed specs with query '[email protected]: %gcc target=x86_64'
==> [2023-01-19-16:52:46.968655] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/config.yaml
==> [2023-01-19-16:52:47.021877] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/modules.yaml
==> [2023-01-19-16:52:47.031136] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/linux/modules.yaml
==> [2023-01-19-16:52:47.092388] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/packages.yaml
==> [2023-01-19-16:52:47.136099] [BOOTSTRAP ROOT SPEC] [email protected]: %gcc target=x86_64
==> [2023-01-19-16:52:47.140151] [BOOTSTRAP ROOT SPEC] clingo-bootstrap@spack+python %gcc target=x86_64
==> [2023-01-19-16:52:47.140204] [BOOTSTRAP MODULE clingo] Try importing from Python
==> [2023-01-19-16:52:47.204083] [BOOTSTRAP MODULE clingo] The installed spec "clingo-bootstrap@spack+python %gcc target=x86_64 ^[email protected]/ba5ijauisd3uuixtmactc36vps7yfsrl" provides the "clingo" Python module
==> [2023-01-19-16:52:47.204458] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/concretizer.yaml
==> [2023-01-19-16:52:47.208096] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/repos.yaml
==> [2023-01-19-16:52:47.250519] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/packages.yaml
==> [2023-01-19-16:52:47.273280] Reading config from file /home/culpo/.spack/linux/packages.yaml
==> [2023-01-19-16:52:47.275760] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/config.yaml
==> [2023-01-19-16:52:47.290661] Reading config from file /home/culpo/PycharmProjects/spack/etc/spack/defaults/mirrors.yaml
==> [2023-01-19-16:52:47.291741] Checking existence of https://mirror.spack.io/build_cache/index.json
==> [2023-01-19-16:52:48.041838] Failure reading URL: HTTP Error 404: Not Found
==> [2023-01-19-16:52:49.136668] Reading config from file /home/culpo/.spack/linux/compilers.yaml
Traceback (most recent call last):
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1500, in _spec_clauses
    variant_def, _ = pkg_cls.variants[vname]
KeyError: 'shared'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1401, in spec_clauses
    clauses = self._spec_clauses(*args, **kwargs)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1503, in _spec_clauses
    raise RuntimeError(msg.format(vname, spec.name))
RuntimeError: variant "shared" not found in package "alsa-lib"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/culpo/PycharmProjects/spack/bin/spack", line 54, in <module>
    sys.exit(main())
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack_installable/main.py", line 37, in main
    sys.exit(spack.main.main(argv))
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 1004, in main
    return _main(argv)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 959, in _main
    return finish_parse_and_run(parser, cmd_name, env_format_error)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 987, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/main.py", line 636, in _invoke_command
    return_val = command(parser, args)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/cmd/spec.py", line 103, in spec
    concretized_specs = spack.cmd.parse_specs(args.specs, concretize=True)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/cmd/__init__.py", line 224, in parse_specs
    spec.concretize(tests=tests)  # implies normalize
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/spec.py", line 2950, in concretize
    self._new_concretize(tests)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/spec.py", line 2925, in _new_concretize
    result = solver.solve([self], tests=tests)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 2529, in solve
    result, _, _ = self.driver.solve(setup, specs, reuse=reusable_specs, output=output)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 687, in solve
    setup.setup(self, specs, reuse=reuse)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 2101, in setup
    self.pkg_rules(pkg, tests=self.tests)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1143, in pkg_rules
    self.package_requirement_rules(pkg)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1019, in package_requirement_rules
    self.emit_facts_from_requirement_rules(rules, virtual=False)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1276, in emit_facts_from_requirement_rules
    member_id = self.condition(
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1168, in condition
    requirements = self.spec_clauses(named_cond, body=True, required_from=name)
  File "/home/culpo/PycharmProjects/spack/lib/spack/spack/solver/asp.py", line 1406, in spec_clauses
    raise RuntimeError(msg)
RuntimeError: variant "shared" not found in package "alsa-lib" [required from package "alsa-lib"]

Information on your system

  • Spack: 0.20.0.dev0 (0cdb7cc)
  • Python: 3.8.10
  • Platform: linux-ubuntu20.04-icelake
  • Concretizer: clingo

General information

  • I have run spack debug report and reported the version of Spack/Python/Platform
  • I have searched the issues of this repo and believe this is not a duplicate
  • I have run the failing commands in debug mode and reported the output

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions