Inseob Kim | b462b9c | 2020-08-11 15:38:20 +0900 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2017 The Android Open Source Project |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | """Installs VNDK snapshot under prebuilts/vndk/v{version}.""" |
| 18 | |
| 19 | import argparse |
| 20 | import glob |
| 21 | import logging |
| 22 | import os |
Jae Shin | 6e1a796 | 2017-12-26 13:12:38 +0900 | [diff] [blame] | 23 | import re |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 24 | import shutil |
| 25 | import subprocess |
| 26 | import sys |
| 27 | import tempfile |
| 28 | import textwrap |
| 29 | |
Jae Shin | 5233fe1 | 2017-12-18 22:29:48 +0900 | [diff] [blame] | 30 | import utils |
| 31 | |
| 32 | from check_gpl_license import GPLChecker |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 33 | from gen_buildfiles import GenBuildFile |
| 34 | |
Jae Shin | 5233fe1 | 2017-12-18 22:29:48 +0900 | [diff] [blame] | 35 | ANDROID_BUILD_TOP = utils.get_android_build_top() |
Jae Shin | 5233fe1 | 2017-12-18 22:29:48 +0900 | [diff] [blame] | 36 | PREBUILTS_VNDK_DIR = utils.join_realpath(ANDROID_BUILD_TOP, 'prebuilts/vndk') |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 37 | |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 38 | |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 39 | def start_branch(build): |
| 40 | branch_name = 'update-' + (build or 'local') |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 41 | logging.info('Creating branch {branch} in {dir}'.format( |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 42 | branch=branch_name, dir=os.getcwd())) |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 43 | utils.check_call(['repo', 'start', branch_name, '.']) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 44 | |
| 45 | |
| 46 | def remove_old_snapshot(install_dir): |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 47 | logging.info('Removing any old files in {}'.format(install_dir)) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 48 | for file in glob.glob('{}/*'.format(install_dir)): |
| 49 | try: |
| 50 | if os.path.isfile(file): |
| 51 | os.unlink(file) |
| 52 | elif os.path.isdir(file): |
| 53 | shutil.rmtree(file) |
| 54 | except Exception as error: |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 55 | logging.error('Error: {}'.format(error)) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 56 | sys.exit(1) |
| 57 | |
| 58 | |
Jae Shin | 01268ff | 2018-06-18 15:29:09 +0900 | [diff] [blame] | 59 | def install_snapshot(branch, build, local_dir, install_dir, temp_artifact_dir): |
Jae Shin | ba7456d | 2017-12-15 20:03:20 +0900 | [diff] [blame] | 60 | """Installs VNDK snapshot build artifacts to prebuilts/vndk/v{version}. |
| 61 | |
Jae Shin | 01268ff | 2018-06-18 15:29:09 +0900 | [diff] [blame] | 62 | 1) Fetch build artifacts from Android Build server or from local_dir |
Jae Shin | ba7456d | 2017-12-15 20:03:20 +0900 | [diff] [blame] | 63 | 2) Unzip build artifacts |
| 64 | |
| 65 | Args: |
| 66 | branch: string or None, branch name of build artifacts |
| 67 | build: string or None, build number of build artifacts |
Jae Shin | 01268ff | 2018-06-18 15:29:09 +0900 | [diff] [blame] | 68 | local_dir: string or None, local dir to pull artifacts from |
Jae Shin | ba7456d | 2017-12-15 20:03:20 +0900 | [diff] [blame] | 69 | install_dir: string, directory to install VNDK snapshot |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 70 | temp_artifact_dir: string, temp directory to hold build artifacts fetched |
| 71 | from Android Build server. For 'local' option, is set to None. |
Jae Shin | ba7456d | 2017-12-15 20:03:20 +0900 | [diff] [blame] | 72 | """ |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 73 | artifact_pattern = 'android-vndk-*.zip' |
| 74 | |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 75 | if branch and build: |
| 76 | artifact_dir = temp_artifact_dir |
| 77 | os.chdir(temp_artifact_dir) |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 78 | logging.info('Fetching {pattern} from {branch} (bid: {build})'.format( |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 79 | pattern=artifact_pattern, branch=branch, build=build)) |
| 80 | utils.fetch_artifact(branch, build, artifact_pattern) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 81 | |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 82 | manifest_pattern = 'manifest_{}.xml'.format(build) |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 83 | logging.info('Fetching {file} from {branch} (bid: {build})'.format( |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 84 | file=manifest_pattern, branch=branch, build=build)) |
| 85 | utils.fetch_artifact(branch, build, manifest_pattern, |
| 86 | utils.MANIFEST_FILE_NAME) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 87 | |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 88 | os.chdir(install_dir) |
Jae Shin | 01268ff | 2018-06-18 15:29:09 +0900 | [diff] [blame] | 89 | elif local_dir: |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 90 | logging.info('Fetching local VNDK snapshot from {}'.format(local_dir)) |
Jae Shin | 01268ff | 2018-06-18 15:29:09 +0900 | [diff] [blame] | 91 | artifact_dir = local_dir |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 92 | |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 93 | artifacts = glob.glob(os.path.join(artifact_dir, artifact_pattern)) |
Jae Shin | 25d3abf | 2018-04-18 18:00:26 +0900 | [diff] [blame] | 94 | for artifact in artifacts: |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 95 | logging.info('Unzipping VNDK snapshot: {}'.format(artifact)) |
| 96 | utils.check_call(['unzip', '-qn', artifact, '-d', install_dir]) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 97 | |
Inseob Kim | deb5beb | 2021-09-24 13:17:06 +0900 | [diff] [blame] | 98 | # rename {install_dir}/{arch}/include/out/soong/.intermediates |
| 99 | for soong_intermediates_dir in glob.glob(install_dir + '/*/include/' + utils.SOONG_INTERMEDIATES_DIR): |
| 100 | generated_headers_dir = soong_intermediates_dir.replace( |
| 101 | utils.SOONG_INTERMEDIATES_DIR, |
| 102 | utils.GENERATED_HEADERS_DIR |
| 103 | ) |
| 104 | os.rename(soong_intermediates_dir, generated_headers_dir) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 105 | |
Jae Shin | 4db81a5 | 2017-12-29 13:24:54 +0900 | [diff] [blame] | 106 | def gather_notice_files(install_dir): |
| 107 | """Gathers all NOTICE files to a common NOTICE_FILES directory.""" |
Jae Shin | ba7456d | 2017-12-15 20:03:20 +0900 | [diff] [blame] | 108 | |
Jae Shin | 4db81a5 | 2017-12-29 13:24:54 +0900 | [diff] [blame] | 109 | common_notices_dir = utils.NOTICE_FILES_DIR_PATH |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 110 | logging.info('Creating {} directory to gather all NOTICE files...'.format( |
Jae Shin | 9407521 | 2018-06-14 14:54:34 +0900 | [diff] [blame] | 111 | common_notices_dir)) |
Jae Shin | 4db81a5 | 2017-12-29 13:24:54 +0900 | [diff] [blame] | 112 | os.makedirs(common_notices_dir) |
Jae Shin | af0c003 | 2018-06-21 11:54:05 +0900 | [diff] [blame] | 113 | for arch in utils.get_snapshot_archs(install_dir): |
| 114 | notices_dir_per_arch = os.path.join(arch, utils.NOTICE_FILES_DIR_NAME) |
| 115 | if os.path.isdir(notices_dir_per_arch): |
Jae Shin | ba7456d | 2017-12-15 20:03:20 +0900 | [diff] [blame] | 116 | for notice_file in glob.glob( |
Justin Yun | 9e48f54 | 2023-04-17 12:23:01 +0900 | [diff] [blame] | 117 | '{}/**'.format(notices_dir_per_arch), recursive=True): |
| 118 | if os.path.isfile(notice_file): |
| 119 | rel_path = os.path.relpath(notice_file, notices_dir_per_arch) |
| 120 | target_path = os.path.join(common_notices_dir, rel_path) |
| 121 | if not os.path.isfile(target_path): |
| 122 | os.makedirs(os.path.dirname(target_path), exist_ok=True) |
| 123 | shutil.copy(notice_file, target_path) |
Jae Shin | af0c003 | 2018-06-21 11:54:05 +0900 | [diff] [blame] | 124 | shutil.rmtree(notices_dir_per_arch) |
Jae Shin | ba7456d | 2017-12-15 20:03:20 +0900 | [diff] [blame] | 125 | |
| 126 | |
Justin Yun | b59da8f | 2019-01-23 19:25:05 +0900 | [diff] [blame] | 127 | def post_processe_files_if_needed(vndk_version): |
Justin Yun | ef95d09 | 2020-11-30 10:19:43 +0900 | [diff] [blame] | 128 | """Renames vndkcore.libraries.txt and vndksp.libraries.txt |
Justin Yun | b59da8f | 2019-01-23 19:25:05 +0900 | [diff] [blame] | 129 | files to have version suffix. |
Justin Yun | ba2a7e1 | 2020-11-27 20:14:28 +0900 | [diff] [blame] | 130 | Create empty vndkproduct.libraries.txt file if not exist. |
Jae Shin | 6e1a796 | 2017-12-26 13:12:38 +0900 | [diff] [blame] | 131 | |
Jae Shin | 89e386f | 2018-01-16 20:28:33 +0900 | [diff] [blame] | 132 | Args: |
Jae Shin | af0c003 | 2018-06-21 11:54:05 +0900 | [diff] [blame] | 133 | vndk_version: int, version of VNDK snapshot |
Jae Shin | 6e1a796 | 2017-12-26 13:12:38 +0900 | [diff] [blame] | 134 | """ |
Justin Yun | b59da8f | 2019-01-23 19:25:05 +0900 | [diff] [blame] | 135 | def add_version_suffix(file_name): |
Justin Yun | ef95d09 | 2020-11-30 10:19:43 +0900 | [diff] [blame] | 136 | logging.info('Rename {} to have version suffix'.format(file_name)) |
Justin Yun | b59da8f | 2019-01-23 19:25:05 +0900 | [diff] [blame] | 137 | target_files = glob.glob( |
| 138 | os.path.join(utils.CONFIG_DIR_PATH_PATTERN, file_name)) |
| 139 | for target_file in target_files: |
| 140 | name, ext = os.path.splitext(target_file) |
| 141 | os.rename(target_file, name + '.' + str(vndk_version) + ext) |
Justin Yun | ba2a7e1 | 2020-11-27 20:14:28 +0900 | [diff] [blame] | 142 | def create_empty_file_if_not_exist(file_name): |
| 143 | target_dirs = glob.glob(utils.CONFIG_DIR_PATH_PATTERN) |
| 144 | for dir in target_dirs: |
| 145 | path = os.path.join(dir, file_name) |
| 146 | if os.path.isfile(path): |
| 147 | continue |
| 148 | logging.info('Creating empty file: {}'.format(path)) |
| 149 | open(path, 'a').close() |
Justin Yun | b59da8f | 2019-01-23 19:25:05 +0900 | [diff] [blame] | 150 | |
Justin Yun | ba2a7e1 | 2020-11-27 20:14:28 +0900 | [diff] [blame] | 151 | files_to_add_version_suffix = ('vndkcore.libraries.txt', |
| 152 | 'vndkprivate.libraries.txt') |
| 153 | files_to_create_if_not_exist = ('vndkproduct.libraries.txt',) |
| 154 | for file_to_rename in files_to_add_version_suffix: |
Kiyoung Kim | b04fe60 | 2019-10-07 13:42:57 +0900 | [diff] [blame] | 155 | add_version_suffix(file_to_rename) |
Justin Yun | ba2a7e1 | 2020-11-27 20:14:28 +0900 | [diff] [blame] | 156 | for file_to_create in files_to_create_if_not_exist: |
| 157 | create_empty_file_if_not_exist(file_to_create) |
Kiyoung Kim | b04fe60 | 2019-10-07 13:42:57 +0900 | [diff] [blame] | 158 | |
Jae Shin | 6e1a796 | 2017-12-26 13:12:38 +0900 | [diff] [blame] | 159 | |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 160 | def update_buildfiles(buildfile_generator): |
Justin Yun | 9e48f54 | 2023-04-17 12:23:01 +0900 | [diff] [blame] | 161 | # To parse json information, read and generate arch android.bp using |
| 162 | # generate_android_bp() first. |
| 163 | logging.info('Generating Android.bp files...') |
| 164 | buildfile_generator.generate_android_bp() |
| 165 | |
Jaewoong Jung | 6a5aaca | 2019-01-17 15:41:06 -0800 | [diff] [blame] | 166 | logging.info('Generating root Android.bp file...') |
| 167 | buildfile_generator.generate_root_android_bp() |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 168 | |
Jaewoong Jung | 6fbb9d2 | 2018-11-28 09:25:22 -0800 | [diff] [blame] | 169 | logging.info('Generating common/Android.bp file...') |
| 170 | buildfile_generator.generate_common_android_bp() |
| 171 | |
Rob Seymour | 2ff1e6f | 2022-02-03 16:22:10 +0000 | [diff] [blame] | 172 | def copy_owners(root_dir, install_dir): |
Justin Yun | 084664b | 2021-10-26 13:27:21 +0900 | [diff] [blame] | 173 | path = os.path.dirname(__file__) |
Rob Seymour | 2ff1e6f | 2022-02-03 16:22:10 +0000 | [diff] [blame] | 174 | shutil.copy(os.path.join(root_dir, path, 'OWNERS'), install_dir) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 175 | |
Jae Shin | 5233fe1 | 2017-12-18 22:29:48 +0900 | [diff] [blame] | 176 | def check_gpl_license(license_checker): |
| 177 | try: |
| 178 | license_checker.check_gpl_projects() |
| 179 | except ValueError as error: |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 180 | logging.error('***CANNOT INSTALL VNDK SNAPSHOT***: {}'.format(error)) |
Jae Shin | 5233fe1 | 2017-12-18 22:29:48 +0900 | [diff] [blame] | 181 | raise |
| 182 | |
| 183 | |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 184 | def commit(branch, build, version): |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 185 | logging.info('Making commit...') |
| 186 | utils.check_call(['git', 'add', '.']) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 187 | message = textwrap.dedent("""\ |
| 188 | Update VNDK snapshot v{version} to build {build}. |
| 189 | |
| 190 | Taken from branch {branch}.""").format( |
| 191 | version=version, branch=branch, build=build) |
Jae Shin | bd82ebb | 2018-06-21 14:13:46 +0900 | [diff] [blame] | 192 | utils.check_call(['git', 'commit', '-m', message]) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 193 | |
| 194 | |
Justin Yun | 9d2e85e | 2022-11-25 15:18:11 +0900 | [diff] [blame] | 195 | def run(vndk_version, branch, build_id, local, use_current_branch, remote, |
| 196 | verbose): |
| 197 | ''' Fetch and updtate the VNDK snapshots |
| 198 | |
| 199 | Args: |
| 200 | vndk_version: int, VNDK snapshot version to install. |
| 201 | branch: string, Branch to pull build from. |
| 202 | build: string, Build number to pull. |
| 203 | local: string, Fetch local VNDK snapshot artifacts from specified local |
| 204 | directory instead of Android Build server. |
| 205 | use-current-branch: boolean, Perform the update in the current branch. |
| 206 | Do not repo start. |
| 207 | remote: string, Remote name to fetch and check if the revision of VNDK |
| 208 | snapshot is included in the source to conform GPL license. |
| 209 | verbose: int, Increase log output verbosity. |
| 210 | ''' |
| 211 | local_path = None |
| 212 | if local: |
| 213 | local_path = os.path.abspath(os.path.expanduser(local)) |
| 214 | |
| 215 | if local_path: |
| 216 | if build_id or branch: |
| 217 | raise ValueError( |
| 218 | 'When --local option is set, --branch or --build cannot be ' |
| 219 | 'specified.') |
| 220 | elif not os.path.isdir(local_path): |
| 221 | raise RuntimeError( |
| 222 | 'The specified local directory, {}, does not exist.'.format( |
| 223 | local_path)) |
| 224 | else: |
| 225 | if not (build_id and branch): |
| 226 | raise ValueError( |
| 227 | 'Please provide both --branch and --build or set --local ' |
| 228 | 'option.') |
| 229 | |
| 230 | install_dir = os.path.join(PREBUILTS_VNDK_DIR, 'v{}'.format(vndk_version)) |
| 231 | if not os.path.isdir(install_dir): |
| 232 | raise RuntimeError( |
| 233 | 'The directory for VNDK snapshot version {ver} does not exist.\n' |
| 234 | 'Please request a new git project for prebuilts/vndk/v{ver} ' |
| 235 | 'before installing new snapshot.'.format(ver=vndk_version)) |
| 236 | |
| 237 | utils.set_logging_config(verbose) |
| 238 | root_dir = os.getcwd() |
| 239 | os.chdir(install_dir) |
| 240 | |
| 241 | if not use_current_branch: |
| 242 | start_branch(build_id) |
| 243 | |
| 244 | remove_old_snapshot(install_dir) |
| 245 | os.makedirs(utils.COMMON_DIR_PATH) |
| 246 | |
| 247 | temp_artifact_dir = None |
| 248 | if not local_path: |
| 249 | temp_artifact_dir = tempfile.mkdtemp() |
| 250 | |
| 251 | try: |
| 252 | install_snapshot(branch, build_id, local_path, install_dir, |
| 253 | temp_artifact_dir) |
| 254 | gather_notice_files(install_dir) |
| 255 | post_processe_files_if_needed(vndk_version) |
| 256 | |
| 257 | buildfile_generator = GenBuildFile(install_dir, vndk_version) |
| 258 | update_buildfiles(buildfile_generator) |
| 259 | |
| 260 | copy_owners(root_dir, install_dir) |
| 261 | |
| 262 | if not local_path and not branch.startswith('android'): |
| 263 | license_checker = GPLChecker(install_dir, ANDROID_BUILD_TOP, |
Justin Yun | 9e48f54 | 2023-04-17 12:23:01 +0900 | [diff] [blame] | 264 | buildfile_generator.modules_with_restricted_lic, |
Justin Yun | 9d2e85e | 2022-11-25 15:18:11 +0900 | [diff] [blame] | 265 | temp_artifact_dir, remote) |
| 266 | check_gpl_license(license_checker) |
| 267 | logging.info( |
| 268 | 'Successfully updated VNDK snapshot v{}'.format(vndk_version)) |
| 269 | except Exception as error: |
| 270 | logging.error('FAILED TO INSTALL SNAPSHOT: {}'.format(error)) |
| 271 | raise |
| 272 | finally: |
| 273 | if temp_artifact_dir: |
| 274 | logging.info( |
| 275 | 'Deleting temp_artifact_dir: {}'.format(temp_artifact_dir)) |
| 276 | shutil.rmtree(temp_artifact_dir) |
| 277 | |
| 278 | if not local_path: |
| 279 | commit(branch, build_id, vndk_version) |
| 280 | logging.info( |
| 281 | 'Successfully created commit for VNDK snapshot v{}'.format( |
| 282 | vndk_version)) |
| 283 | |
| 284 | logging.info('Done.') |
| 285 | |
| 286 | |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 287 | def get_args(): |
| 288 | parser = argparse.ArgumentParser() |
| 289 | parser.add_argument( |
Jae Shin | 9407521 | 2018-06-14 14:54:34 +0900 | [diff] [blame] | 290 | 'vndk_version', |
Justin Yun | ef95d09 | 2020-11-30 10:19:43 +0900 | [diff] [blame] | 291 | type=utils.vndk_version_int, |
| 292 | help='VNDK snapshot version to install, e.g. "{}".'.format( |
| 293 | utils.MINIMUM_VNDK_VERSION)) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 294 | parser.add_argument('-b', '--branch', help='Branch to pull build from.') |
| 295 | parser.add_argument('--build', help='Build number to pull.') |
| 296 | parser.add_argument( |
Jae Shin | 9407521 | 2018-06-14 14:54:34 +0900 | [diff] [blame] | 297 | '--local', |
Jae Shin | 01268ff | 2018-06-18 15:29:09 +0900 | [diff] [blame] | 298 | help=('Fetch local VNDK snapshot artifacts from specified local ' |
| 299 | 'directory instead of Android Build server. ' |
| 300 | 'Example: --local=/path/to/local/dir')) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 301 | parser.add_argument( |
Jae Shin | 9407521 | 2018-06-14 14:54:34 +0900 | [diff] [blame] | 302 | '--use-current-branch', |
| 303 | action='store_true', |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 304 | help='Perform the update in the current branch. Do not repo start.') |
| 305 | parser.add_argument( |
Justin Yun | 5ff8cc2 | 2019-01-18 15:25:42 +0900 | [diff] [blame] | 306 | '--remote', |
| 307 | default='aosp', |
| 308 | help=('Remote name to fetch and check if the revision of VNDK snapshot ' |
| 309 | 'is included in the source to conform GPL license. default=aosp')) |
| 310 | parser.add_argument( |
Jae Shin | 9407521 | 2018-06-14 14:54:34 +0900 | [diff] [blame] | 311 | '-v', |
| 312 | '--verbose', |
| 313 | action='count', |
| 314 | default=0, |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 315 | help='Increase output verbosity, e.g. "-v", "-vv".') |
| 316 | return parser.parse_args() |
| 317 | |
| 318 | |
| 319 | def main(): |
| 320 | """Program entry point.""" |
| 321 | args = get_args() |
Justin Yun | 9d2e85e | 2022-11-25 15:18:11 +0900 | [diff] [blame] | 322 | run(args.vndk_version, args.branch, args.build, args.local, |
| 323 | args.use_current_branch, args.remote, args.verbose) |
Jae Shin | ca625dd | 2017-11-30 15:58:00 +0900 | [diff] [blame] | 324 | |
| 325 | |
| 326 | if __name__ == '__main__': |
| 327 | main() |