Handle channel lookup correctly when board name includes underscore(s)
For board names with underscore(s) in it (e.g. daisy_spring), the
canary builds are archived in:
gs://chromeos-releases/dev-channel/daisy-spring/5000.0.0/
However, due to historical reasons, the underscores in the board name
are replaced with hyphens in the corresponding channels of the board:
gs://chromeos-image-archive/daisy_spring-release/
This CL converts the board name to use hyphens before performing the
channel lookup.
BUG=chromium:336711
TEST=`cros flash device xbuddy://remote/daisy_spring/latest-canary`
Change-Id: I26a3fa392d19459d78ed4c4de73c5af08b7a4e84
Reviewed-on: https://chromium-review.googlesource.com/183440
Tested-by: Yu-Ju Hong <yjhong@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Yu-Ju Hong <yjhong@chromium.org>
diff --git a/xbuddy.py b/xbuddy.py
index e723fef..27b1deb 100644
--- a/xbuddy.py
+++ b/xbuddy.py
@@ -205,6 +205,7 @@
Returns:
The merged configuration.
+
Raises:
XBuddyException if the config file is missing.
"""
@@ -260,6 +261,7 @@
rewrite table.
board: The board to fill in with when paths are rewritten. Can be from
the update request xml or the default board from devserver.
+
Returns:
If a rewrite is found, a string with the current board substituted in.
If no rewrite is found, just return the original string.
@@ -300,8 +302,12 @@
"""Check the channel folder for the version number of interest."""
# Get all names in channel dir. Get 10 highest directories by version.
_Log("Checking channel '%s' for latest '%s' image", channel, board)
- channel_dir = devserver_constants.GS_CHANNEL_DIR % {'channel':channel,
- 'board':board}
+ # Due to historical reasons, gs://chromeos-releases uses
+ # daisy-spring as opposed to the board name daisy_spring. Convert
+ # the board name for the lookup.
+ channel_dir = devserver_constants.GS_CHANNEL_DIR % {
+ 'channel':channel,
+ 'board':re.sub('_', '-', board)}
latest_version = gsutil_util.GetLatestVersionFromGSDir(
channel_dir, with_release=False)
@@ -455,7 +461,7 @@
Args:
path: the path xBuddy Get was called with.
- Return:
+ Returns:
tuple of (image_type, board, version, whether the path is local)
Raises: