Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 1 | # Copyright 2023 The ChromiumOS Authors |
Ram Chandrasekar | 913c042 | 2022-05-09 23:41:22 +0000 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 5 | """Wrapper to call "cros build-image". |
Ram Chandrasekar | 913c042 | 2022-05-09 23:41:22 +0000 | [diff] [blame] | 6 | |
Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 7 | Eventually, this script will hard-error instead of calling "cros build-image" |
| 8 | after the notice. |
Ram Chandrasekar | 913c042 | 2022-05-09 23:41:22 +0000 | [diff] [blame] | 9 | """ |
| 10 | |
Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 11 | import logging |
Cindy Lin | 0abfec0 | 2022-09-01 18:25:30 +0000 | [diff] [blame] | 12 | import sys |
Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 13 | from typing import List, Optional |
Ram Chandrasekar | 913c042 | 2022-05-09 23:41:22 +0000 | [diff] [blame] | 14 | |
Ram Chandrasekar | 913c042 | 2022-05-09 23:41:22 +0000 | [diff] [blame] | 15 | from chromite.lib import cros_build_lib |
Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 16 | from chromite.scripts import cros |
Ram Chandrasekar | 355c8cc | 2022-05-24 23:10:30 +0000 | [diff] [blame] | 17 | |
| 18 | |
Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 19 | def main(argv: Optional[List[str]]) -> Optional[int]: |
| 20 | """Wrapper main to call "cros build-image".""" |
| 21 | argv = argv or sys.argv[1:] |
| 22 | new_argv = ["build-image", *argv] |
| 23 | new_command_str = cros_build_lib.CmdToStr(["cros", *new_argv]) |
| 24 | logging.notice( |
| 25 | "build_image has been renamed to `cros build-image`. Please call" |
| 26 | f" as `{new_command_str}`. This will eventually turn into an error." |
Alex Klein | 1699fab | 2022-09-08 08:46:06 -0600 | [diff] [blame] | 27 | ) |
Jack Rosenthal | 5d3f17c | 2023-06-16 14:15:59 -0600 | [diff] [blame] | 28 | return cros.main(new_argv) |