update_engine: puffdiff .zvoice files
.zvoice files in speech_synthesis are large zip files. Start using puffin on
them to reduce the payload size whenever they change.
BUG=none
TEST=unittests
TEST=brillo_update_payload
Change-Id: Ib8ec31af831e44aa6bec3c024235728bd2d6aec5
Reviewed-on: https://chromium-review.googlesource.com/986736
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Nicolas Norvez <norvez@chromium.org>
diff --git a/payload_generator/deflate_utils.cc b/payload_generator/deflate_utils.cc
index e331142..2719048 100644
--- a/payload_generator/deflate_utils.cc
+++ b/payload_generator/deflate_utils.cc
@@ -287,12 +287,16 @@
}
// Search for deflates if the file is in zip format.
+ // .zvoice files may eventually move out of rootfs. If that happens, remove
+ // ".zvoice" (crbug.com/782918).
+ const string zip_file_extensions[] = {".apk", ".zip", ".jar", ".zvoice"};
bool is_zip =
- base::EndsWith(
- file.name, ".apk", base::CompareCase::INSENSITIVE_ASCII) ||
- base::EndsWith(
- file.name, ".zip", base::CompareCase::INSENSITIVE_ASCII) ||
- base::EndsWith(file.name, ".jar", base::CompareCase::INSENSITIVE_ASCII);
+ any_of(zip_file_extensions,
+ std::end(zip_file_extensions),
+ [&file](const string& ext) {
+ return base::EndsWith(
+ file.name, ext, base::CompareCase::INSENSITIVE_ASCII);
+ });
if (is_zip && extract_deflates) {
brillo::Blob data;