diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2022-01-05 09:32:27 -0800 |
---|---|---|
committer | Greg Becker <becker33@llnl.gov> | 2022-01-12 06:14:18 -0800 |
commit | 54d741ba5448951ea689f3b8b91e3b1552d0a4d1 (patch) | |
tree | 7de940aadeec3fd96a15bfe359fd7ea4f3711a60 /NOTICE | |
parent | 101f08013802265e9d893a482f0bd4c821957762 (diff) | |
download | spack-54d741ba5448951ea689f3b8b91e3b1552d0a4d1.tar.gz spack-54d741ba5448951ea689f3b8b91e3b1552d0a4d1.tar.bz2 spack-54d741ba5448951ea689f3b8b91e3b1552d0a4d1.tar.xz spack-54d741ba5448951ea689f3b8b91e3b1552d0a4d1.zip |
unparser: handle package-level loops, if statements, and with blocks
Many packages implement logic at the class level to handle complex dependencies and
conflicts. Others have started using `with when("@1.0"):` blocks since we added that
capability. The loops and other control logic can cause some pure directive logic not to
be removed by our package hashing logic -- and in many cases that's a lot of code that
will cause unnecessary rebuilds.
This commit changes the unparser so that it will descend into these blocks. Specifically:
1. Descend into loops, if statements, and with blocks at the class level.
2. Don't look inside function definitions (in or outside a class).
3. Don't look at nested class definitions (they don't have directives)
4. Add logic to *remove* empty loops/with blocks/if statements if all directives
in them were removed.
This allows our package hash to ignore a lot of pure metadata that it was not ignoring
before, and makes it less sensitive.
In addition, we add `maintainers` and `tags` to the list of metadata attributes that
Spack should remove from packages when constructing canonoical source for a package
hash.
- [x] Make unparser handle if/for/while/with at class level.
- [x] Add tests for control logic removal.
- [x] Add a test to ensure that all packages are not only unparseable, but also
that their canonical source is still compilable. This is a test for
our control logic removal.
- [x] Add another unparse test package that has complex logic.
Diffstat (limited to 'NOTICE')
0 files changed, 0 insertions, 0 deletions