Skip to content

Commit da17628

Browse files
committed
Allow update-checkout to check out ‘as if’ another platform
1 parent feddd1d commit da17628

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

utils/update_checkout/update_checkout/update_checkout.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -386,11 +386,11 @@ def full_target_name(repository, target):
386386
raise RuntimeError('Cannot determine if %s is a branch or a tag' % target)
387387

388388

389-
def skip_list_for_platform(config):
389+
def skip_list_for_platform(config, treat_like_platform=None):
390390
# If there is a platforms key only include the repo if the
391391
# plaform is in the list
392392
skip_list = []
393-
platform_name = platform.system()
393+
platform_name = treat_like_platform or platform.system()
394394

395395
for repo_name, repo_info in config['repos'].items():
396396
if 'platforms' in repo_info:
@@ -479,6 +479,10 @@ def main():
479479
help="Number of threads to run at once",
480480
default=0,
481481
dest="n_processes")
482+
parser.add_argument(
483+
'--platform',
484+
help='Clone as if the platform was the one specified, useful for e.g. Docker use.',
485+
dest="platform")
482486
args = parser.parse_args()
483487

484488
if not args.scheme:
@@ -526,7 +530,7 @@ def main():
526530
if scheme is None:
527531
scheme = config['default-branch-scheme']
528532

529-
skip_repo_list = skip_list_for_platform(config)
533+
skip_repo_list = skip_list_for_platform(config, args.platform)
530534
skip_repo_list.extend(args.skip_repository_list)
531535
clone_results = obtain_all_additional_swift_sources(args, config,
532536
clone_with_ssh,

0 commit comments

Comments
 (0)