update_engine: Add delta payload support for squashfs

This patch adds support for generating delta payloads for squashfs
images. This is needed to get delta payloads for DLC images.

In order to get the supported major and minor versions of the
update_engine that matches the squashfs image (either squashfs image
contains the entire rootfs, including the update_engine, or the image is
a DLC), we need to read /etc/update_engine inside the image.

We do this by calling unsquashfs and only unsquashing the target file
and later reading its content into a key-value store to be used for
delta payload generation.

BUG=chromium:926986
TEST=unittest
TEST=delta_generator --out_file=output --partition_names=dlc --new_partitions=dlc.img --old_partitions=dlc.img

Change-Id: Ib5599032c873223a5caca82918e138d8b4fcec43
Reviewed-on: https://chromium-review.googlesource.com/1446278
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Sen Jiang <senj@chromium.org>
7 files changed
tree: c474302ca207871b86ba75864f72a7cf6530b6be
  1. .clang-format
  2. .gitignore
  3. Android.bp
  4. COMMIT-QUEUE.ini
  5. CPPLINT.cfg
  6. MODULE_LICENSE_APACHE2
  7. NOTICE
  8. OWNERS
  9. PRESUBMIT.cfg
  10. PREUPLOAD.cfg
  11. UpdateEngine.conf
  12. binder_bindings/
  13. binder_service_android.cc
  14. binder_service_android.h
  15. binder_service_brillo.cc
  16. binder_service_brillo.h
  17. boot_control_android.cc
  18. boot_control_android.h
  19. boot_control_android_unittest.cc
  20. boot_control_chromeos.cc
  21. boot_control_chromeos.h
  22. boot_control_chromeos_unittest.cc
  23. certificate_checker.cc
  24. certificate_checker.h
  25. certificate_checker_unittest.cc
  26. chrome_browser_proxy_resolver.cc
  27. chrome_browser_proxy_resolver.h
  28. client_library/
  29. common/
  30. common_service.cc
  31. common_service.h
  32. common_service_unittest.cc
  33. connection_manager.cc
  34. connection_manager.h
  35. connection_manager_android.cc
  36. connection_manager_android.h
  37. connection_manager_interface.h
  38. connection_manager_unittest.cc
  39. connection_utils.cc
  40. connection_utils.h
  41. daemon.cc
  42. daemon.h
  43. daemon_state_android.cc
  44. daemon_state_android.h
  45. daemon_state_interface.h
  46. dbus_bindings/
  47. dbus_connection.cc
  48. dbus_connection.h
  49. dbus_service.cc
  50. dbus_service.h
  51. dbus_test_utils.h
  52. dlcservice_chromeos.cc
  53. dlcservice_chromeos.h
  54. dynamic_partition_control_android.cc
  55. dynamic_partition_control_android.h
  56. dynamic_partition_control_interface.h
  57. fake_file_writer.h
  58. fake_p2p_manager.h
  59. fake_p2p_manager_configuration.h
  60. fake_shill_proxy.cc
  61. fake_shill_proxy.h
  62. fake_system_state.cc
  63. fake_system_state.h
  64. fuzz/
  65. generate_pc_file.sh
  66. hardware_android.cc
  67. hardware_android.h
  68. hardware_chromeos.cc
  69. hardware_chromeos.h
  70. hardware_chromeos_unittest.cc
  71. image_properties.h
  72. image_properties_android.cc
  73. image_properties_android_unittest.cc
  74. image_properties_chromeos.cc
  75. image_properties_chromeos_unittest.cc
  76. init/
  77. libcurl_http_fetcher.cc
  78. libcurl_http_fetcher.h
  79. libupdate_engine-client-test.pc.in
  80. libupdate_engine-client.pc.in
  81. local_coverage_rate
  82. main.cc
  83. metrics_constants.h
  84. metrics_reporter_android.cc
  85. metrics_reporter_android.h
  86. metrics_reporter_interface.h
  87. metrics_reporter_omaha.cc
  88. metrics_reporter_omaha.h
  89. metrics_reporter_omaha_unittest.cc
  90. metrics_reporter_stub.cc
  91. metrics_reporter_stub.h
  92. metrics_utils.cc
  93. metrics_utils.h
  94. metrics_utils_unittest.cc
  95. mock_boot_control_hal.h
  96. mock_certificate_checker.h
  97. mock_connection_manager.h
  98. mock_dynamic_partition_control.h
  99. mock_file_writer.h
  100. mock_metrics_reporter.h
  101. mock_omaha_request_params.h
  102. mock_p2p_manager.h
  103. mock_payload_state.h
  104. mock_power_manager.h
  105. mock_service_observer.h
  106. mock_update_attempter.h
  107. network_selector.h
  108. network_selector_android.cc
  109. network_selector_android.h
  110. network_selector_interface.h
  111. network_selector_stub.cc
  112. network_selector_stub.h
  113. omaha_request_action.cc
  114. omaha_request_action.h
  115. omaha_request_action_fuzzer.cc
  116. omaha_request_action_unittest.cc
  117. omaha_request_params.cc
  118. omaha_request_params.h
  119. omaha_request_params_unittest.cc
  120. omaha_response.h
  121. omaha_response_handler_action.cc
  122. omaha_response_handler_action.h
  123. omaha_response_handler_action_unittest.cc
  124. omaha_utils.cc
  125. omaha_utils.h
  126. omaha_utils_unittest.cc
  127. p2p_manager.cc
  128. p2p_manager.h
  129. p2p_manager_unittest.cc
  130. parcelable_update_engine_status.cc
  131. parcelable_update_engine_status.h
  132. parcelable_update_engine_status_unittest.cc
  133. payload_consumer/
  134. payload_generator/
  135. payload_state.cc
  136. payload_state.h
  137. payload_state_interface.h
  138. payload_state_unittest.cc
  139. power_manager_android.cc
  140. power_manager_android.h
  141. power_manager_chromeos.cc
  142. power_manager_chromeos.h
  143. power_manager_interface.h
  144. pylintrc
  145. real_system_state.cc
  146. real_system_state.h
  147. run_unittests
  148. sample_images/
  149. sample_omaha_v3_response.xml
  150. scripts/
  151. service_delegate_android_interface.h
  152. service_observer_interface.h
  153. shill_proxy.cc
  154. shill_proxy.h
  155. shill_proxy_interface.h
  156. sideload_main.cc
  157. system_state.h
  158. tar_bunzip2.gypi
  159. test_http_server.cc
  160. test_subprocess.cc
  161. testrunner.cc
  162. unittest_key.pem
  163. unittest_key2.pem
  164. update_attempter.cc
  165. update_attempter.h
  166. update_attempter_android.cc
  167. update_attempter_android.h
  168. update_attempter_android_unittest.cc
  169. update_attempter_unittest.cc
  170. update_boot_flags_action.cc
  171. update_boot_flags_action.h
  172. update_boot_flags_action_unittest.cc
  173. update_engine-client.gyp
  174. update_engine.conf
  175. update_engine.gyp
  176. update_engine.rc
  177. update_engine/
  178. update_engine_client.cc
  179. update_engine_client_android.cc
  180. update_manager/
  181. update_metadata.proto
  182. update_payload_key/
  183. update_status_utils.cc
  184. update_status_utils.h