Conversation
19e8204 to
0593ab9
Compare
davydden
left a comment
There was a problem hiding this comment.
I can't comment on changes to the core, but generally it looks good to me. I see that there are also regression tests which hopefully prevent clash of deptypes in future. Thanks for fixing the bug! 👍
|
@davydden: can you approve if you can verify it fixes the bug? |
davydden
left a comment
There was a problem hiding this comment.
indeed, fixes #1457
$ spack spec -l dealii@develop+python+mpi
...
wfnrinu ^[email protected]%[email protected] arch=darwin-sierra-x86_64
hkosw63 ^[email protected]%[email protected] arch=darwin-sierra-x86_64
while
$ spack spec -l dealii@develop
wfnrinu ^[email protected]%[email protected] arch=darwin-sierra-x86_64
hkosw63 ^[email protected]%[email protected] arch=darwin-sierra-x86_64
(this is with the patch which previously triggered the problem davydden@f4ca2e7)
|
As long as specs are being modified... is this a good opportunity to fix #1622 as well? |
alalazo
left a comment
There was a problem hiding this comment.
LGTM. It solves the issues and looks more readable than before. I left a couple of questions for minor refactoring that can be addressed in following PRs.
| from spack.build_systems.makefile import MakefilePackage | ||
| from spack.build_systems.autotools import AutotoolsPackage | ||
| from spack.build_systems.cmake import CMakePackage | ||
| __all__ += ['Package', 'CMakePackage', 'AutotoolsPackage', 'MakefilePackage'] |
There was a problem hiding this comment.
Side comment: how do you feel about a decorator to be used in the core to add names to spack.__all__ ? I was thinking of something like:
@export
class CMakePackage:
....If you like the idea I'll prepare a small PR for that.
There was a problem hiding this comment.
I kind of like the fact that you can read one file (__init__.py) and see what is in the spack wildcard import. I think if you put decorators on this it would be less apparent...
| self.deptypes = deptypes | ||
| return changed | ||
|
|
||
| def copy(self): |
There was a problem hiding this comment.
Another side question: is it worth to implementing __copy__ and __deepcopy__ instead of using this method? If we conform to the copy module protocol, then we gain the possibility to seamlessly copy e.g. list of Specs or dicts of Specs, etc.
There was a problem hiding this comment.
TBH I didn't know about __copy__ and __deepcopy__. But that sounds good to me! There is one complication.
If you notice, Spec has a _dup method, which does a copy in place. The copy() method currently uses that. It is used when you call .concretize() on Spec('mpi'), you want it to become mpich or openmpi or whatever.
I have thought for a while that an immutable implementation of Spec might be a better way to go, but it would be a major rework, and I have no evidence to quantify whether it would be a win performance-wise or not. On the one hand, the new concretizer will be iterating through a large space of Specs, and a completely immutable representation may hurt when we have to search a large space. On the other hand, I think it would simplify the implementation of the concretizer and Spec hashing, and the protocol in #1821 and #1875. So I guess my answer is let's open that can of worms when we get to it, which might be pretty soon here.
|
In lib/spack/spack/__init__.py
<#2681 (review)>:
> from spack.build_systems.makefile import MakefilePackage
from spack.build_systems.autotools import AutotoolsPackage
from spack.build_systems.cmake import CMakePackage
+__all__ += ['Package', 'CMakePackage', 'AutotoolsPackage', 'MakefilePackage']
Side comment: how do you feel about a decorator to be used in the core to
add names to spack.__all__ ? I was thinking of something like:
@exportclass CMakePackage:
....
If you like the idea I'll prepare a small PR for that.
I think it's clever, but ultimately makes the code more obscure because
it's no longer standard Python. Only worth it if MANY things are in
`__all__` (with the definition of "many" left fuzzy). If it's going to be
done, please be more descriptive with the decorator; like call it
`add_to_all`.
|
|
Just want to make sure I understand how things work now. Let's say package A depends on both B and C, and both B and C depend on package X. Now let's say the two dependencies on X are of different deptype. This looks something like: `, `Spec._dup()`) did not handle deptypes
correctly:
- Copying "flattened" dependencies, but in doing so it collapsed
multiple dependency relationships into one, losing some edge
information in the DAG.
- This gets rid of the `flat_dependencies_with_deptypes()` method,
which doesn't really make sense, as it collapses edges. It's now
reverted the original `flat_dependnecies()`.
- `traverse_with_deptypes()` is now called `traverse_edges()`, which is
when edge information must be preserved.
- This gets rid of the notion of "default deptypes" introduced in #2307.
- Initially created Specs now have empty deptypes instead of "defaults".
- Proper deptypes are added during normalization/concretization like
everything else in the Spec class. Empty deptypes mean deptypes are
not yet specified, and the spec is abstract.
- Updated tests.
0b37658 to
c52d6fe
Compare
Fixes #1754. Fixes #1457.
Fixes issues with hashing where deptypes from one dependency would be
overwritten by those of another dependency on the same package.
Copying specs (
Spec.copy(),Spec._dup()) did not handle deptypescorrectly:
Copying "flattened" dependencies, but in doing so it collapsed
multiple dependency relationships into one, losing some edge
information in the DAG.
This gets rid of the
flat_dependencies_with_deptypes()method,which doesn't really make sense, as it collapses edges. It's now
reverted the original
flat_dependnecies().traverse_with_deptypes()is now calledtraverse_edges(), which iswhen edge information must be preserved.
This gets rid of the notion of "default deptypes" introduced in Bugfix/cmdline deptypes #2307.
Initially created Specs now have empty deptypes instead of "defaults".
Proper deptypes are added during normalization/concretization like
everything else in the Spec class. Empty deptypes mean deptypes are
not yet specified, and the spec is abstract.
Updated tests.