From 65b4b92fa1e1989d055108a6077cc9119ee28acd Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Tue, 16 Apr 2024 19:09:17 +0000
Subject: [PATCH] hadrian: remove obsolete Patch logic

This commit removes obsolete Patch logic from hadrian, given we no
longer need to patch the gmp tarball when building in-tree GMP.
---
 hadrian/src/Builder.hs | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/hadrian/src/Builder.hs b/hadrian/src/Builder.hs
index 44fee7bd5f2..98c24263bdc 100644
--- a/hadrian/src/Builder.hs
+++ b/hadrian/src/Builder.hs
@@ -8,10 +8,7 @@ module Builder (
     -- * Builder properties
     builderProvenance, systemBuilderPath, builderPath, isSpecified, needBuilders,
     runBuilder, runBuilderWith, runBuilderWithCmdOptions, getBuilderPath,
-    builderEnvironment,
-
-    -- * Ad hoc builder invocation
-    applyPatch
+    builderEnvironment
     ) where
 
 import Control.Exception.Extra (Partial)
@@ -184,7 +181,6 @@ data Builder = Alex
              | MergeObjects Stage -- ^ linker to be used to merge object files.
              | Nm
              | Objdump
-             | Patch
              | Python
              | Ranlib
              | Testsuite TestMode
@@ -443,7 +439,6 @@ systemBuilderPath builder = case builder of
     Makeinfo        -> fromKey "makeinfo"
     Nm              -> fromTargetTC "nm" (Toolchain.nmProgram . tgtNm)
     Objdump         -> fromKey "objdump"
-    Patch           -> fromKey "patch"
     Python          -> fromKey "python"
     Ranlib          -> fromTargetTC "ranlib" (maybeProg Toolchain.ranlibProgram . tgtRanlib)
     Testsuite _     -> fromKey "python"
@@ -511,15 +506,6 @@ systemBuilderPath builder = case builder of
 isSpecified :: Builder -> Action Bool
 isSpecified = fmap (not . null) . systemBuilderPath
 
--- | Apply a patch by executing the 'Patch' builder in a given directory.
-applyPatch :: FilePath -> FilePath -> Action ()
-applyPatch dir patch = do
-    let file = dir -/- patch
-    needBuilders [Patch]
-    path <- builderPath Patch
-    putBuild $ "| Apply patch " ++ file
-    quietly $ cmd' [Cwd dir, FileStdin file] [path, "-p0"]
-
 -- Note [cmd wrapper]
 -- ~~~~~~~~~~~~~~~~~~
 -- `cmd'` is a wrapper for Shake's `cmd` that allows us to customize what is
-- 
GitLab