From a6c2569b18156496f2065a428dd2cb7d6b0afd66 Mon Sep 17 00:00:00 2001
From: "Mark W. Krentel" <krentel@rice.edu>
Date: Wed, 21 Dec 2022 13:18:58 -0600
Subject: hpctoolkit: replace filter_file with upstream patch (#34604)

Replace the filter_file for older configure with rocm 5.3 with an
upstream patch.  Further, the patch is no longer needed for develop or
later releases.
---
 .../repos/builtin/packages/hpctoolkit/package.py   | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

(limited to 'var')

diff --git a/var/spack/repos/builtin/packages/hpctoolkit/package.py b/var/spack/repos/builtin/packages/hpctoolkit/package.py
index 56fd458ffd..45ce7cd41f 100644
--- a/var/spack/repos/builtin/packages/hpctoolkit/package.py
+++ b/var/spack/repos/builtin/packages/hpctoolkit/package.py
@@ -159,6 +159,13 @@ class Hpctoolkit(AutotoolsPackage):
         when="@2019.08.01:2021.03 %gcc@11.0:",
     )
 
+    # Update configure for rocm 5.3.0
+    patch(
+        "https://gitlab.com/hpctoolkit/hpctoolkit/-/commit/411d62544717873432c49ef45c7cb99cc5de2fb8.patch",
+        sha256="484045891a665cdba3b0f141540c89f0d691ed32c5912ef62a93670d44c2786c",
+        when="@2022.04:2022.10 +rocm ^hip@5.3.0:",
+    )
+
     # Change python to python3 for some old revs that use a script
     # with /usr/bin/env python.
     depends_on("python@3.4:", type="build", when="@2020.03:2020.08")
@@ -166,21 +173,6 @@ class Hpctoolkit(AutotoolsPackage):
 
     flag_handler = AutotoolsPackage.build_system_flags
 
-    def patch(self):
-        if self.spec.satisfies("^hip@5.3.0:"):
-            filter_file(
-                'ROCM_HSA_IFLAGS="-I$ROCM_HSA/include/hsa"',
-                'ROCM_HSA_IFLAGS="-I$ROCM_HSA/include"',
-                "configure",
-                string=True,
-            )
-            filter_file(
-                "#include <hsa.h>",
-                "#include <hsa/hsa.h>",
-                "src/tool/hpcrun/gpu/amd/roctracer-api.c",
-                string=True,
-            )
-
     def configure_args(self):
         spec = self.spec
 
-- 
cgit v1.2.3-70-g09d2