From bf6e21d9d7f7f10323dd7eebda9698d25153e791 Mon Sep 17 00:00:00 2001 From: Joanna Wang Date: Thu, 6 Apr 2023 22:34:48 +0000 Subject: [PATCH] Update fetch configs for infra projects. Bug: 1415507 Change-Id: I096b150ca0ee0a4b9a14c3b2059c666cfdf8213b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4379198 Reviewed-by: Gavin Mak Commit-Queue: Joanna Wang --- fetch_configs/infra.py | 15 ++++----------- fetch_configs/infra_internal.py | 23 +++++++---------------- fetch_configs/infra_superproject.py | 9 +++++---- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/fetch_configs/infra.py b/fetch_configs/infra.py index 9e5560703..efa50af93 100644 --- a/fetch_configs/infra.py +++ b/fetch_configs/infra.py @@ -15,21 +15,14 @@ class Infra(config_util.Config): @staticmethod def fetch_spec(props): return { - 'type': 'gclient_git', - 'gclient_git_spec': { - 'solutions': [ - { - 'name' : 'infra', - 'url' : 'https://chromium.googlesource.com/infra/infra.git', - 'managed' : False, - } - ], - }, + 'alias': { + 'config': 'infra_superproject', + }, } @staticmethod def expected_root(_props): - return 'infra' + return '' def main(argv=None): diff --git a/fetch_configs/infra_internal.py b/fetch_configs/infra_internal.py index 1279cab5e..248937d42 100644 --- a/fetch_configs/infra_internal.py +++ b/fetch_configs/infra_internal.py @@ -14,26 +14,18 @@ class InfraInternal(config_util.Config): @staticmethod def fetch_spec(_props): - def url(host, repo): - return 'https://%s.googlesource.com/%s.git' % (host, repo) - - spec = { - 'solutions': [ - { - 'name': 'infra_internal', - 'url': url('chrome-internal', 'infra/infra_internal'), - 'managed': False - }, - ], - } return { - 'type': 'gclient_git', - 'gclient_git_spec': spec, + 'alias': { + 'config': 'infra_superproject', + 'props': [ + '--checkout_internal=True', + ], + }, } @staticmethod def expected_root(_props): - return 'infra_internal' + return '' def main(argv=None): @@ -42,4 +34,3 @@ def main(argv=None): if __name__ == '__main__': sys.exit(main(sys.argv)) - diff --git a/fetch_configs/infra_superproject.py b/fetch_configs/infra_superproject.py index 537a8981a..51060e421 100644 --- a/fetch_configs/infra_superproject.py +++ b/fetch_configs/infra_superproject.py @@ -3,6 +3,7 @@ # found in the LICENSE file. import sys +import ast import config_util # pylint: disable=import-error @@ -12,7 +13,7 @@ import config_util # pylint: disable=import-error class InfraSuperproject(config_util.Config): """Basic Config class for the whole set of Infrastructure repositories.""" @staticmethod - def fetch_spec(_props): + def fetch_spec(props): def url(host, repo): return 'https://%s.googlesource.com/%s.git' % (host, repo) @@ -22,12 +23,12 @@ class InfraSuperproject(config_util.Config): 'name': '.', 'url': url('chromium', 'infra/infra_superproject'), 'managed': False, - 'custom_vars': { - 'checkout_internal': True - } + 'custom_vars': {}, }, ], } + if ast.literal_eval(props.get('checkout_internal', 'False')): + spec['solutions'][0]['custom_vars']['checkout_internal'] = True return { 'type': 'gclient_git', 'gclient_git_spec': spec,