# 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 # allow using newer httplib2 with pysocks # 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 @@ -20,4 +20,4 @@ IF %ERRORLEVEL% NEQ 0 ( set PATH=%PATH%;%~dp0 :: Defer control. -call vpython3 "%~dp0gclient.py" %* +call python3 "%~dp0gclient.py" %* --- a/gclient.py +++ b/gclient.py @@ -128,8 +128,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' @@ -426,6 +426,7 @@ class Dependency(gclient_utils.WorkItem, protocol='https', 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, parent, url, managed, custom_deps, custom_vars, custom_hooks, deps_file, @@ -771,6 +772,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) @@ -822,6 +824,12 @@ class Dependency(gclient_utils.WorkItem, should_process_object = should_process and _should_process( 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, name=name, @@ -932,6 +940,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* @@ -4030,6 +4040,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 @@ -997,8 +997,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( @@ -1014,7 +1013,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) @@ -1029,7 +1028,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( @@ -1727,8 +1725,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/gerrit_util.py +++ b/gerrit_util.py @@ -36,7 +36,10 @@ from typing import Tuple, TypedDict, cas from typing import Generator import httplib2 -import httplib2.socks +try: + import httplib2.socks +except ModuleNotFoundError: + import socks import auth import gclient_utils --- 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: