From 9d64acedead8bf69b1eee2645a18f8fd47a1100d Mon Sep 17 00:00:00 2001 From: Gaby Baghdadi Date: Thu, 22 Feb 2024 21:43:46 +0000 Subject: [PATCH] enable fetch and gclient to run on z/OS part 1 See https://issues.chromium.org/issues/323790693#comment12 for the manual steps still required. R=gavinmak@google.com Bug: 323790693 Change-Id: Id0ac2d8a6027cbb5e0554574471c160d5fae807c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5277474 Reviewed-by: Josip Sokcevic Commit-Queue: Josip Sokcevic --- cipd | 6 ++++++ detect_host_arch.py | 2 ++ download_from_google_storage.py | 1 + gclient.py | 2 ++ gclient_utils.py | 2 +- gsutil.py | 2 +- 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/cipd b/cipd index f7f4133ac..0de9aea45 100755 --- a/cipd +++ b/cipd @@ -6,6 +6,12 @@ set -e -o pipefail +# Run custom-built cipd client. This is useful when cipd is not available upstream +# (i.e. unsupported platform). +if [ ! -z "${CUSTOM_CIPD_CLIENT}" ]; then + exec "${CUSTOM_CIPD_CLIENT}" "${@}" +fi + # Export for other depot_tools scripts to re-use. export DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$(dirname "${BASH_SOURCE[0]}")}" export DEPOT_TOOLS_UNAME_S="${DEPOT_TOOLS_UNAME_S:-$(uname -s | tr '[:upper:]' '[:lower:]')}" diff --git a/detect_host_arch.py b/detect_host_arch.py index 317b12a79..500e5dd92 100755 --- a/detect_host_arch.py +++ b/detect_host_arch.py @@ -34,6 +34,8 @@ def HostArch(): host_arch = 's390' elif host_arch.startswith('riscv'): host_arch = 'riscv64' + elif platform.system() == 'OS/390': + host_arch = 's390x' if host_arch == 'arm64': host_platform = platform.architecture() diff --git a/download_from_google_storage.py b/download_from_google_storage.py index f7e74e2bf..950a23999 100755 --- a/download_from_google_storage.py +++ b/download_from_google_storage.py @@ -35,6 +35,7 @@ PLATFORM_MAPPING = { 'win32': 'win', 'aix6': 'aix', 'aix7': 'aix', + 'zos': 'zos', } diff --git a/gclient.py b/gclient.py index 82c3909bc..9a4b16e10 100755 --- a/gclient.py +++ b/gclient.py @@ -1536,6 +1536,7 @@ _PLATFORM_MAPPING = { 'linux': 'linux', 'win32': 'win', 'aix6': 'aix', + 'zos': 'zos', } @@ -1624,6 +1625,7 @@ class GClient(GitDependency): "ios": "ios", "fuchsia": "fuchsia", "chromeos": "chromeos", + "zos": "zos", } DEFAULT_CLIENT_FILE_TEXT = ("""\ diff --git a/gclient_utils.py b/gclient_utils.py index eb911e7a0..dadd208e0 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -632,7 +632,7 @@ def CheckCallAndFilter(args, # subprocess when filtering its output. This makes the subproc believe # it was launched from a terminal, which will preserve ANSI color codes. os_type = GetOperatingSystem() - if sys.stdout.isatty() and os_type != 'win' and os_type != 'aix': + if sys.stdout.isatty() and os_type not in ['win', 'aix', 'zos']: pipe_reader, pipe_writer = os.openpty() else: pipe_reader, pipe_writer = os.pipe() diff --git a/gsutil.py b/gsutil.py index 353476068..ea0282705 100755 --- a/gsutil.py +++ b/gsutil.py @@ -37,7 +37,7 @@ LUCI_AUTH_SCOPES = [ # Platforms unsupported by luci-auth. -LUCI_AUTH_UNSUPPORTED_PLATFORMS = ['aix'] +LUCI_AUTH_UNSUPPORTED_PLATFORMS = ['aix', 'zos'] class InvalidGsutilError(Exception):