From ede176e91934650f345e47f50ade7e01e0422af2 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Fri, 17 May 2024 17:19:07 +0000 Subject: [PATCH] delete infra_to_superproject scripts I assume it's safe to delete after infra superproject migration is done Change-Id: I6c8d826ea6e8cfbcf4ca11d90e6b0c9da7a7ac95 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5478508 Commit-Queue: Josip Sokcevic Auto-Submit: Yiwei Zhang Reviewed-by: Josip Sokcevic Commit-Queue: Yiwei Zhang --- infra_to_superproject | 8 ----- infra_to_superproject.bat | 12 ------- infra_to_superproject.py | 66 --------------------------------------- 3 files changed, 86 deletions(-) delete mode 100755 infra_to_superproject delete mode 100644 infra_to_superproject.bat delete mode 100644 infra_to_superproject.py diff --git a/infra_to_superproject b/infra_to_superproject deleted file mode 100755 index f8b8b489c..000000000 --- a/infra_to_superproject +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# Copyright (c) 2023 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -base_dir=$(dirname "$0") - -PYTHONDONTWRITEBYTECODE=1 exec python3 "$base_dir/infra_to_superproject.py" "$@" diff --git a/infra_to_superproject.bat b/infra_to_superproject.bat deleted file mode 100644 index 63a72ca6a..000000000 --- a/infra_to_superproject.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off -:: Copyright (c) 2023 The Chromium Authors. All rights reserved. -:: Use of this source code is governed by a BSD-style license that can be -:: found in the LICENSE file. -setlocal - -:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used -:: standalone, but allow other PATH manipulations to take priority. -set PATH=%PATH%;%~dp0 - -:: Defer control. -python3 "%~dp0\infra_to_superproject.py" %* diff --git a/infra_to_superproject.py b/infra_to_superproject.py deleted file mode 100644 index f17585869..000000000 --- a/infra_to_superproject.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) 2023 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. -""" -Migrates an infra or infra_internal gclient to an infra_superproject one. - -Does an in-place migration of the cwd's infra or infra_internal gclient -checkout to an infra_superproject checkout, preserving all repo branches -and commits. Should be called in the gclient root directory (the one that -contains the .gclient file). - -By default creates a backup dir of the original gclient checkout in -`_backup`. If something goes wrong during the migration, this can -be used to restore your environment to its original state. -""" - -import argparse -import subprocess -import os -import sys -import shutil - - -def main(argv): - source = os.getcwd() - - parser = argparse.ArgumentParser( - description=__doc__.strip().splitlines()[0], - epilog=' '.join(__doc__.strip().splitlines()[1:])) - parser.add_argument('-n', - '--no-backup', - action='store_true', - help='NOT RECOMMENDED. Skips copying the current ' - 'checkout (which can take up to ~15 min) to ' - 'a backup before starting the migration.') - args = parser.parse_args(argv) - - if not args.no_backup: - backup = source + '_backup' - print(f'Creating backup in {backup}') - print('May take up to ~15 minutes...') - shutil.copytree(source, backup, symlinks=True, dirs_exist_ok=True) - print('backup complete') - - print(f'Deleting old {source}/.gclient file') - gclient_file = os.path.join(source, '.gclient') - with open(gclient_file, 'r') as file: - data = file.read() - internal = "infra_internal" in data - os.remove(gclient_file) - - print('Migrating to infra/infra_superproject') - cmds = ['fetch', '--force'] - if internal: - cmds.append('infra_internal') - print('including internal code in checkout') - else: - cmds.append('infra') - shell = sys.platform == 'win32' - fetch = subprocess.Popen(cmds, cwd=source, shell=shell) - fetch.wait() - - -if __name__ == '__main__': - sys.exit(main(sys.argv[1:]))