cros_flash: Fix the issue with /test xbuddy path
Currently there is some weirdness in the implementation of xbuddy path
translations and unfortunately the xbuddy links like
remote/reef/latest/test is broken. This CL simplifies the path
translation a bit better.
Also deprecates TranslatedPathToLocalPath.
BUG=b:172083615
TEST=both inside and outside chroot:
cros flash --debug --no-ping --no-wipe --no-reboot [$dut] xbuddy://remote/reef/latest-dev
cros flash --debug --no-ping --no-wipe --no-reboot [$dut] xbuddy://remote/reef/latest-dev/test
cros flash --debug --no-ping --no-wipe --no-reboot [$dut] xbuddy://local/reef/latest/
cros analyze-image --debug --board=reef --version=R88-13575.0.0
TEST=inside chromium checkout
~/chromium/src/third_party/chromite $ ./bin/cros flash --debug --no-ping --no-wipe --no-reboot [$dut] xbuddy://remote/latest
Change-Id: I0b77472f5ef1f8f4d5475e94a1215154b085096f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2515359
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/cli/flash.py b/cli/flash.py
index 2028516..2a6071d 100644
--- a/cli/flash.py
+++ b/cli/flash.py
@@ -268,7 +268,7 @@
def _GetImagePath(self):
"""Returns the image path to use."""
- image_path = translated_path = None
+ image_path = None
if os.path.isfile(self.image):
if not self.yes and not _IsFilePathGPTDiskImage(self.image):
# TODO(wnwen): Open the tarball and if there is just one file in it,
@@ -284,11 +284,10 @@
image_path = _ChooseImageFromDirectory(self.image)
else:
# Translate the xbuddy path to get the exact image to use.
- translated_path, _ = ds_wrapper.GetImagePathWithXbuddy(
+ _, image_path = ds_wrapper.GetImagePathWithXbuddy(
self.image, self.board, self.version)
- image_path = ds_wrapper.TranslatedPathToLocalPath(translated_path)
- logging.info('Using image %s', translated_path or image_path)
+ logging.info('Using image %s', image_path)
return image_path
def Run(self):
@@ -454,16 +453,14 @@
(device.board, self.board))
logging.info('Board is %s', self.board)
-
# TODO(crbug.com/872441): Once devserver code has been moved to chromite,
# use xbuddy library directly instead of the devserver_wrapper.
# Fetch the full payload and properties, and stateful files. If this
# fails, fallback to downloading the image.
try:
- translated_path, _ = ds_wrapper.GetImagePathWithXbuddy(
+ _, local_path = ds_wrapper.GetImagePathWithXbuddy(
os.path.join(self.image, artifact_info.FULL_PAYLOAD),
self.board, self.version, silent=True)
- local_path = ds_wrapper.TranslatedPathToLocalPath(translated_path)
payload_dir, rootfs_filename = os.path.split(local_path)
ds_wrapper.GetImagePathWithXbuddy(
@@ -477,9 +474,8 @@
# We didn't find the full_payload, attempt to download the image.
if fetch_image:
- translated_path, _ = ds_wrapper.GetImagePathWithXbuddy(
+ _, image_path = ds_wrapper.GetImagePathWithXbuddy(
self.image, self.board, self.version)
- image_path = ds_wrapper.TranslatedPathToLocalPath(translated_path)
payload_dir = os.path.join(os.path.dirname(image_path), 'payloads')
logging.notice('Using image path %s and payload directory %s',
image_path, payload_dir)