devserver: Support update payload metadata for full_payload artifact
BUG=chromium:403086
TEST=devserver_integration_test.py
Change-Id: Iad49f87c9ed79327f1eb5f4b03648f28110f4f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/1826048
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Achuith Bhandarkar <achuith@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/build_artifact.py b/build_artifact.py
index f5c0148..fb62773 100755
--- a/build_artifact.py
+++ b/build_artifact.py
@@ -369,24 +369,6 @@
return str(self)
-class AUTestPayload(Artifact):
- """Wrapper for AUTest delta payloads which need additional setup."""
-
- def _Setup(self):
- super(AUTestPayload, self)._Setup()
-
- # Rename to update.gz.
- install_path = os.path.join(self.install_dir, self.install_subdir,
- self.name)
- new_install_path = os.path.join(self.install_dir, self.install_subdir,
- devserver_constants.UPDATE_FILE)
- shutil.move(install_path, new_install_path)
-
- # Reflect the rename in the list of installed files.
- self.installed_files.remove(install_path)
- self.installed_files = [new_install_path]
-
-
class MultiArtifact(Artifact):
"""Wrapper for artifacts where name matches multiple items.."""
@@ -410,6 +392,31 @@
name) for name in self.name]
+class AUTestPayload(MultiArtifact):
+ """Wrapper for AUTest delta payloads which need additional setup."""
+
+ def _Setup(self):
+ super(AUTestPayload, self)._Setup()
+
+ # Rename to update.gz.
+ # TODO(crbug.com/1008058): Change the devserver such that this renaming is
+ # not needed anymore.
+ for name in self.name:
+ dest_name = (devserver_constants.UPDATE_METADATA_FILE
+ if name.endswith('.json')
+ else devserver_constants.UPDATE_FILE)
+
+ install_path = os.path.join(self.install_dir, self.install_subdir, name)
+ new_install_path = os.path.join(self.install_dir, self.install_subdir,
+ dest_name)
+ self._Log('moving %s to %s', install_path, new_install_path)
+ shutil.move(install_path, new_install_path)
+
+ # Reflect the rename in the list of installed files.
+ self.installed_files.remove(install_path)
+ self.installed_files.append(new_install_path)
+
+
class DeltaPayloadBase(AUTestPayload):
"""Delta payloads from the archive_url.
@@ -615,7 +622,8 @@
chromeos_artifact_map.setdefault(tag, []).append(artifact)
-_AddCrOSArtifact(artifact_info.FULL_PAYLOAD, AUTestPayload, '*_full_*bin')
+_AddCrOSArtifact(artifact_info.FULL_PAYLOAD, AUTestPayload,
+ '.*full.*bin(\.json)?\\Z', is_regex_name=True)
class DeltaPayloadNtoN(DeltaPayloadBase):