mirror of
https://github.com/imputnet/helium.git
synced 2026-10-21 10:49:55 -05:00
187 lines
6.2 KiB
Diff
187 lines
6.2 KiB
Diff
# Changes to gclient that:
|
|
# use system python on windows
|
|
# move dotfiles into the staging directory
|
|
# skip cipd binary downloads
|
|
# skip gcs downloads unless its an allowed sysroot
|
|
# replace 'src' in checkout paths with the output directory
|
|
# add flag to specify an allowed sysroot
|
|
# ensure shallow fetches
|
|
# utilize a newer version of gsutil to support later versions of python
|
|
# allow StrEnum-equivalent functionality on older python
|
|
--- a/gclient.bat
|
|
+++ b/gclient.bat
|
|
@@ -36,4 +36,4 @@ call "%~dp0update_depot_tools.bat" %* &
|
|
set PATH=%PATH%;%~dp0
|
|
|
|
:: Defer control.
|
|
-call vpython3 "%~dp0gclient.py" %*
|
|
+call python3 "%~dp0gclient.py" %*
|
|
--- a/gclient.py
|
|
+++ b/gclient.py
|
|
@@ -125,8 +125,8 @@ DEPOT_TOOLS_DIR = os.path.dirname(os.pat
|
|
# one, e.g. if a spec explicitly says `cache_dir = None`.)
|
|
UNSET_CACHE_DIR = object()
|
|
|
|
-PREVIOUS_CUSTOM_VARS_FILE = ".gclient_previous_custom_vars"
|
|
-PREVIOUS_SYNC_COMMITS_FILE = ".gclient_previous_sync_commits"
|
|
+PREVIOUS_CUSTOM_VARS_FILE = r"UC_STAGING"+os.sep+".gclient_previous_custom_vars"
|
|
+PREVIOUS_SYNC_COMMITS_FILE = r"UC_STAGING"+os.sep+".gclient_previous_sync_commits"
|
|
|
|
PREVIOUS_SYNC_COMMITS = "GCLIENT_PREVIOUS_SYNC_COMMITS"
|
|
|
|
@@ -457,6 +457,7 @@ class Dependency(gclient_utils.WorkItem,
|
|
git_dependencies_state=gclient_eval.DEPS,
|
|
print_outbuf=False,
|
|
):
|
|
+ if name and name[0:3] == "src": name = r"UC_OUT"+name[3:]
|
|
gclient_utils.WorkItem.__init__(self, name)
|
|
DependencySettings.__init__(
|
|
self,
|
|
@@ -861,6 +862,7 @@ class Dependency(gclient_utils.WorkItem,
|
|
|
|
condition = dep_value.get("condition")
|
|
dep_type = dep_value.get("dep_type")
|
|
+ if dep_type == "cipd": continue
|
|
|
|
if not self._get_option("process_all_deps", False):
|
|
should_process = should_process and _should_process(condition)
|
|
@@ -920,6 +922,12 @@ class Dependency(gclient_utils.WorkItem,
|
|
merged_condition
|
|
)
|
|
|
|
+ if name != "src/third_party/node/node_modules" and \
|
|
+ (not name.startswith("src/build/linux/") or \
|
|
+ not f"{self._get_option('sysroot', 'None')}-sysroot" in name):
|
|
+ continue
|
|
+ should_process_object = True
|
|
+ merged_condition = 'True'
|
|
gcs_deps.append(
|
|
GcsDependency(
|
|
parent=self,
|
|
@@ -1051,6 +1059,8 @@ class Dependency(gclient_utils.WorkItem,
|
|
|
|
self._gn_args_from = local_scope.get("gclient_gn_args_from")
|
|
self._gn_args_file = local_scope.get("gclient_gn_args_file")
|
|
+ if self._gn_args_file and self._gn_args_file[0:3] == "src":
|
|
+ self._gn_args_file = r"UC_OUT"+self._gn_args_file[3:]
|
|
self._gn_args = local_scope.get("gclient_gn_args", [])
|
|
# It doesn't make sense to set all of these, since setting gn_args_from
|
|
# to another DEPS will make gclient ignore any other local gn_args*
|
|
@@ -4666,6 +4676,7 @@ def CMDsync(parser, args):
|
|
default=[],
|
|
help="Specify to skip processing of a certain type of dep.",
|
|
)
|
|
+ parser.add_option('--sysroot')
|
|
(options, args) = parser.parse_args(args)
|
|
client = GClient.LoadCurrentConfig(options)
|
|
|
|
--- a/gclient_scm.py
|
|
+++ b/gclient_scm.py
|
|
@@ -5,7 +5,6 @@
|
|
|
|
import collections
|
|
import contextlib
|
|
-import enum
|
|
import errno
|
|
import glob
|
|
import json
|
|
@@ -28,6 +27,15 @@ import scm
|
|
import subprocess2
|
|
import trace_utils
|
|
|
|
+try:
|
|
+ from enum import StrEnum
|
|
+ class StringEnum(StrEnum):
|
|
+ pass
|
|
+except ImportError:
|
|
+ from enum import Enum
|
|
+ class StringEnum(str, Enum):
|
|
+ pass
|
|
+
|
|
|
|
class NoUsableRevError(gclient_utils.Error):
|
|
"""Raised if requested revision isn't found in checkout."""
|
|
@@ -271,7 +279,7 @@ def _canonical_git_repo(url):
|
|
)
|
|
|
|
|
|
-class CacheMode(enum.StrEnum):
|
|
+class CacheMode(StringEnum):
|
|
"""How checkouts relate to the git cache when cache_dir is set."""
|
|
|
|
# clone --shared, fetch URL stays on the mirror; the checkout only works
|
|
@@ -1194,9 +1202,7 @@ class GitWrapper(SCMWrapper):
|
|
self._SetFetchConfig(options)
|
|
|
|
# Fetch upstream if we don't already have |revision|.
|
|
- if not scm.GIT.IsValidRevision(
|
|
- self.checkout_path, revision, sha_only=True
|
|
- ):
|
|
+ if False:
|
|
self._Fetch(options, prune=options.force)
|
|
|
|
if not scm.GIT.IsValidRevision(
|
|
@@ -1213,7 +1219,7 @@ class GitWrapper(SCMWrapper):
|
|
|
|
# This is a big hammer, debatable if it should even be here...
|
|
if options.force or options.reset:
|
|
- target = "HEAD"
|
|
+ target = "FETCH_HEAD"
|
|
if options.upstream and upstream_branch:
|
|
target = upstream_branch
|
|
self._Scrub(target, options)
|
|
@@ -1228,7 +1234,6 @@ class GitWrapper(SCMWrapper):
|
|
# to the checkout step.
|
|
if not (options.force or options.reset):
|
|
self._CheckClean(revision)
|
|
- self._CheckDetachedHead(revision, options)
|
|
|
|
if not current_revision:
|
|
current_revision = self._Capture(
|
|
@@ -2068,8 +2073,7 @@ class GitWrapper(SCMWrapper):
|
|
fetch_cmd.append("--no-tags")
|
|
elif quiet:
|
|
fetch_cmd.append("--quiet")
|
|
- if depth:
|
|
- fetch_cmd.append("--depth=" + str(depth))
|
|
+ fetch_cmd.append("--depth=1")
|
|
self._Run(fetch_cmd, options, show_header=options.verbose, retry=True)
|
|
|
|
def _SetFetchConfig(self, options):
|
|
--- a/gsutil.py
|
|
+++ b/gsutil.py
|
|
@@ -26,7 +26,7 @@ DEFAULT_BIN_DIR = os.path.join(THIS_DIR,
|
|
|
|
IS_WINDOWS = os.name == "nt"
|
|
|
|
-VERSION = "5.35"
|
|
+VERSION = "GSUVER"
|
|
|
|
# Google OAuth Context required by gsutil.
|
|
LUCI_AUTH_SCOPES = [
|
|
--- a/metrics_utils.py
|
|
+++ b/metrics_utils.py
|
|
@@ -7,13 +7,20 @@ import os
|
|
import re
|
|
import sys
|
|
import urllib.parse
|
|
-from enum import StrEnum
|
|
+try:
|
|
+ from enum import StrEnum
|
|
+ class StringEnum(StrEnum):
|
|
+ pass
|
|
+except ImportError:
|
|
+ from enum import Enum
|
|
+ class StringEnum(str, Enum):
|
|
+ pass
|
|
|
|
import scm
|
|
import subprocess2
|
|
|
|
|
|
-class EditMonitorState(StrEnum):
|
|
+class EditMonitorState(StringEnum):
|
|
"""The telemetry state for the Edit Monitor.
|
|
|
|
Attributes:
|