[infra] Update to newer rpmalloc library.

Upstream rpmalloc fixed its bug that prevented compilation with
recent Clang toolchain releases, so drop the custom patching of
its `build/ninja/clang.py` file.

This CL also adjusts the way the rpmalloc sources are obtained,
by taking them from the `upstream/develop` branch of the Fuchsia
provided git mirror, which tracks the Github upstream closely,
as opposed with the `develop` branch on the same repository that
is seriously dated now.

Bug: None
Change-Id: I90eeddafa0cbd3acf815d8c00300ce04fb4199cf
Reviewed-on: https://gn-review.googlesource.com/c/gn/+/13520
Reviewed-by: Petr Hosek <phosek@google.com>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: David Turner <digit@google.com>
diff --git a/infra/README.recipes.md b/infra/README.recipes.md
index 5a6ea74..731d098 100644
--- a/infra/README.recipes.md
+++ b/infra/README.recipes.md
@@ -101,7 +101,7 @@
 
 Recipe for building GN.
 
-&mdash; **def [RunSteps](/infra/recipes/gn.py#105)(api, repository):**
+&mdash; **def [RunSteps](/infra/recipes/gn.py#106)(api, repository):**
 ### *recipes* / [macos\_sdk:examples/full](/infra/recipe_modules/macos_sdk/examples/full.py)
 
 [DEPS](/infra/recipe_modules/macos_sdk/examples/full.py#7): [macos\_sdk](#recipe_modules-macos_sdk), [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step]
diff --git a/infra/recipes/gn.expected/ci_linux.json b/infra/recipes/gn.expected/ci_linux.json
index 25250ba..8457f94 100644
--- a/infra/recipes/gn.expected/ci_linux.json
+++ b/infra/recipes/gn.expected/ci_linux.json
@@ -188,7 +188,7 @@
       "fetch",
       "--tags",
       "https://fuchsia.googlesource.com/third_party/github.com/mjansson/rpmalloc",
-      "f4b7c52c858675f732a76bd1c73447e0fcf84b1e"
+      "+upstream/develop"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -213,7 +213,7 @@
     "cmd": [
       "git",
       "checkout",
-      "FETCH_HEAD"
+      "b097fd0916500439721a114bb9cd8d14bd998683"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -235,68 +235,6 @@
     ]
   },
   {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "gn:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.read [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall', '-Weverything', '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "CXXFLAGS = ['-Wall',  '-Wfoo']",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "gn:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.write [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall',  '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
     "cmd": [],
     "name": "rpmalloc.build rpmalloc-linux-amd64",
     "~followup_annotations": [
diff --git a/infra/recipes/gn.expected/cipd_exists.json b/infra/recipes/gn.expected/cipd_exists.json
index abde3b5..7ed384a 100644
--- a/infra/recipes/gn.expected/cipd_exists.json
+++ b/infra/recipes/gn.expected/cipd_exists.json
@@ -188,7 +188,7 @@
       "fetch",
       "--tags",
       "https://fuchsia.googlesource.com/third_party/github.com/mjansson/rpmalloc",
-      "f4b7c52c858675f732a76bd1c73447e0fcf84b1e"
+      "+upstream/develop"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -213,7 +213,7 @@
     "cmd": [
       "git",
       "checkout",
-      "FETCH_HEAD"
+      "b097fd0916500439721a114bb9cd8d14bd998683"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -235,68 +235,6 @@
     ]
   },
   {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "infra-internal:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.read [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall', '-Weverything', '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "CXXFLAGS = ['-Wall',  '-Wfoo']",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "infra-internal:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.write [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall',  '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
     "cmd": [],
     "name": "rpmalloc.build rpmalloc-linux-amd64",
     "~followup_annotations": [
diff --git a/infra/recipes/gn.expected/cipd_register.json b/infra/recipes/gn.expected/cipd_register.json
index 0d3ce42..f0b7372 100644
--- a/infra/recipes/gn.expected/cipd_register.json
+++ b/infra/recipes/gn.expected/cipd_register.json
@@ -188,7 +188,7 @@
       "fetch",
       "--tags",
       "https://fuchsia.googlesource.com/third_party/github.com/mjansson/rpmalloc",
-      "f4b7c52c858675f732a76bd1c73447e0fcf84b1e"
+      "+upstream/develop"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -213,7 +213,7 @@
     "cmd": [
       "git",
       "checkout",
-      "FETCH_HEAD"
+      "b097fd0916500439721a114bb9cd8d14bd998683"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -235,68 +235,6 @@
     ]
   },
   {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "infra-internal:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.read [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall', '-Weverything', '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "CXXFLAGS = ['-Wall',  '-Wfoo']",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "infra-internal:ci"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.write [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall',  '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
     "cmd": [],
     "name": "rpmalloc.build rpmalloc-linux-amd64",
     "~followup_annotations": [
diff --git a/infra/recipes/gn.expected/cq_linux.json b/infra/recipes/gn.expected/cq_linux.json
index 574d790..1181b8c 100644
--- a/infra/recipes/gn.expected/cq_linux.json
+++ b/infra/recipes/gn.expected/cq_linux.json
@@ -239,7 +239,7 @@
       "fetch",
       "--tags",
       "https://fuchsia.googlesource.com/third_party/github.com/mjansson/rpmalloc",
-      "f4b7c52c858675f732a76bd1c73447e0fcf84b1e"
+      "+upstream/develop"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -264,7 +264,7 @@
     "cmd": [
       "git",
       "checkout",
-      "FETCH_HEAD"
+      "b097fd0916500439721a114bb9cd8d14bd998683"
     ],
     "cwd": "[START_DIR]/rpmalloc",
     "infra_step": true,
@@ -286,68 +286,6 @@
     ]
   },
   {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py",
-      "/path/to/tmp/"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "gn:try"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.read [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall', '-Weverything', '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
-    "cmd": [
-      "vpython",
-      "-u",
-      "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
-      "--json-output",
-      "/path/to/tmp/json",
-      "copy",
-      "CXXFLAGS = ['-Wall',  '-Wfoo']",
-      "[START_DIR]/rpmalloc/build/ninja/clang.py"
-    ],
-    "infra_step": true,
-    "luci_context": {
-      "realm": {
-        "name": "gn:try"
-      },
-      "resultdb": {
-        "current_invocation": {
-          "name": "invocations/build:8945511751514863184",
-          "update_token": "token"
-        },
-        "hostname": "rdbhost"
-      }
-    },
-    "name": "rpmalloc.write [START_DIR]/rpmalloc/build/ninja/clang.py",
-    "~followup_annotations": [
-      "@@@STEP_NEST_LEVEL@1@@@",
-      "@@@STEP_LOG_LINE@clang.py@CXXFLAGS = ['-Wall',  '-Wfoo']@@@",
-      "@@@STEP_LOG_END@clang.py@@@"
-    ]
-  },
-  {
     "cmd": [],
     "name": "rpmalloc.build rpmalloc-linux-amd64",
     "~followup_annotations": [
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py
index 0f8d470..19a3033 100644
--- a/infra/recipes/gn.py
+++ b/infra/recipes/gn.py
@@ -31,7 +31,8 @@
 
 # On select platforms, link the GN executable against rpmalloc for a small 10% speed boost.
 RPMALLOC_GIT_URL = 'https://fuchsia.googlesource.com/third_party/github.com/mjansson/rpmalloc'
-RPMALLOC_REVISION = 'f4b7c52c858675f732a76bd1c73447e0fcf84b1e'
+RPMALLOC_BRANCH = '+upstream/develop'
+RPMALLOC_REVISION = 'b097fd0916500439721a114bb9cd8d14bd998683'
 
 # Used to convert os and arch strings to rpmalloc format
 RPMALLOC_MAP = {
@@ -198,21 +199,8 @@
         with api.context(cwd=rpmalloc_src_dir, infra_steps=True):
           api.step(
               'fetch',
-              ['git', 'fetch', '--tags', RPMALLOC_GIT_URL, RPMALLOC_REVISION])
-          api.step('checkout', ['git', 'checkout', 'FETCH_HEAD'])
-
-        # Patch configure.py since it forces -Weverything which conflicts
-        # with recent Clang rolls. Remove it in-place to work around the issue.
-        # See https://bugs.chromium.org/p/gn/issues/detail?id=278
-        build_ninja_clang_path = api.path.join(rpmalloc_src_dir, 'build/ninja/clang.py')
-        build_ninja_clang_py = api.file.read_text('read %s' % build_ninja_clang_path,
-                                                 build_ninja_clang_path,
-                                                 "CXXFLAGS = ['-Wall', '-Weverything', '-Wfoo']")
-        if '-Weverything' in build_ninja_clang_py:
-          build_ninja_clang_py = build_ninja_clang_py.replace("'-Weverything',", '')
-          api.file.write_text('write %s' % build_ninja_clang_path,
-                              build_ninja_clang_path,
-                              build_ninja_clang_py)
+              ['git', 'fetch', '--tags', RPMALLOC_GIT_URL, RPMALLOC_BRANCH])
+          api.step('checkout', ['git', 'checkout', RPMALLOC_REVISION])
 
         for platform in all_config_platforms:
           # Convert target architecture and os to rpmalloc format.