Split payload application code into a subdirectory.
This patch splits from the main libupdate_engine code the part that
is strictly used to download and apply a payload into a new static
library, moving the code to subdirectories. The new library is divided
in two subdirectories: common/ and payload_consumer/, and should not
depend on other update_engine files outside those two subdirectories.
The main difference between those two is that the common/ tools are more
generic and not tied to the payload consumer process, but otherwise they
are both compiled together.
There are still dependencies from the new libpayload_consumer library
into the main directory files and DBus generated files. Those will be
addressed in follow up CLs.
Bug: 25197634
Test: FEATURES=test emerge-link update_engine; `mm` on Brillo.
Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23
diff --git a/update_engine.gyp b/update_engine.gyp
index f00d620..4254e9a 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -110,11 +110,105 @@
},
],
},
- # The main static_library with all the code.
+ # The payload application component and common dependencies.
+ {
+ 'target_name': 'libpayload_consumer',
+ 'type': 'static_library',
+ 'dependencies': [
+ 'update_metadata-protos',
+ 'update_engine-other-dbus-proxies',
+ ],
+ #TODO(deymo): Remove unused dependencies once we stop including files
+ # from the root directory.
+ 'variables': {
+ 'exported_deps': [
+ 'libcrypto',
+ 'libcurl',
+ 'libdebugd-client',
+ 'libsession_manager-client',
+ 'libmetrics-<(libbase_ver)',
+ 'libpower_manager-client',
+ 'libupdate_engine-client',
+ 'libshill-client',
+ 'libssl',
+ 'expat',
+ 'xz-embedded',
+ ],
+ 'deps': ['<@(exported_deps)'],
+ },
+ 'all_dependent_settings': {
+ 'variables': {
+ 'deps': [
+ '<@(exported_deps)',
+ ],
+ },
+ },
+ 'link_settings': {
+ 'variables': {
+ 'deps': [
+ '<@(exported_deps)',
+ ],
+ },
+ 'libraries': [
+ '-lbz2',
+ '-lpolicy-<(libbase_ver)',
+ '-lrootdev',
+ '-lrt',
+ '-lvboot_host',
+ ],
+ },
+ 'sources': [
+ 'common/action_processor.cc',
+ 'common/boot_control_chromeos.cc',
+ 'common/boot_control_stub.cc',
+ 'common/certificate_checker.cc',
+ 'common/clock.cc',
+ 'common/constants.cc',
+ 'common/hardware_chromeos.cc',
+ 'common/hash_calculator.cc',
+ 'common/http_common.cc',
+ 'common/http_fetcher.cc',
+ 'common/hwid_override.cc',
+ 'common/libcurl_http_fetcher.cc',
+ 'common/multi_range_http_fetcher.cc',
+ 'common/platform_constants_chromeos.cc',
+ 'common/prefs.cc',
+ 'common/subprocess.cc',
+ 'common/terminator.cc',
+ 'common/utils.cc',
+ 'payload_consumer/bzip_extent_writer.cc',
+ 'payload_consumer/delta_performer.cc',
+ 'payload_consumer/download_action.cc',
+ 'payload_consumer/extent_writer.cc',
+ 'payload_consumer/file_descriptor.cc',
+ 'payload_consumer/file_writer.cc',
+ 'payload_consumer/filesystem_verifier_action.cc',
+ 'payload_consumer/install_plan.cc',
+ 'payload_consumer/payload_constants.cc',
+ 'payload_consumer/payload_verifier.cc',
+ 'payload_consumer/postinstall_runner_action.cc',
+ 'payload_consumer/xz_extent_writer.cc',
+ ],
+ 'conditions': [
+ ['USE_mtd == 1', {
+ 'sources': [
+ 'payload_consumer/mtd_file_descriptor.cc',
+ ],
+ 'link_settings': {
+ 'libraries': [
+ '-lmtdutils',
+ ],
+ },
+ }],
+ ],
+ },
+ # The main daemon static_library with all the code used to check for updates
+ # with Omaha and expose a DBus daemon.
{
'target_name': 'libupdate_engine',
'type': 'static_library',
'dependencies': [
+ 'libpayload_consumer',
'update_metadata-protos',
'update_engine-dbus-adaptor',
'update_engine-other-dbus-proxies',
@@ -158,49 +252,21 @@
],
},
'sources': [
- 'action_processor.cc',
- 'boot_control_chromeos.cc',
- 'boot_control_stub.cc',
- 'bzip_extent_writer.cc',
- 'certificate_checker.cc',
'chrome_browser_proxy_resolver.cc',
- 'clock.cc',
'connection_manager.cc',
- 'constants.cc',
'daemon.cc',
'dbus_service.cc',
- 'delta_performer.cc',
- 'download_action.cc',
- 'extent_writer.cc',
- 'file_descriptor.cc',
- 'file_writer.cc',
- 'filesystem_verifier_action.cc',
- 'hardware_chromeos.cc',
- 'http_common.cc',
- 'http_fetcher.cc',
- 'hwid_override.cc',
'image_properties_chromeos.cc',
- 'install_plan.cc',
'libcros_proxy.cc',
- 'libcurl_http_fetcher.cc',
'metrics.cc',
- 'multi_range_http_fetcher.cc',
- 'omaha_hash_calculator.cc',
'omaha_request_action.cc',
'omaha_request_params.cc',
'omaha_response_handler_action.cc',
'p2p_manager.cc',
- 'payload_constants.cc',
'payload_state.cc',
- 'payload_verifier.cc',
- 'platform_constants_chromeos.cc',
- 'postinstall_runner_action.cc',
- 'prefs.cc',
'proxy_resolver.cc',
'real_system_state.cc',
'shill_proxy.cc',
- 'subprocess.cc',
- 'terminator.cc',
'update_attempter.cc',
'update_manager/boxed_value.cc',
'update_manager/chromeos_policy.cc',
@@ -217,20 +283,6 @@
'update_manager/state_factory.cc',
'update_manager/update_manager.cc',
'update_status_utils.cc',
- 'utils.cc',
- 'xz_extent_writer.cc',
- ],
- 'conditions': [
- ['USE_mtd == 1', {
- 'sources': [
- 'mtd_file_descriptor.cc',
- ],
- 'link_settings': {
- 'libraries': [
- '-lmtdutils',
- ],
- },
- }],
],
},
# update_engine daemon.
@@ -242,7 +294,7 @@
],
'sources': [
'main.cc',
- ]
+ ],
},
# update_engine console client.
{
@@ -326,7 +378,7 @@
},
'sources': [
'payload_generator/generate_delta_main.cc',
- ]
+ ],
},
],
'conditions': [
@@ -365,7 +417,7 @@
'dependencies': ['libupdate_engine'],
'sources': [
'test_http_server.cc',
- ]
+ ],
},
# Main unittest file.
{
@@ -388,32 +440,39 @@
],
'includes': ['../../../platform2/common-mk/common_test.gypi'],
'sources': [
- 'action_pipe_unittest.cc',
- 'action_processor_unittest.cc',
- 'action_unittest.cc',
- 'boot_control_chromeos_unittest.cc',
- 'bzip_extent_writer_unittest.cc',
- 'certificate_checker_unittest.cc',
'chrome_browser_proxy_resolver_unittest.cc',
+ 'common/action_pipe_unittest.cc',
+ 'common/action_processor_unittest.cc',
+ 'common/action_unittest.cc',
+ 'common/boot_control_chromeos_unittest.cc',
+ 'common/certificate_checker_unittest.cc',
+ 'common/fake_prefs.cc',
+ 'common/hash_calculator_unittest.cc',
+ 'common/http_fetcher_unittest.cc',
+ 'common/hwid_override_unittest.cc',
+ 'common/mock_http_fetcher.cc',
+ 'common/prefs_unittest.cc',
+ 'common/subprocess_unittest.cc',
+ 'common/terminator_unittest.cc',
+ 'common/test_utils.cc',
+ 'common/utils_unittest.cc',
'connection_manager_unittest.cc',
'dbus_service_unittest.cc',
- 'delta_performer_integration_test.cc',
- 'delta_performer_unittest.cc',
- 'download_action_unittest.cc',
- 'extent_writer_unittest.cc',
- 'fake_prefs.cc',
'fake_shill_proxy.cc',
'fake_system_state.cc',
- 'file_writer_unittest.cc',
- 'filesystem_verifier_action_unittest.cc',
- 'http_fetcher_unittest.cc',
- 'hwid_override_unittest.cc',
- 'mock_http_fetcher.cc',
- 'omaha_hash_calculator_unittest.cc',
'omaha_request_action_unittest.cc',
'omaha_request_params_unittest.cc',
'omaha_response_handler_action_unittest.cc',
'p2p_manager_unittest.cc',
+ 'payload_consumer/bzip_extent_writer_unittest.cc',
+ 'payload_consumer/delta_performer_integration_test.cc',
+ 'payload_consumer/delta_performer_unittest.cc',
+ 'payload_consumer/download_action_unittest.cc',
+ 'payload_consumer/extent_writer_unittest.cc',
+ 'payload_consumer/file_writer_unittest.cc',
+ 'payload_consumer/filesystem_verifier_action_unittest.cc',
+ 'payload_consumer/postinstall_runner_action_unittest.cc',
+ 'payload_consumer/xz_extent_writer_unittest.cc',
'payload_generator/ab_generator_unittest.cc',
'payload_generator/blob_file_writer_unittest.cc',
'payload_generator/block_mapping_unittest.cc',
@@ -426,17 +485,12 @@
'payload_generator/full_update_generator_unittest.cc',
'payload_generator/graph_utils_unittest.cc',
'payload_generator/inplace_generator_unittest.cc',
- 'payload_generator/payload_signer_unittest.cc',
'payload_generator/payload_file_unittest.cc',
+ 'payload_generator/payload_signer_unittest.cc',
'payload_generator/tarjan_unittest.cc',
'payload_generator/topological_sort_unittest.cc',
'payload_generator/zip_unittest.cc',
'payload_state_unittest.cc',
- 'postinstall_runner_action_unittest.cc',
- 'prefs_unittest.cc',
- 'subprocess_unittest.cc',
- 'terminator_unittest.cc',
- 'test_utils.cc',
'update_attempter_unittest.cc',
'update_manager/boxed_value_unittest.cc',
'update_manager/chromeos_policy_unittest.cc',
@@ -453,8 +507,6 @@
'update_manager/umtest_utils.cc',
'update_manager/update_manager_unittest.cc',
'update_manager/variable_unittest.cc',
- 'utils_unittest.cc',
- 'xz_extent_writer_unittest.cc',
# Main entry point for runnning tests.
'testrunner.cc',
],