Repository: spack/spack

Issue:
gcc patch updated with new sha256
When not using `mirror.spack.io`, a fetch of patch `https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=2b40941d23b1570cdd90083b58fa0f66aa58c86e` will not match the package.py checksum.

```
$ curl -LO 'https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=2b40941d23b1570cdd90083b58fa0f66aa58c86e'
$ curl -LO https://mirror.spack.io/_source-cache/archive/b4/b48e48736062e64a6da7cbe7e21a6c1c89422d1f49ef547c73b479a3f3f4935f
sha256sum *
b48e48736062e64a6da7cbe7e21a6c1c89422d1f49ef547c73b479a3f3f4935f  b48e48736062e64a6da7cbe7e21a6c1c89422d1f49ef547c73b479a3f3f4935f
98a9c96f66ff0264a49bd5e76fd2ba177ceca7c7236f486058a8469c2bcd1b76  ?p=gcc.git;a=patch;h=2b40941d23b1570cdd90083b58fa0f66aa58c86e
$ diff *
120c120
< 2.27.0
---
> 2.31.1
```


Discussion:
Ugh, I'm guessing the number that changed is the git version used to create the patch. Which means it will change again in the future. @tgamblin fixed all of our GitHub patches to use the full hash index, but I'm unaware of a similar feature to remove git version from https://gcc.gnu.org/git patches. Maybe we should just download these patches and store them in the Spack repo to be safe?
Packages affected by this change:

* autoconf
* gcc x4

Packages whose patches contain git version and may be affected by this in the future:

* gdb x2
* mesa
* xsd

I vote we download and store patches for all 5 packages in the Spack repo instead of relying on the download not to change checksum again.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py
--- a/var/spack/repos/builtin/packages/gcc/package.py
+++ b/var/spack/repos/builtin/packages/gcc/package.py
@@ -322,8 +322,8 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
     patch('glibc-2.31-libsanitizer-2.patch', when='@8.1.0:8.3.0,9.0.0:9.2.0')
     patch('glibc-2.31-libsanitizer-2-gcc-6.patch', when='@5.3.0:5.5.0,6.1.0:6.5.0')
     patch('glibc-2.31-libsanitizer-2-gcc-7.patch', when='@7.1.0:7.5.0')
-    patch('https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=2b40941d23b1570cdd90083b58fa0f66aa58c86e', sha256='b48e48736062e64a6da7cbe7e21a6c1c89422d1f49ef547c73b479a3f3f4935f', when='@6.5.0,7.4.0:7.5.0,8.2.0:9.3.0')
-    patch('https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=745dae5923aba02982563481d75a21595df22ff8', sha256='eaa00c91e08a5e767f023911a49bc1b2d1a3eea38703b745ab260f90e8da41aa', when='@10.1.0:10.3.0,11.1.0')
+    patch('patch-2b40941d23b1570cdd90083b58fa0f66aa58c86e.patch', when='@6.5.0,7.4.0:7.5.0,8.2.0:9.3.0')
+    patch('patch-745dae5923aba02982563481d75a21595df22ff8.patch', when='@10.1.0:10.3.0,11.1.0')
 
     # Older versions do not compile with newer versions of glibc
     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81712
@@ -346,10 +346,8 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
     patch('zstd.patch', when='@10')
 
     # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100102
-    patch('https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=fc930b3010bd0de899a3da3209eab20664ddb703',
-          sha256='28c5ab3b564d83dd7e6e35b9c683141a4cb57ee886c5367e54a0828538b3c789', when='@10.1:10.3')
-    patch('https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=f1feb74046e0feb0596b93bbb822fae02940a90e',
-          sha256='3e5029489b79fc0d47fd6719f3d5c9d3bbc727a4a0cbff161a5517e8a3c98cb6',  when='@11.1')
+    patch('patch-fc930b3010bd0de899a3da3209eab20664ddb703.patch', when='@10.1:10.3')
+    patch('patch-f1feb74046e0feb0596b93bbb822fae02940a90e.patch', when='@11.1')
 
     build_directory = 'spack-build'
 


Test patch: