scripts: upload_prebuilts: Handle version prefixes other than "chroot-"
Previously, upload_prebuilts assumed that the version prefix was "chroot-",
and chopped off the first 7 characters of the prefix+version string to
get the version alone. This updates the code to be a bit more robust,
instead looking for the expected format of the version and stripping
the prefix that precedes it.
BUG=b:289990183
TEST=./run_tests scripts/upload_prebuilts_unittest.py
Change-Id: Id36dd69c0e7529885151f26f41d86b5ce573de5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/4669938
Commit-Queue: Bob Haarman <inglorion@chromium.org>
Tested-by: Bob Haarman <inglorion@chromium.org>
Reviewed-by: Lizzy Presland <zland@google.com>
diff --git a/scripts/upload_prebuilts_unittest.py b/scripts/upload_prebuilts_unittest.py
index 47dbaf8..09bb2b1 100644
--- a/scripts/upload_prebuilts_unittest.py
+++ b/scripts/upload_prebuilts_unittest.py
@@ -667,6 +667,8 @@
class TestSdk(cros_test_lib.MockTestCase):
"""Test logic related to uploading SDK binaries"""
+ VERSION_PREFIX = "cros-"
+
def setUp(self):
self.PatchObject(
prebuilt,
@@ -706,7 +708,7 @@
False,
"x86-foo",
[],
- "chroot-1234",
+ f"{self.VERSION_PREFIX}-1234.08.01.5678",
report={},
)
@@ -719,7 +721,7 @@
):
"""Make sure we can upload just an SDK tarball"""
tar = "sdk.tar.xz"
- ver = "1234"
+ ver = "1234.08.01.5678"
vtar = "cros-sdk-%s.tar.xz" % ver
upload_calls = [
@@ -805,6 +807,12 @@
)
+class TestSdkBuildToolchain(TestSdk):
+ """Like TestSdk, but uses a different version prefix."""
+
+ VERSION_PREFIX = "build_toolchain-"
+
+
@pytest.mark.parametrize(
"extra_args,expected_sync",
[