Commit graph

23160 commits

Author SHA1 Message Date
Cyrus Harrison
a5213dabb1 bugfix for active when pkg is already active error (#22587)
* bugfix for active when pkg is already active error

Co-authored-by: Greg Becker <becker33@llnl.gov>
2021-05-22 11:51:20 -07:00
Massimiliano Culpo
6e714808fa Enforce uniqueness of the version_weight atom per node
fixes #22565

This change enforces the uniqueness of the version_weight
atom per node(Package) in the DAG. It does so by applying
FTSE and adding an extra layer of indirection with the
possible_version_weight/2 atom.

Before this change it may have happened that for the same
node two different version_weight/2 were in the answer set,
each of which referred to a different spec with the same
version, and their weights would sum up.

This lead to unexpected result like preferring to build a
new version of an external if the external version was
older.
2021-05-22 11:51:20 -07:00
Massimiliano Culpo
9f99e8ad64 Externals are preferred even when they have non-default variant values
fixes #22596

Variants which are specified in an external spec are not
scored negatively if they encode a non-default value.
2021-05-22 11:51:20 -07:00
Massimiliano Culpo
18880a668b clingo: modify recipe for bootstrapping (#22354)
* clingo: modify recipe for bootstrapping

Modifications:
- clingo builds with shared Python only if ^python+shared
- avoid building the clingo app for bootstrapping
- don't link to libpython when bootstrapping

* Remove option that breaks on linux

* Give more hints for the current Python

* Disable CLINGO_BUILD_PY_SHARED for bootstrapping

* bootstrapping: try to detect the current python from std library

This is much faster than calling external executables

* Fix compatibility with Python 2.6

* Give hints on which compiler and OS to use when bootstrapping

This change hints which compiler to use for bootstrapping clingo
(either GCC or Apple Clang on MacOS). On Cray platforms it also
hints to build for the frontend system, where software is meant
to be installed.

* Use spec_for_current_python to constrain module requirement

(cherry picked from commit d5fa509b07)
2021-05-22 11:51:20 -07:00
Massimiliano Culpo
e7494b627b ASP-based solver: model disjoint sets for multivalued variants (#22534)
* ASP-based solver: avoid adding values to variants when they're set

fixes #22533
fixes #21911

Added a rule that prevents any value to slip in a variant when the
variant is set explicitly. This is relevant for multi-valued variants,
in particular for those that have disjoint sets of values.

* Ensure disjoint sets have a clear semantics for external packages
2021-05-22 11:51:20 -07:00
Massimiliano Culpo
b11dd0478a Make SingleFileScope able to repopulate the cache after clearing it (#22559)
fixes #22547

SingleFileScope was not able to repopulate its cache before this
change. This was affecting the configuration seen by environments
using clingo bootstrapped from sources, since the bootstrapping
operation involved a few cache invalidation for config files.
2021-05-22 11:51:20 -07:00
Rémi Lacroix
31a07f9bc4 Channelflow: Fix the package. (#22483)
A search and replace went wrong in 2264e30d99.

Thanks to @wadudmiah who reported this issue.
2021-05-22 11:51:20 -07:00
Harmen Stoppels
61e619bb27 spack location: bugfix for out of source build dirs (#22348) 2021-05-22 11:51:20 -07:00
Todd Gamblin
4d148a430e bugfix: allow imposed constraints to be overridden in special cases
In most cases, we want condition_holds(ID) to imply any imposed
constraints associated with the ID. However, the dependency relationship
in Spack is special because it's "extra" conditional -- a dependency
*condition* may hold, but we have decided that externals will not have
dependencies, so we need a way to avoid having imposed constraints appear
for nodes that don't exist.

This introduces a new rule that says that constraints are imposed
*unless* we define `do_not_impose(ID)`. This allows rules like
dependencies, which rely on more than just spec conditions, to cancel
imposed constraints.

We add one special case for this: dependencies of externals.
2021-05-22 11:51:20 -07:00
Todd Gamblin
9717e0244f bugfix: do not generate dep conditions when no dependency
We only consider test dependencies some of the time. Some packages are
*only* test dependencies. Spack's algorithm was previously generating
dependency conditions that could hold, *even* if there was no potential
dependency type.

- [x] change asp.py so that this can't happen -- we now only generate
      dependency types for possible dependencies.
2021-05-22 11:51:20 -07:00
Todd Gamblin
a823cffc40 concretizer: unify logic for spec conditionals
This builds on #20638 by unifying all the places in the concretizer where
things are conditional on specs. Previously, we duplicated a common spec
conditional pattern for dependencies, virtual providers, conflicts, and
externals. That was introduced in #20423 and refined in #20507, and
roughly looked as follows.

Given some directives in a package like:

```python
depends_on("foo@1.0+bar", when="@2.0+variant")
provides("mpi@2:", when="@1.9:")
```

We handled the `@2.0+variant` and `@1.9:` parts by generating generated
`dependency_condition()`, `required_dependency_condition()`, and
`imposed_dependency_condition()` facts to trigger rules like this:

```prolog
dependency_conditions_hold(ID, Parent, Dependency) :-
  attr(Name, Arg1)             : required_dependency_condition(ID, Name, Arg1);
  attr(Name, Arg1, Arg2)       : required_dependency_condition(ID, Name, Arg1, Arg2);
  attr(Name, Arg1, Arg2, Arg3) : required_dependency_condition(ID, Name, Arg1, Arg2, Arg3);
  dependency_condition(ID, Parent, Dependency);
  node(Parent).
```

And we handled `foo@1.0+bar` and `mpi@2:` parts ("imposed constraints")
like this:

```prolog
attr(Name, Arg1, Arg2) :-
  dependency_conditions_hold(ID, Package, Dependency),
  imposed_dependency_condition(ID, Name, Arg1, Arg2).

attr(Name, Arg1, Arg2, Arg3) :-
  dependency_conditions_hold(ID, Package, Dependency),
  imposed_dependency_condition(ID, Name, Arg1, Arg2, Arg3).
```

These rules were repeated with different input predicates for
requirements (e.g., `required_dependency_condition`) and imposed
constraints (e.g., `imposed_dependency_condition`) throughout
`concretize.lp`. In #20638 it got to be a bit confusing, because we used
the same `dependency_condition_holds` predicate to impose constraints on
conditional dependencies and virtual providers. So, even though the
pattern was repeated, some of the conditional rules were conjoined in a
weird way.

Instead of repeating this pattern everywhere, we now have *one* set of
consolidated rules for conditions:

```prolog
condition_holds(ID) :-
  condition(ID);
  attr(Name, A1)         : condition_requirement(ID, Name, A1);
  attr(Name, A1, A2)     : condition_requirement(ID, Name, A1, A2);
  attr(Name, A1, A2, A3) : condition_requirement(ID, Name, A1, A2, A3).

attr(Name, A1)         :- condition_holds(ID), imposed_constraint(ID, Name, A1).
attr(Name, A1, A2)     :- condition_holds(ID), imposed_constraint(ID, Name, A1, A2).
attr(Name, A1, A2, A3) :- condition_holds(ID), imposed_constraint(ID, Name, A1, A2, A3).
```

this allows us to use `condition(ID)` and `condition_holds(ID)` to
encapsulate the conditional logic on specs in all the scenarios where we
need it. Instead of defining predicates for the requirements and imposed
constraints, we generate the condition inputs with generic facts, and
define predicates to associate the condition ID with a particular
scenario. So, now, the generated facts for a condition look like this:

```prolog
condition(121).
condition_requirement(121,"node","cairo").
condition_requirement(121,"variant_value","cairo","fc","True").
imposed_constraint(121,"version_satisfies","fontconfig","2.10.91:").
dependency_condition(121,"cairo","fontconfig").
dependency_type(121,"build").
dependency_type(121,"link").
```

The requirements and imposed constraints are generic, and we associate
them with their meaning via the id. Here, `dependency_condition(121,
"cairo", "fontconfig")` tells us that condition 121 has to do with the
dependency of `cairo` on `fontconfig`, and the conditional dependency
rules just become:

```prolog
dependency_holds(Package, Dependency, Type) :-
  dependency_condition(ID, Package, Dependency),
  dependency_type(ID, Type),
  condition_holds(ID).
```

Dependencies, virtuals, conflicts, and externals all now use similar
patterns, and the logic for generating condition facts is common to all
of them on the python side, as well. The more specific routines like
`package_dependencies_rules` just call `self.condition(...)` to get an id
and generate requirements and imposed constraints, then they generate
their extra facts with the returned id, like this:

```python
    def package_dependencies_rules(self, pkg, tests):
        """Translate 'depends_on' directives into ASP logic."""
        for _, conditions in sorted(pkg.dependencies.items()):
            for cond, dep in sorted(conditions.items()):
                condition_id = self.condition(cond, dep.spec, pkg.name)  # create a condition and get its id
                self.gen.fact(fn.dependency_condition(  # associate specifics about the dependency w/the id
                    condition_id, pkg.name, dep.spec.name
                ))
        # etc.
```

- [x] unify generation and logic for conditions
- [x] use unified logic for dependencies
- [x] use unified logic for virtuals
- [x] use unified logic for conflicts
- [x] use unified logic for externals

LocalWords:  concretizer mpi attr Arg concretize lp cairo fc fontconfig
LocalWords:  virtuals def pkg cond dep fn refactor github py
2021-05-22 11:51:20 -07:00
Massimiliano Culpo
f1c7402c64 bootstrap: account for platform specific configuration scopes (#22489)
This change accounts for platform specific configuration scopes,
like ~/.spack/linux, during bootstrapping. These scopes were
previously not accounted for and that was causing issues e.g.
when searching for compilers.

(cherry picked from commit 413c422e53)
2021-05-22 11:51:20 -07:00
Massimiliano Culpo
16f7a02654 Bootstrap clingo from sources (#21446)
* Allow the bootstrapping of clingo from sources

Allow python builds with system python as external
for MacOS

* Ensure consistent configuration when bootstrapping clingo

This commit uses context managers to ensure we can
bootstrap clingo using a consistent configuration
regardless of the use case being managed.

* Github actions: test clingo with bootstrapping from sources

* Add command to inspect and clean the bootstrap store

 Prevent users to set the install tree root to the bootstrap store

* clingo: documented how to bootstrap from sources

Co-authored-by: Gregory Becker <becker33@llnl.gov>
(cherry picked from commit 10e9e142b7)
2021-05-22 11:50:59 -07:00
Seth R. Johnson
d8cbd37aaa
Fix makefile filter suggestions (#23856)
Bash has a builtin `fc` that will override the compiler if you use "fc",
so it's better to use the full spack-supplied compiler path.

Additionally, the filter regex in the docs was wrong: it replaced the
entire assignment operation with the RHS.
2021-05-22 18:47:43 +00:00
Valentin Volkl
4e6a6e4f27
py-kubernetes: add new package (#23843)
* py-kubernetes: add new package

* Apply suggestions from code review

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* py-kubernetes: remove alpha/beta versions, fix dependency types

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-05-22 18:41:58 +00:00
Glenn Johnson
1000deb5f9
Update abinit package (#23670)
This PR updates the abinit package. The underlying build system has
several changes from previous versions, which are reflected in the
package recipe.

- added version 9.4.2
- removed commented out code
- add new libxml2 variant, with dependency and conflicts
- add dependency on atompaw
- depend on fftw-api when ~openmp
  This allows other fftw implementations to be used. This PR adds MKL.
- depend on netcdf explicitly
- remove hdf5 variant as hdf5 is required
- only use wannier90 if +mpi as the wannier90 spack package is MPI only
- allow newer versions of libxc for abinit 9
- split configure options for versions before and after abinit 9
- always use MPI compiler wrappers
- add patch to remove march settings for version 9
- Set conflict for fftw~openmp if abinit+openmp
  This allows the virtual fftw-api to be used for the dependency. If fftw
  is the fftw-api provider then bail if fftw~openmp is set when
  abinit+openmp is used.
- Set conflicts for +openmp and mkl
- Be explicit about +mkl for intel-parallel-studio
- Add TODO entry for switching conflicts/depends_on logic
2021-05-22 15:35:58 +02:00
Richarda Butler
cd61b2352d
Slepc: Add E4S testsuite smoke test (#21600) 2021-05-21 15:07:21 -07:00
Dan Bonachea
21fd449a03
upcxx: Install the example files (#23832)
This installs the example source files into $prefix/example, for use by the E4S Testsuite and other end users.

Also fixes a harmless copy/paste error.
2021-05-21 11:51:46 -07:00
Massimiliano Culpo
6c1b348d91 clingo-bootstrap: account for cray platform (#22460)
(cherry picked from commit 138312efab)
2021-05-21 19:42:12 +02:00
Maxim Belkin
68ef6fce92 clingo: fix typo (#22444) 2021-05-21 19:42:12 +02:00
Massimiliano Culpo
0b5c5b8068 clingo: added a package with option for bootstrapping clingo (#20652)
* clingo/clingo-bootstrap: added a package with option for bootstrapping clingo

package builds in Release mode
uses GCC options to link libstdc++ and libgcc statically

* clingo-bootstrap: apple-clang options to bootstrap statically on darwin

* clingo: fix the path of the Python interpreter

In case multiple Python versions are in the same prefix
(e.g. when clingo is built against an external Python),
it may happen that the Python used by CMake does not
match the corresponding node in the current spec.

This is fixed here by defining "Python_EXECUTABLE"
properly as a hint to CMake.

* clingo: the commit for "spack" version has been updated.
2021-05-21 19:42:12 +02:00
Adam J. Stewart
add339cbfe Clingo: fix missing import (#21364) 2021-05-21 19:42:12 +02:00
Todd Gamblin
316c292685 clingo: prefer master branch
Most people installing `clingo` with Spack are going to be doing it to
use the new concretizer, and that requires the `master` branch.

- [x] make `master` the default so we don't have to keep telling people
  to install `clingo@master`. We'll update the preferred version when
  there's a new release.
2021-05-21 19:42:12 +02:00
Andreas Baumbach
bd9929f9dc make spack fetch work with environments (#19166)
* make `spack fetch` work with environments
* previously: `spack fetch` required the explicit statement of
              the specs to be fetched, even when in an environment
* now: if there is no spec(s) provided to `spack fetch` we check
       if an environment is active and if yes we fetch all
       uninstalled specs.
2021-05-21 19:42:12 +02:00
Mansour Moufid
f8c2e1fc97
libffi: set target triplet to aarch64-apple-darwin on Mac M1. (#23750) 2021-05-21 19:17:58 +02:00
Sebastian Schmitt
6b1849b663
Update pylint to 2.8.2 (#23446)
* Update pylint to 2.8.2

* Update var/spack/repos/builtin/packages/py-pylint/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Address comments

* Update

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
2021-05-21 12:13:33 -05:00
Andreas Baumbach
4d9607857b
py-notebook: add older versions (#23720)
Change-Id: I34d1e14c071f91d9a451740abcbcc31701a47830
2021-05-21 16:36:00 +00:00
Andreas Baumbach
38fe1c55b5
py-lazy-object-proxy: add missing py-setuptools-scm dependency (#23842)
Change-Id: I76392841a9973aa7b5ec347b0405a78635989a79
2021-05-21 11:23:16 -05:00
Andreas Baumbach
d25026677d
New package: py-pybind11-stubgen (#23732)
* New package: py-pybind11-stubgen

Change-Id: I865b92e08ecefa6eb1327ee0166544fd4ae22953

* fixup

Change-Id: I6030cebecce229d02ab1a20fe6fa501eec22b804
2021-05-21 11:17:12 -05:00
Massimiliano Culpo
2a5f46d8d3 Added a context manager to swap architectures
This solves a few FIXMEs in conftest.py, where
we were manipulating globals and seeing side
effects prior to registering fixtures.

This commit solves the FIXMEs, but introduces
a performance regression on tests that may need
to be investigated

(cherry picked from commit 4558dc06e2)
2021-05-21 18:06:49 +02:00
Greg Becker
095ace9028 bugfix for target adjustments on target ranges (#20537)
(cherry picked from commit 61c1b71d38)
2021-05-21 18:05:42 +02:00
Massimiliano Culpo
f30fc6cd33 Move context manager to swap the current configuration into spack.config
The context manager can be used to swap the current
configuration temporarily, for any use case that may need it.

(cherry picked from commit 553d37a6d6)
2021-05-21 18:00:05 +02:00
Massimiliano Culpo
4e5e1e8f35 Move context manager to swap the current store into spack.store
The context manager can be used to swap the current
store temporarily, for any use case that may need it.

(cherry picked from commit cb2c233a97)
2021-05-21 17:59:57 +02:00
Massimiliano Culpo
0678d5df90 repo: generalize "swap" context manager to also accept paths
The method is now called "use_repositories" and
makes it clear in the docstring that it accepts
as arguments either Repo objects or paths.

Since there was some duplication between this
contextmanager and "use_repo" in the testing framework,
remove the latter and use spack.repo.use_repositories
across the entire code base.

Make a few adjustment to MockPackageMultiRepo, since it was
stating in the docstring that it was supposed to mock
spack.repo.Repo and was instead mocking spack.repo.RepoPath.

(cherry picked from commit 1a8963b0f4)
2021-05-21 17:59:50 +02:00
Anton Kozhevnikov
a586fa6dd3
sirius: update to the latest version (#23835) 2021-05-21 15:04:35 +00:00
iarspider
9c179c7d0b
Add new versions of giflib (#23588)
giflib 5.20+ no longer uses autotools

Co-authored-by: Ivan Razumov <ivan.razumov@cern.ch>
2021-05-21 07:19:22 -06:00
Massimiliano Culpo
2a4d2f905c Run clingo-cffi tests in a container (#21913)
There clingo-cffi job has two issues to be solved:

1. It uses the default concretizer
2. It requires a package from https://test.pypi.org/simple/

The former can be fixed by setting the SPACK_TEST_SOLVER
environment variable to "clingo".

The latter though requires clingo-cffi to be pushed to a
more stable package index (since https://test.pypi.org/simple/
is meant as a scratch version of PyPI that can be wiped at
any time).

For the time being run the tests in a container. Switch back to
PyPI whenever a new official version of clingo will be released.
2021-05-21 15:09:08 +02:00
Josh Essman
14e179398f Updates to support clingo-cffi (#20657)
* Support clingo when used with cffi

Clingo recently merged in a new Python module option based on cffi.

Compatibility with this module requires a few changes to spack - it does not automatically convert strings/ints/etc to Symbol and clingo.Symbol.string throws on failure.

manually convert str/int to clingo.Symbol types
catch stringify exceptions
add job for clingo-cffi to Spack CI
switch to potassco-vendored wheel for clingo-cffi CI
on_unsat argument when cffi

(cherry picked from commit 93ed1a410c)
2021-05-21 15:09:08 +02:00
Massimiliano Culpo
8d13193434 Improve error message for inconsistencies in package.py (#21811)
* Improve error message for inconsistencies in package.py

Sometimes directives refer to variants that do not exist.
Make it such that:

1. The name of the variant
2. The name of the package which is supposed to have
   such variant
3. The name of the package making this assumption

are all printed in the error message for easier debugging.

* Add unit tests

(cherry picked from commit 7226bd64dc)
2021-05-21 15:09:08 +02:00
Massimiliano Culpo
94bb37c107 concretizer: simplify "fact" method (#21148)
The "fact" method before was dealing with multiple facts
registered per call, which was used when we were emitting
grounded rules from knowledge of the problem instance.

Now that the encoding is changed we can simplify the method
to deal only with a single fact per call.

(cherry picked from commit ba42c36f00)
2021-05-21 15:09:04 +02:00
Adam J. Stewart
a59fcd60f5 Python 3.10 support: collections.abc (#20441)
(cherry picked from commit 40a40e0265)
2021-05-21 14:55:18 +02:00
Hang Yan
e42b27de7e
thrust: update repo and add new versions (#23364) 2021-05-21 09:50:33 +02:00
Hang Yan
586c08fb86
cub: update repo and add new versions (#23363) 2021-05-21 09:49:37 +02:00
Glenn Johnson
71b9e67b3c
Modification to R environment (#23623)
* Modification to R environment

This PR modifies how the R environmnet is presented, and fixes
installing the standalone Rmath library.

- The Rmath build and install methods are combined into one
- Set parallel=False when installing Rmath
- remove the run environment that set up variables for libraries and
  headers that are not really needed, and pollute the environment.

* Add setup_run_environment back

- Add back the setup_run_environment with LD_LIBRARY_PATH and
  PKG_CONFIG_PATH.
- Adjust documentation to reflect the current code.
2021-05-21 09:34:15 +02:00
Olivier Cessenat
3dfb61116d
openblas: update Intel patch directive (#23786) 2021-05-21 09:32:40 +02:00
Olivier Cessenat
5e782f6a23
gsl: update external-cblas patch directive (#23787) 2021-05-21 09:31:31 +02:00
Adam J. Stewart
2d69f63a9c
ghostscript: add tesseract variant (#23794) 2021-05-21 09:22:03 +02:00
Cameron Rutherford
63ea0c8865
exago: enforcing PETSc version < 3.15 (#23774) 2021-05-21 09:20:58 +02:00
Adam J. Stewart
72b6014861
tk: add new version, add macOS patch (#23825) 2021-05-21 09:04:50 +02:00
arjun-raj-kuppala
b8fc1094ff
rdc: add v4.2.0 (#23829) 2021-05-21 08:57:40 +02:00