diff options
author | Todd Gamblin <gamblin2@llnl.gov> | 2021-10-18 16:11:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 23:11:42 +0000 |
commit | c5ca0db27fce5d772dc8a4fcffec3b62bb0bf1f3 (patch) | |
tree | 3bf3a3d09c63bd86320874c669cdb3180757146a /.gitattributes | |
parent | a118e799ae8ae0f4d6063f502606af3a77fdae9a (diff) | |
download | spack-c5ca0db27fce5d772dc8a4fcffec3b62bb0bf1f3.tar.gz spack-c5ca0db27fce5d772dc8a4fcffec3b62bb0bf1f3.tar.bz2 spack-c5ca0db27fce5d772dc8a4fcffec3b62bb0bf1f3.tar.xz spack-c5ca0db27fce5d772dc8a4fcffec3b62bb0bf1f3.zip |
patches: make re-applied patches idempotent (#26784)
We use POSIX `patch` to apply patches to files when building, but
`patch` by default prompts the user when it looks like a patch
has already been applied. This means that:
1. If a patch lands in upstream and we don't disable it
in a package, the build will start failing.
2. `spack develop` builds (which keep the stage around) will
fail the second time you try to use them.
To avoid that, we can run `patch` with `-N` (also called
`--forward`, but the long option is not in POSIX). `-N` causes
`patch` to just ignore patches that have already been applied.
This *almost* makes `patch` idempotent, except that it returns 1
when it detects already applied patches with `-N`, so we have to
look at the output of the command to see if it's safe to ignore
the error.
- [x] Remove non-POSIX `-s` option from `patch` call
- [x] Add `-N` option to `patch`
- [x] Ignore error status when `patch` returns 1 due to `-N`
- [x] Add tests for applying a patch twice and applying a bad patch
- [x] Tweak `spack.util.executable` so that it saves the error that
*would have been* raised with `fail_on_error=True`. This lets
us easily re-raise it.
Co-authored-by: Greg Becker <becker33@llnl.gov>
Diffstat (limited to '.gitattributes')
0 files changed, 0 insertions, 0 deletions