Allow rich results from uprev_android
uprev_android used to return a single value: the revved Android atom
from cros_mark_android_as_stable stdout. To allow uprev_android to
return richer information in the future, in this CL we
- make cros_mark_android_as_stable print a JSON instead
- make uprev_android return a custom result object
This is needed to implement the PUpr uprev handler for Android packages.
We need cros_mark_android_as_stable to pass the list of changed files.
BUG=b:187792081
TEST=./run_tests
Change-Id: I8e3d9fa5fe110dbd614c356ed14544d148afba35
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3299971
Tested-by: Shao-Chuan Lee <shaochuan@chromium.org>
Reviewed-by: Jaques Clapauch <jaquesc@google.com>
Commit-Queue: Shao-Chuan Lee <shaochuan@chromium.org>
diff --git a/api/controller/android.py b/api/controller/android.py
index f003420..0eb76e9 100644
--- a/api/controller/android.py
+++ b/api/controller/android.py
@@ -81,8 +81,9 @@
output_proto.status = android_pb2.MARK_STABLE_STATUS_SUCCESS
# TODO(crbug/904939): This should move to service/android.py and the port
# should be finished.
+ android_atom_to_build = None
try:
- android_atom_to_build = packages.uprev_android(
+ result = packages.uprev_android(
android_package=package_name,
chroot=chroot,
build_targets=build_targets,
@@ -90,6 +91,8 @@
android_version=android_version,
skip_commit=skip_commit,
)
+ if result.revved:
+ android_atom_to_build = result.android_atom
except packages.AndroidIsPinnedUprevError as e:
# If the uprev failed due to a pin, CI needs to unpin and retry.
android_atom_to_build = e.new_android_atom