castep: Update/overhaul the recipe and patches#3949
Conversation
3f4a28f to
39b0b17
Compare
|
In spack we don't remove versions without going through a deprecation phase first (typically one release must include the deprecated version before it can be removed). That means that you will likely have to support both Makefile and CMake for some time. There are some conflicts in this PR. |
|
@pjpbyrne CASTEP 23 and 24 need a libxc cmake patch to be able to build with (CASTEP 23.1, 24.1, 25.12 and 26.11 successfully build on Young with this in our newest stack that is being built, but I still have to test the running). |
|
This has now been updated to support the old makefile build system for @:22, and cmake for @23:. The additional patches from @heatherkellyucl have also been incorporated. |
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Spack castep package to support CASTEP 23–26 via a CMake-based build, refreshes dependencies/variants, and adds install-time and post-install test coverage. It also introduces multiple upstream patches to correct Python utility installation behavior and related issues.
Changes:
- Add new CASTEP versions (23.x–26.x), new variants, updated dependency rules, and a CMake builder implementation (with generator selection).
- Add install-time and post-install tests (version smoke test + cached Si2 test inputs + wrapper checks).
- Add multiple patch files for Python utilities and libxc install behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| repos/spack_repo/builtin/packages/castep/package.py | Overhauls version/build-system selection, dependencies, variants, CMake args, and adds tests/patch application logic. |
| repos/spack_repo/builtin/packages/castep/Replace_pipes_with_shex_in_testcode.patch | Patch to replace deprecated pipes.quote usage with shlex.quote and use communicate() to avoid subprocess deadlocks. |
| repos/spack_repo/builtin/packages/castep/Fixed-arguments-not-being-passed-to-python-scripts.patch | Patch to forward CLI arguments through a Python wrapper shell script. |
| repos/spack_repo/builtin/packages/castep/Fix-castepconv-strings-with-invalid-escape-character.patch | Patch to fix invalid escape sequences in regex strings by using raw strings. |
| repos/spack_repo/builtin/packages/castep/Fix_pythonpath_modification.patch | Patch to avoid modifying PYTHONPATH during install (currently not applied by package.py). |
| repos/spack_repo/builtin/packages/castep/Fix_python_install_25.patch | Patch to adjust Python utility installation for CASTEP 25.x. |
| repos/spack_repo/builtin/packages/castep/Fix_python_install_24.patch | Patch to switch Python utility installs to pip install --prefix ... for CASTEP 24.x. |
| repos/spack_repo/builtin/packages/castep/Fix_python_install_23.patch | Patch to switch Python utility installs to pip install --prefix ... for CASTEP 23.x. |
| repos/spack_repo/builtin/packages/castep/castep_cmake_libxc523.patch | Patch to install libxc .mod files from CASTEP’s mod/ directory for 24.x. |
| repos/spack_repo/builtin/packages/castep/castep_cmake_libxc522.patch | Patch to install libxc .mod files from CASTEP’s mod/ directory for 23.x. |
Comments suppressed due to low confidence (1)
repos/spack_repo/builtin/packages/castep/package.py:84
openmpvariant is declared twice in the CMake build block, which will raise a duplicate-variant error when Spack loads the package. Remove the duplicate declaration (keep just oneopenmpvariant).
variant("openmp", description="Use OpenMP threading", default=True)
variant("grimmed3", default=True, description="Use Grimme D3 functionals")
variant("grimmed4", default=True, description="Use Grimme D4 functionals")
variant("dlmg", default=True, description="Use DLMG Functionality functionals")
variant("openmp", default=True, description="Use OpenMP threading")
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@pjpbyrne, I've triggered a re-review before I saw that (some) review comments were false positives. I hope that the re-review takes your comments into account - if not please close them like you did before. |
| depends_on("c", type="build") | ||
| depends_on("fortran", type="build") | ||
|
|
||
| depends_on("gcc@9:", when="@25:", type="build") | ||
| depends_on("gcc@4.9:", when="@21.11:", type="build") | ||
| extends("python@:3.11", type=("build", "run")) | ||
| depends_on("awk@3:", type="build") | ||
| extends("python", type=("build", "run")) |
There was a problem hiding this comment.
Note to self / @bernhardkaindl:
TODO: We have to teach the rewiew skill that there are provides("awk") and so packages can depend on it.
The skill to update is likely: .github/skills/pr-review.md - I'd be ok to update the skill in this package if this fixes the false positive, otherwise add this to a list of notes to do work on for the review skill.
There was a problem hiding this comment.
Left as is, as this seems to be fine?
|
I have had to move some of the routines around as after moving back to having two builders, the run_after("install") tests were not getting run. I have tested this now with gcc for all the major versions with --test=root and also with the post-install tests(spack test run castep). |
Added dependency on mpi fortran for openmpi and mpich Added requirement for mkl as blas when it is used for fft Added blas/fft name conversions to link correct Fixed makefile build for castep versions 21:
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… and not the package when using multiple builders. Removed trailing whitespace.
|
Reading the commit headlines, it looks like a lot of progress, and warrants a re-review by Copilot. On the I hope that Copilot review does not re-report false positives like |
|
@pjpbyrne, see these specific Copilot review comments only as pure remarks, you can close them if you don't want to invest into them. When it all looks ready for finaly review and CI, ping me using @bernhardkaindl. |
|
I think that these already have all their requirements supplied. I will at some point in the future check that these actually work with build isolation but this also needs fixed in other versions, so I will leave that task for the future. I think that otherwise this PR is ready for review and CI @bernhardkaindl. Thanks! |
|
@pjpbyrne, I think this means you say this PR is ready for CI and final approval? If further changes and reviews are needed, I ask people to add a comment about it. Otherwise, I'd plan to approve running CI workflows and all GitLab CI pipelines later when the currently running GitLab CI pipelines have concluded their work to put the CI for this PR into the CI queue. |
@bernhardkaindl Yep, this is ready to go. I will have a look about doing the air-gapped builds in a future PR if that is ok. |
|
@pjpbyrne, now, besides 3 empty lines / extra space removal (run See the Details links in the hamburger menues of the failed checks for details: if m := re.search(energy_re, line): |
|
Thanks @bernhardkaindl - I think those are fixed now. |
Adds a full CMake build for CASTEP versions 23-26(latest), as well as correct dependencies.
Removes support for old makefile-based builds(<23).Build-time and installation tests have been added as well as a small post-installation test that can be run at a later time.
Patches have been added to fix the python script installations to use the correct directories.
Adds myself as maintainer.
This has been extensively tested with the gcc, intel, oneapi and llvm toolchains, and with several blas, lapack, fftw-api and mpi providers.
I have also tested this on a cray machine with gcc and libsci.