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/Android.mk b/Android.mk
index 9804576..9b6e771 100644
--- a/Android.mk
+++ b/Android.mk
@@ -104,13 +104,99 @@
LOCAL_DBUS_PROXY_PREFIX := libcros
include $(BUILD_STATIC_LIBRARY)
-# libupdate_engine (type: static_library)
+# libpayload_consumer (type: static_library)
# ========================================================
-# The main static_library with all the code.
-ue_libupdate_engine_exported_c_includes := \
+# The payload application component and common dependencies.
+ue_libpayload_consumer_exported_c_includes := \
$(LOCAL_PATH)/include \
external/cros/system_api/dbus
+ue_libpayload_consumer_exported_static_libraries := \
+ update_metadata-protos \
+ update_engine-dbus-libcros-client \
+ update_engine_client-dbus-proxies \
+ libxz \
+ libbz \
+ libfs_mgr \
+ $(ue_update_metadata_protos_exported_static_libraries)
+ue_libpayload_consumer_exported_shared_libraries := \
+ libcrypto \
+ libcurl \
+ libmetrics \
+ libshill-client \
+ libssl \
+ libexpat \
+ libbrillo-policy \
+ libhardware \
+ libcutils \
+ $(ue_update_metadata_protos_exported_shared_libraries)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libpayload_consumer
+LOCAL_MODULE_CLASS := STATIC_LIBRARIES
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_RTTI_FLAG := -frtti
+LOCAL_CLANG := true
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(ue_libpayload_consumer_exported_c_includes)
+LOCAL_CFLAGS := $(ue_common_cflags)
+LOCAL_CPPFLAGS := $(ue_common_cppflags)
+LOCAL_LDFLAGS := $(ue_common_ldflags)
+LOCAL_C_INCLUDES := \
+ $(ue_common_c_includes) \
+ $(ue_libpayload_consumer_exported_c_includes) \
+ external/e2fsprogs/lib
+LOCAL_STATIC_LIBRARIES := \
+ update_metadata-protos \
+ update_engine-dbus-libcros-client \
+ update_engine_client-dbus-proxies \
+ $(ue_libpayload_consumer_exported_static_libraries) \
+ $(ue_update_metadata_protos_exported_static_libraries)
+LOCAL_SHARED_LIBRARIES := \
+ $(ue_common_shared_libraries) \
+ $(ue_libpayload_consumer_exported_shared_libraries) \
+ $(ue_update_metadata_protos_exported_shared_libraries)
+LOCAL_SRC_FILES := \
+ common/action_processor.cc \
+ common/boot_control_android.cc \
+ common/boot_control_stub.cc \
+ common/certificate_checker.cc \
+ common/clock.cc \
+ common/constants.cc \
+ common/hardware_android.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_android.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
+include $(BUILD_STATIC_LIBRARY)
+
+# libupdate_engine (type: static_library)
+# ========================================================
+# The main daemon static_library with all the code used to check for updates
+# with Omaha and expose a DBus daemon.
+ue_libupdate_engine_exported_c_includes := \
+ $(LOCAL_PATH)/include \
+ external/cros/system_api/dbus \
+ $(ue_libpayload_consumer_exported_c_includes)
ue_libupdate_engine_exported_static_libraries := \
+ libpayload_consumer \
update_metadata-protos \
update_engine-dbus-adaptor \
update_engine-dbus-libcros-client \
@@ -118,6 +204,7 @@
libxz \
libbz \
libfs_mgr \
+ $(ue_libpayload_consumer_exported_static_libraries) \
$(ue_update_metadata_protos_exported_static_libraries)
ue_libupdate_engine_exported_shared_libraries := \
libdbus \
@@ -130,6 +217,7 @@
libbrillo-policy \
libhardware \
libcutils \
+ $(ue_libpayload_consumer_exported_shared_libraries) \
$(ue_update_metadata_protos_exported_shared_libraries)
include $(CLEAR_VARS)
@@ -145,62 +233,37 @@
LOCAL_C_INCLUDES := \
$(ue_common_c_includes) \
$(ue_libupdate_engine_exported_c_includes) \
- external/e2fsprogs/lib
+ $(ue_libpayload_consumer_exported_c_includes)
LOCAL_STATIC_LIBRARIES := \
+ libpayload_consumer \
update_metadata-protos \
update_engine-dbus-adaptor \
update_engine-dbus-libcros-client \
update_engine_client-dbus-proxies \
$(ue_libupdate_engine_exported_static_libraries) \
+ $(ue_libpayload_consumer_exported_static_libraries) \
$(ue_update_metadata_protos_exported_static_libraries)
LOCAL_SHARED_LIBRARIES := \
$(ue_common_shared_libraries) \
$(ue_libupdate_engine_exported_shared_libraries) \
+ $(ue_libpayload_consumer_exported_shared_libraries) \
$(ue_update_metadata_protos_exported_shared_libraries)
LOCAL_SRC_FILES := \
- action_processor.cc \
- boot_control_android.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_android.cc \
- http_common.cc \
- http_fetcher.cc \
- hwid_override.cc \
image_properties_android.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_android.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 \
@@ -216,9 +279,7 @@
update_manager/real_updater_provider.cc \
update_manager/state_factory.cc \
update_manager/update_manager.cc \
- update_status_utils.cc \
- utils.cc \
- xz_extent_writer.cc
+ update_status_utils.cc
include $(BUILD_STATIC_LIBRARY)
# update_engine (type: executable)
diff --git a/chrome_browser_proxy_resolver.cc b/chrome_browser_proxy_resolver.cc
index fb74724..4971d74 100644
--- a/chrome_browser_proxy_resolver.cc
+++ b/chrome_browser_proxy_resolver.cc
@@ -25,7 +25,7 @@
#include <base/strings/string_tokenizer.h>
#include <base/strings/string_util.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
namespace chromeos_update_engine {
diff --git a/client_library/client_impl.h b/client_library/client_impl.h
index a16136c..e6194d2 100644
--- a/client_library/client_impl.h
+++ b/client_library/client_impl.h
@@ -23,8 +23,8 @@
#include <base/macros.h>
-#include "update_engine/dbus-proxies.h"
#include "update_engine/client_library/include/update_engine/client.h"
+#include "update_engine/dbus-proxies.h"
namespace update_engine {
namespace internal {
diff --git a/client_library/include/update_engine/client.h b/client_library/include/update_engine/client.h
index ec39253..b3cef66 100644
--- a/client_library/include/update_engine/client.h
+++ b/client_library/include/update_engine/client.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UDPATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_CLIENT_H_
-#define UDPATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_CLIENT_H_
+#ifndef UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_CLIENT_H_
+#define UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_CLIENT_H_
#include <cstdint>
#include <memory>
@@ -86,4 +86,4 @@
} // namespace update_engine
-#endif // UDPATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_CLIENT_H_
+#endif // UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_CLIENT_H_
diff --git a/client_library/include/update_engine/update_status.h b/client_library/include/update_engine/update_status.h
index 525249c..3e9af5b 100644
--- a/client_library/include/update_engine/update_status.h
+++ b/client_library/include/update_engine/update_status.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
-#define CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
+#ifndef UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
+#define UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
namespace update_engine {
@@ -34,4 +34,4 @@
} // namespace update_engine
-#endif // CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
+#endif // UPDATE_ENGINE_CLIENT_LIBRARY_INCLUDE_UPDATE_ENGINE_UPDATE_STATUS_H_
diff --git a/action.h b/common/action.h
similarity index 96%
rename from action.h
rename to common/action.h
index 21bc9ab..d8049ac 100644
--- a/action.h
+++ b/common/action.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_ACTION_H_
-#define UPDATE_ENGINE_ACTION_H_
+#ifndef UPDATE_ENGINE_COMMON_ACTION_H_
+#define UPDATE_ENGINE_COMMON_ACTION_H_
#include <stdio.h>
@@ -25,8 +25,8 @@
#include <base/logging.h>
#include <base/macros.h>
-#include "update_engine/action_pipe.h"
-#include "update_engine/action_processor.h"
+#include "update_engine/common/action_pipe.h"
+#include "update_engine/common/action_processor.h"
// The structure of these classes (Action, ActionPipe, ActionProcessor, etc.)
// is based on the KSAction* classes from the Google Update Engine code at
@@ -215,4 +215,4 @@
}; // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_ACTION_H_
+#endif // UPDATE_ENGINE_COMMON_ACTION_H_
diff --git a/action_pipe.h b/common/action_pipe.h
similarity index 95%
rename from action_pipe.h
rename to common/action_pipe.h
index 3a1219a..362817d 100644
--- a/action_pipe.h
+++ b/common/action_pipe.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_ACTION_PIPE_H_
-#define UPDATE_ENGINE_ACTION_PIPE_H_
+#ifndef UPDATE_ENGINE_COMMON_ACTION_PIPE_H_
+#define UPDATE_ENGINE_COMMON_ACTION_PIPE_H_
#include <stdio.h>
@@ -98,4 +98,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_ACTION_PIPE_H_
+#endif // UPDATE_ENGINE_COMMON_ACTION_PIPE_H_
diff --git a/action_pipe_unittest.cc b/common/action_pipe_unittest.cc
similarity index 94%
rename from action_pipe_unittest.cc
rename to common/action_pipe_unittest.cc
index 165bf72..9bfbc83 100644
--- a/action_pipe_unittest.cc
+++ b/common/action_pipe_unittest.cc
@@ -14,11 +14,11 @@
// limitations under the License.
//
-#include "update_engine/action_pipe.h"
+#include "update_engine/common/action_pipe.h"
-#include <string>
#include <gtest/gtest.h>
-#include "update_engine/action.h"
+#include <string>
+#include "update_engine/common/action.h"
using std::string;
diff --git a/action_processor.cc b/common/action_processor.cc
similarity index 96%
rename from action_processor.cc
rename to common/action_processor.cc
index 1884060..c5270a4 100644
--- a/action_processor.cc
+++ b/common/action_processor.cc
@@ -14,13 +14,13 @@
// limitations under the License.
//
-#include "update_engine/action_processor.h"
+#include "update_engine/common/action_processor.h"
#include <string>
#include <base/logging.h>
-#include "update_engine/action.h"
+#include "update_engine/common/action.h"
using std::string;
diff --git a/action_processor.h b/common/action_processor.h
similarity index 94%
rename from action_processor.h
rename to common/action_processor.h
index cd458ad..d61e12d 100644
--- a/action_processor.h
+++ b/common/action_processor.h
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_ACTION_PROCESSOR_H_
-#define UPDATE_ENGINE_ACTION_PROCESSOR_H_
+#ifndef UPDATE_ENGINE_COMMON_ACTION_PROCESSOR_H_
+#define UPDATE_ENGINE_COMMON_ACTION_PROCESSOR_H_
#include <deque>
#include <base/macros.h>
-#include "update_engine/error_code.h"
+#include "update_engine/common/error_code.h"
// The structure of these classes (Action, ActionPipe, ActionProcessor, etc.)
// is based on the KSAction* classes from the Google Update Engine code at
@@ -113,4 +113,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_ACTION_PROCESSOR_H_
+#endif // UPDATE_ENGINE_COMMON_ACTION_PROCESSOR_H_
diff --git a/action_processor_unittest.cc b/common/action_processor_unittest.cc
similarity index 98%
rename from action_processor_unittest.cc
rename to common/action_processor_unittest.cc
index 05ae7fb..8285470 100644
--- a/action_processor_unittest.cc
+++ b/common/action_processor_unittest.cc
@@ -14,11 +14,11 @@
// limitations under the License.
//
-#include "update_engine/action_processor.h"
+#include "update_engine/common/action_processor.h"
-#include <string>
#include <gtest/gtest.h>
-#include "update_engine/action.h"
+#include <string>
+#include "update_engine/common/action.h"
using std::string;
diff --git a/action_unittest.cc b/common/action_unittest.cc
similarity index 95%
rename from action_unittest.cc
rename to common/action_unittest.cc
index b36fa29..dcdce17 100644
--- a/action_unittest.cc
+++ b/common/action_unittest.cc
@@ -14,11 +14,11 @@
// limitations under the License.
//
-#include "update_engine/action.h"
+#include "update_engine/common/action.h"
-#include <string>
#include <gtest/gtest.h>
-#include "update_engine/action_processor.h"
+#include <string>
+#include "update_engine/common/action_processor.h"
using std::string;
diff --git a/boot_control.h b/common/boot_control.h
similarity index 83%
rename from boot_control.h
rename to common/boot_control.h
index ae90f82..1463015 100644
--- a/boot_control.h
+++ b/common/boot_control.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BOOT_CONTROL_H_
-#define UPDATE_ENGINE_BOOT_CONTROL_H_
+#ifndef UPDATE_ENGINE_COMMON_BOOT_CONTROL_H_
+#define UPDATE_ENGINE_COMMON_BOOT_CONTROL_H_
#include <memory>
-#include "update_engine/boot_control_interface.h"
+#include "update_engine/common/boot_control_interface.h"
namespace chromeos_update_engine {
namespace boot_control {
@@ -32,4 +32,4 @@
} // namespace boot_control
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BOOT_CONTROL_H_
+#endif // UPDATE_ENGINE_COMMON_BOOT_CONTROL_H_
diff --git a/boot_control_android.cc b/common/boot_control_android.cc
similarity index 97%
rename from boot_control_android.cc
rename to common/boot_control_android.cc
index 9a4bd15..a00fcf4 100644
--- a/boot_control_android.cc
+++ b/common/boot_control_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/boot_control_android.h"
+#include "update_engine/common/boot_control_android.h"
#include <base/bind.h>
#include <base/files/file_util.h>
@@ -25,7 +25,7 @@
#include <cutils/properties.h>
#include <fs_mgr.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using std::string;
diff --git a/boot_control_android.h b/common/boot_control_android.h
similarity index 90%
rename from boot_control_android.h
rename to common/boot_control_android.h
index 8f4f2f9..c857e04 100644
--- a/boot_control_android.h
+++ b/common/boot_control_android.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
-#define UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
+#ifndef UPDATE_ENGINE_COMMON_BOOT_CONTROL_ANDROID_H_
+#define UPDATE_ENGINE_COMMON_BOOT_CONTROL_ANDROID_H_
#include <string>
#include <hardware/boot_control.h>
#include <hardware/hardware.h>
-#include "update_engine/boot_control.h"
+#include "update_engine/common/boot_control.h"
namespace chromeos_update_engine {
@@ -58,4 +58,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BOOT_CONTROL_ANDROID_H_
+#endif // UPDATE_ENGINE_COMMON_BOOT_CONTROL_ANDROID_H_
diff --git a/boot_control_chromeos.cc b/common/boot_control_chromeos.cc
similarity index 97%
rename from boot_control_chromeos.cc
rename to common/boot_control_chromeos.cc
index 10d99e3..d053b68 100644
--- a/boot_control_chromeos.cc
+++ b/common/boot_control_chromeos.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/boot_control_chromeos.h"
+#include "update_engine/common/boot_control_chromeos.h"
#include <string>
@@ -29,9 +29,9 @@
#include <vboot/vboot_host.h>
}
-#include "update_engine/boot_control.h"
-#include "update_engine/subprocess.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/boot_control.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
using std::string;
diff --git a/boot_control_chromeos.h b/common/boot_control_chromeos.h
similarity index 93%
rename from boot_control_chromeos.h
rename to common/boot_control_chromeos.h
index 6002712..be661e8 100644
--- a/boot_control_chromeos.h
+++ b/common/boot_control_chromeos.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
-#define UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_COMMON_BOOT_CONTROL_CHROMEOS_H_
+#define UPDATE_ENGINE_COMMON_BOOT_CONTROL_CHROMEOS_H_
#include <string>
#include <base/callback.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include "update_engine/boot_control_interface.h"
+#include "update_engine/common/boot_control_interface.h"
namespace chromeos_update_engine {
@@ -82,4 +82,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BOOT_CONTROL_CHROMEOS_H_
+#endif // UPDATE_ENGINE_COMMON_BOOT_CONTROL_CHROMEOS_H_
diff --git a/boot_control_chromeos_unittest.cc b/common/boot_control_chromeos_unittest.cc
similarity index 97%
rename from boot_control_chromeos_unittest.cc
rename to common/boot_control_chromeos_unittest.cc
index 6a60009..4c218c0 100644
--- a/boot_control_chromeos_unittest.cc
+++ b/common/boot_control_chromeos_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/boot_control_chromeos.h"
+#include "update_engine/common/boot_control_chromeos.h"
#include <gtest/gtest.h>
diff --git a/boot_control_interface.h b/common/boot_control_interface.h
similarity index 95%
rename from boot_control_interface.h
rename to common/boot_control_interface.h
index 2fe6890..659b388 100644
--- a/boot_control_interface.h
+++ b/common/boot_control_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BOOT_CONTROL_INTERFACE_H_
-#define UPDATE_ENGINE_BOOT_CONTROL_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_BOOT_CONTROL_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_BOOT_CONTROL_INTERFACE_H_
#include <climits>
#include <string>
@@ -95,4 +95,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BOOT_CONTROL_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_BOOT_CONTROL_INTERFACE_H_
diff --git a/boot_control_stub.cc b/common/boot_control_stub.cc
similarity index 96%
rename from boot_control_stub.cc
rename to common/boot_control_stub.cc
index 8d43530..2de0c82 100644
--- a/boot_control_stub.cc
+++ b/common/boot_control_stub.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/boot_control_stub.h"
+#include "update_engine/common/boot_control_stub.h"
#include <base/logging.h>
diff --git a/boot_control_stub.h b/common/boot_control_stub.h
similarity index 89%
rename from boot_control_stub.h
rename to common/boot_control_stub.h
index 39fcb7a..7832adc 100644
--- a/boot_control_stub.h
+++ b/common/boot_control_stub.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BOOT_CONTROL_STUB_H_
-#define UPDATE_ENGINE_BOOT_CONTROL_STUB_H_
+#ifndef UPDATE_ENGINE_COMMON_BOOT_CONTROL_STUB_H_
+#define UPDATE_ENGINE_COMMON_BOOT_CONTROL_STUB_H_
#include <string>
-#include "update_engine/boot_control_interface.h"
+#include "update_engine/common/boot_control_interface.h"
namespace chromeos_update_engine {
@@ -52,4 +52,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BOOT_CONTROL_STUB_H_
+#endif // UPDATE_ENGINE_COMMON_BOOT_CONTROL_STUB_H_
diff --git a/certificate_checker.cc b/common/certificate_checker.cc
similarity index 97%
rename from certificate_checker.cc
rename to common/certificate_checker.cc
index 9ce5650..87f9848 100644
--- a/certificate_checker.cc
+++ b/common/certificate_checker.cc
@@ -14,22 +14,22 @@
// limitations under the License.
//
-#include "update_engine/certificate_checker.h"
+#include "update_engine/common/certificate_checker.h"
#include <string>
+#include <base/logging.h>
#include <base/strings/string_number_conversions.h>
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
-#include <base/logging.h>
#include <curl/curl.h>
#include <openssl/evp.h>
#include <openssl/ssl.h>
#include "metrics/metrics_library.h"
-#include "update_engine/constants.h"
-#include "update_engine/prefs_interface.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/utils.h"
using std::string;
diff --git a/certificate_checker.h b/common/certificate_checker.h
similarity index 96%
rename from certificate_checker.h
rename to common/certificate_checker.h
index 11703f2..83c09e1 100644
--- a/certificate_checker.h
+++ b/common/certificate_checker.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CERTIFICATE_CHECKER_H_
-#define UPDATE_ENGINE_CERTIFICATE_CHECKER_H_
+#ifndef UPDATE_ENGINE_COMMON_CERTIFICATE_CHECKER_H_
+#define UPDATE_ENGINE_COMMON_CERTIFICATE_CHECKER_H_
#include <curl/curl.h>
#include <openssl/ssl.h>
@@ -132,4 +132,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CERTIFICATE_CHECKER_H_
+#endif // UPDATE_ENGINE_COMMON_CERTIFICATE_CHECKER_H_
diff --git a/certificate_checker_unittest.cc b/common/certificate_checker_unittest.cc
similarity index 96%
rename from certificate_checker_unittest.cc
rename to common/certificate_checker_unittest.cc
index 1249735..3dfdadb 100644
--- a/certificate_checker_unittest.cc
+++ b/common/certificate_checker_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/certificate_checker.h"
+#include "update_engine/common/certificate_checker.h"
#include <string>
@@ -24,10 +24,10 @@
#include <gtest/gtest.h>
#include <metrics/metrics_library_mock.h>
-#include "update_engine/constants.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/mock_certificate_checker.h"
+#include "update_engine/common/mock_prefs.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_certificate_checker.h"
-#include "update_engine/mock_prefs.h"
using ::testing::DoAll;
using ::testing::Return;
diff --git a/clock.cc b/common/clock.cc
similarity index 97%
rename from clock.cc
rename to common/clock.cc
index fea222b..f0eff44 100644
--- a/clock.cc
+++ b/common/clock.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/clock.h"
+#include "update_engine/common/clock.h"
#include <time.h>
diff --git a/clock.h b/common/clock.h
similarity index 84%
rename from clock.h
rename to common/clock.h
index 8a5057f..2f373a7 100644
--- a/clock.h
+++ b/common/clock.h
@@ -14,10 +14,10 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CLOCK_H_
-#define UPDATE_ENGINE_CLOCK_H_
+#ifndef UPDATE_ENGINE_COMMON_CLOCK_H_
+#define UPDATE_ENGINE_COMMON_CLOCK_H_
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
namespace chromeos_update_engine {
@@ -38,4 +38,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CLOCK_H_
+#endif // UPDATE_ENGINE_COMMON_CLOCK_H_
diff --git a/clock_interface.h b/common/clock_interface.h
similarity index 91%
rename from clock_interface.h
rename to common/clock_interface.h
index 722fd98..2228983 100644
--- a/clock_interface.h
+++ b/common/clock_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CLOCK_INTERFACE_H_
-#define UPDATE_ENGINE_CLOCK_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_CLOCK_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_CLOCK_INTERFACE_H_
#include <string>
@@ -51,4 +51,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CLOCK_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_CLOCK_INTERFACE_H_
diff --git a/constants.cc b/common/constants.cc
similarity index 98%
rename from constants.cc
rename to common/constants.cc
index 1b41a85..26f3628 100644
--- a/constants.cc
+++ b/common/constants.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/constants.h"
+#include "update_engine/common/constants.h"
namespace chromeos_update_engine {
diff --git a/constants.h b/common/constants.h
similarity index 97%
rename from constants.h
rename to common/constants.h
index 34013e8..ecdf51c 100644
--- a/constants.h
+++ b/common/constants.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_CONSTANTS_H_
-#define UPDATE_ENGINE_CONSTANTS_H_
+#ifndef UPDATE_ENGINE_COMMON_CONSTANTS_H_
+#define UPDATE_ENGINE_COMMON_CONSTANTS_H_
namespace chromeos_update_engine {
@@ -179,4 +179,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_CONSTANTS_H_
+#endif // UPDATE_ENGINE_COMMON_CONSTANTS_H_
diff --git a/error_code.h b/common/error_code.h
similarity index 97%
rename from error_code.h
rename to common/error_code.h
index fdef895..2bbdcfa 100644
--- a/error_code.h
+++ b/common/error_code.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_ERROR_CODE_H_
-#define UPDATE_ENGINE_ERROR_CODE_H_
+#ifndef UPDATE_ENGINE_COMMON_ERROR_CODE_H_
+#define UPDATE_ENGINE_COMMON_ERROR_CODE_H_
#include <ostream> // NOLINT(readability/streams)
@@ -132,4 +132,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_ERROR_CODE_H_
+#endif // UPDATE_ENGINE_COMMON_ERROR_CODE_H_
diff --git a/fake_boot_control.h b/common/fake_boot_control.h
similarity index 93%
rename from fake_boot_control.h
rename to common/fake_boot_control.h
index f5dcdd6..5c6c160 100644
--- a/fake_boot_control.h
+++ b/common/fake_boot_control.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_BOOT_CONTROL_H_
-#define UPDATE_ENGINE_FAKE_BOOT_CONTROL_H_
+#ifndef UPDATE_ENGINE_COMMON_FAKE_BOOT_CONTROL_H_
+#define UPDATE_ENGINE_COMMON_FAKE_BOOT_CONTROL_H_
#include <map>
#include <string>
@@ -23,7 +23,7 @@
#include <base/time/time.h>
-#include "update_engine/boot_control_interface.h"
+#include "update_engine/common/boot_control_interface.h"
namespace chromeos_update_engine {
@@ -109,4 +109,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_BOOT_CONTROL_H_
+#endif // UPDATE_ENGINE_COMMON_FAKE_BOOT_CONTROL_H_
diff --git a/fake_clock.h b/common/fake_clock.h
similarity index 88%
rename from fake_clock.h
rename to common/fake_clock.h
index 5006506..3d3bad8 100644
--- a/fake_clock.h
+++ b/common/fake_clock.h
@@ -14,10 +14,10 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_CLOCK_H_
-#define UPDATE_ENGINE_FAKE_CLOCK_H_
+#ifndef UPDATE_ENGINE_COMMON_FAKE_CLOCK_H_
+#define UPDATE_ENGINE_COMMON_FAKE_CLOCK_H_
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
namespace chromeos_update_engine {
@@ -60,4 +60,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_CLOCK_H_
+#endif // UPDATE_ENGINE_COMMON_FAKE_CLOCK_H_
diff --git a/fake_hardware.h b/common/fake_hardware.h
similarity index 94%
rename from fake_hardware.h
rename to common/fake_hardware.h
index 6036a40..23d6498 100644
--- a/fake_hardware.h
+++ b/common/fake_hardware.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_HARDWARE_H_
-#define UPDATE_ENGINE_FAKE_HARDWARE_H_
+#ifndef UPDATE_ENGINE_COMMON_FAKE_HARDWARE_H_
+#define UPDATE_ENGINE_COMMON_FAKE_HARDWARE_H_
#include <map>
#include <string>
#include <base/time/time.h>
-#include "update_engine/hardware_interface.h"
+#include "update_engine/common/hardware_interface.h"
namespace chromeos_update_engine {
@@ -121,4 +121,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_HARDWARE_H_
+#endif // UPDATE_ENGINE_COMMON_FAKE_HARDWARE_H_
diff --git a/fake_prefs.cc b/common/fake_prefs.cc
similarity index 98%
rename from fake_prefs.cc
rename to common/fake_prefs.cc
index c849388..5a0a3af 100644
--- a/fake_prefs.cc
+++ b/common/fake_prefs.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/fake_prefs.h"
+#include "update_engine/common/fake_prefs.h"
#include <algorithm>
diff --git a/fake_prefs.h b/common/fake_prefs.h
similarity index 94%
rename from fake_prefs.h
rename to common/fake_prefs.h
index 2777ad6..d194060 100644
--- a/fake_prefs.h
+++ b/common/fake_prefs.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_PREFS_H_
-#define UPDATE_ENGINE_FAKE_PREFS_H_
+#ifndef UPDATE_ENGINE_COMMON_FAKE_PREFS_H_
+#define UPDATE_ENGINE_COMMON_FAKE_PREFS_H_
#include <map>
#include <string>
@@ -23,7 +23,7 @@
#include <base/macros.h>
-#include "update_engine/prefs_interface.h"
+#include "update_engine/common/prefs_interface.h"
namespace chromeos_update_engine {
@@ -110,4 +110,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_PREFS_H_
+#endif // UPDATE_ENGINE_COMMON_FAKE_PREFS_H_
diff --git a/hardware.h b/common/hardware.h
similarity index 83%
rename from hardware.h
rename to common/hardware.h
index 4d52bb9..f1365e0 100644
--- a/hardware.h
+++ b/common/hardware.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HARDWARE_H_
-#define UPDATE_ENGINE_HARDWARE_H_
+#ifndef UPDATE_ENGINE_COMMON_HARDWARE_H_
+#define UPDATE_ENGINE_COMMON_HARDWARE_H_
#include <memory>
-#include "update_engine/hardware_interface.h"
+#include "update_engine/common/hardware_interface.h"
namespace chromeos_update_engine {
namespace hardware {
@@ -31,4 +31,4 @@
} // namespace hardware
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HARDWARE_H_
+#endif // UPDATE_ENGINE_COMMON_HARDWARE_H_
diff --git a/hardware_android.cc b/common/hardware_android.cc
similarity index 97%
rename from hardware_android.cc
rename to common/hardware_android.cc
index 1b2cf1c..4f06ff2 100644
--- a/hardware_android.cc
+++ b/common/hardware_android.cc
@@ -14,13 +14,13 @@
// limitations under the License.
//
-#include "update_engine/hardware_android.h"
+#include "update_engine/common/hardware_android.h"
#include <base/files/file_util.h>
#include <brillo/make_unique_ptr.h>
#include <cutils/properties.h>
-#include "update_engine/hardware.h"
+#include "update_engine/common/hardware.h"
using std::string;
diff --git a/hardware_android.h b/common/hardware_android.h
similarity index 85%
rename from hardware_android.h
rename to common/hardware_android.h
index 03bc9fc..071f7d5 100644
--- a/hardware_android.h
+++ b/common/hardware_android.h
@@ -14,16 +14,16 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HARDWARE_ANDROID_H_
-#define UPDATE_ENGINE_HARDWARE_ANDROID_H_
+#ifndef UPDATE_ENGINE_COMMON_HARDWARE_ANDROID_H_
+#define UPDATE_ENGINE_COMMON_HARDWARE_ANDROID_H_
#include <string>
#include <base/macros.h>
#include <base/time/time.h>
-#include "update_engine/hardware.h"
-#include "update_engine/hardware_interface.h"
+#include "update_engine/common/hardware.h"
+#include "update_engine/common/hardware_interface.h"
namespace chromeos_update_engine {
@@ -50,4 +50,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HARDWARE_ANDROID_H_
+#endif // UPDATE_ENGINE_COMMON_HARDWARE_ANDROID_H_
diff --git a/hardware_chromeos.cc b/common/hardware_chromeos.cc
similarity index 94%
rename from hardware_chromeos.cc
rename to common/hardware_chromeos.cc
index aac8ef2..ae27e36 100644
--- a/hardware_chromeos.cc
+++ b/common/hardware_chromeos.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/hardware_chromeos.h"
+#include "update_engine/common/hardware_chromeos.h"
#include <base/files/file_util.h>
#include <base/logging.h>
@@ -27,10 +27,10 @@
#include "vboot/vboot_host.h"
}
-#include "update_engine/hardware.h"
-#include "update_engine/hwid_override.h"
-#include "update_engine/subprocess.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/hardware.h"
+#include "update_engine/common/hwid_override.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
using std::string;
using std::vector;
diff --git a/hardware_chromeos.h b/common/hardware_chromeos.h
similarity index 88%
rename from hardware_chromeos.h
rename to common/hardware_chromeos.h
index e7fe486..8ac17e8 100644
--- a/hardware_chromeos.h
+++ b/common/hardware_chromeos.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
-#define UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
+#ifndef UPDATE_ENGINE_COMMON_HARDWARE_CHROMEOS_H_
+#define UPDATE_ENGINE_COMMON_HARDWARE_CHROMEOS_H_
#include <string>
#include <vector>
@@ -23,7 +23,7 @@
#include <base/macros.h>
#include <base/time/time.h>
-#include "update_engine/hardware_interface.h"
+#include "update_engine/common/hardware_interface.h"
namespace chromeos_update_engine {
@@ -51,4 +51,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HARDWARE_CHROMEOS_H_
+#endif // UPDATE_ENGINE_COMMON_HARDWARE_CHROMEOS_H_
diff --git a/hardware_interface.h b/common/hardware_interface.h
similarity index 94%
rename from hardware_interface.h
rename to common/hardware_interface.h
index 46dd058..17ce694 100644
--- a/hardware_interface.h
+++ b/common/hardware_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HARDWARE_INTERFACE_H_
-#define UPDATE_ENGINE_HARDWARE_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_HARDWARE_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_HARDWARE_INTERFACE_H_
#include <string>
#include <vector>
@@ -78,4 +78,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HARDWARE_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_HARDWARE_INTERFACE_H_
diff --git a/omaha_hash_calculator.cc b/common/hash_calculator.cc
similarity index 71%
rename from omaha_hash_calculator.cc
rename to common/hash_calculator.cc
index cb01a56..de6e0f9 100644
--- a/omaha_hash_calculator.cc
+++ b/common/hash_calculator.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/common/hash_calculator.h"
#include <fcntl.h>
@@ -22,21 +22,20 @@
#include <base/posix/eintr_wrapper.h>
#include <brillo/data_encoding.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using std::string;
-using std::vector;
namespace chromeos_update_engine {
-OmahaHashCalculator::OmahaHashCalculator() : valid_(false) {
+HashCalculator::HashCalculator() : valid_(false) {
valid_ = (SHA256_Init(&ctx_) == 1);
LOG_IF(ERROR, !valid_) << "SHA256_Init failed";
}
// Update is called with all of the data that should be hashed in order.
// Mostly just passes the data through to OpenSSL's SHA256_Update()
-bool OmahaHashCalculator::Update(const void* data, size_t length) {
+bool HashCalculator::Update(const void* data, size_t length) {
TEST_AND_RETURN_FALSE(valid_);
TEST_AND_RETURN_FALSE(hash_.empty());
static_assert(sizeof(size_t) <= sizeof(unsigned long), // NOLINT(runtime/int)
@@ -45,7 +44,7 @@
return true;
}
-off_t OmahaHashCalculator::UpdateFile(const string& name, off_t length) {
+off_t HashCalculator::UpdateFile(const string& name, off_t length) {
int fd = HANDLE_EINTR(open(name.c_str(), O_RDONLY));
if (fd < 0) {
return -1;
@@ -75,7 +74,7 @@
// Call Finalize() when all data has been passed in. This mostly just
// calls OpenSSL's SHA256_Final() and then base64 encodes the hash.
-bool OmahaHashCalculator::Finalize() {
+bool HashCalculator::Finalize() {
TEST_AND_RETURN_FALSE(hash_.empty());
TEST_AND_RETURN_FALSE(raw_hash_.empty());
raw_hash_.resize(SHA256_DIGEST_LENGTH);
@@ -87,24 +86,24 @@
return true;
}
-bool OmahaHashCalculator::RawHashOfBytes(const void* data,
- size_t length,
- brillo::Blob* out_hash) {
- OmahaHashCalculator calc;
+bool HashCalculator::RawHashOfBytes(const void* data,
+ size_t length,
+ brillo::Blob* out_hash) {
+ HashCalculator calc;
TEST_AND_RETURN_FALSE(calc.Update(data, length));
TEST_AND_RETURN_FALSE(calc.Finalize());
*out_hash = calc.raw_hash();
return true;
}
-bool OmahaHashCalculator::RawHashOfData(const brillo::Blob& data,
- brillo::Blob* out_hash) {
+bool HashCalculator::RawHashOfData(const brillo::Blob& data,
+ brillo::Blob* out_hash) {
return RawHashOfBytes(data.data(), data.size(), out_hash);
}
-off_t OmahaHashCalculator::RawHashOfFile(const string& name, off_t length,
- brillo::Blob* out_hash) {
- OmahaHashCalculator calc;
+off_t HashCalculator::RawHashOfFile(const string& name, off_t length,
+ brillo::Blob* out_hash) {
+ HashCalculator calc;
off_t res = calc.UpdateFile(name, length);
if (res < 0) {
return res;
@@ -116,26 +115,26 @@
return res;
}
-string OmahaHashCalculator::OmahaHashOfBytes(const void* data, size_t length) {
- OmahaHashCalculator calc;
+string HashCalculator::HashOfBytes(const void* data, size_t length) {
+ HashCalculator calc;
calc.Update(data, length);
calc.Finalize();
return calc.hash();
}
-string OmahaHashCalculator::OmahaHashOfString(const string& str) {
- return OmahaHashOfBytes(str.data(), str.size());
+string HashCalculator::HashOfString(const string& str) {
+ return HashOfBytes(str.data(), str.size());
}
-string OmahaHashCalculator::OmahaHashOfData(const brillo::Blob& data) {
- return OmahaHashOfBytes(data.data(), data.size());
+string HashCalculator::HashOfData(const brillo::Blob& data) {
+ return HashOfBytes(data.data(), data.size());
}
-string OmahaHashCalculator::GetContext() const {
+string HashCalculator::GetContext() const {
return string(reinterpret_cast<const char*>(&ctx_), sizeof(ctx_));
}
-bool OmahaHashCalculator::SetContext(const string& context) {
+bool HashCalculator::SetContext(const string& context) {
TEST_AND_RETURN_FALSE(context.size() == sizeof(ctx_));
memcpy(&ctx_, context.data(), sizeof(ctx_));
return true;
diff --git a/omaha_hash_calculator.h b/common/hash_calculator.h
similarity index 84%
rename from omaha_hash_calculator.h
rename to common/hash_calculator.h
index db2ce94..f749585 100644
--- a/omaha_hash_calculator.h
+++ b/common/hash_calculator.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H_
-#define UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H_
+#ifndef UPDATE_ENGINE_COMMON_HASH_CALCULATOR_H_
+#define UPDATE_ENGINE_COMMON_HASH_CALCULATOR_H_
#include <openssl/sha.h>
#include <unistd.h>
@@ -35,9 +35,9 @@
namespace chromeos_update_engine {
-class OmahaHashCalculator {
+class HashCalculator {
public:
- OmahaHashCalculator();
+ HashCalculator();
// Update is called with all of the data that should be hashed in order.
// Update will read |length| bytes of |data|.
@@ -71,8 +71,8 @@
std::string GetContext() const;
// Sets the current hash context. |context| must the string returned by a
- // previous OmahaHashCalculator::GetContext method call. Returns true on
- // success, and false otherwise.
+ // previous HashCalculator::GetContext method call. Returns true on success,
+ // and false otherwise.
bool SetContext(const std::string& context);
static bool RawHashOfBytes(const void* data,
@@ -84,9 +84,9 @@
brillo::Blob* out_hash);
// Used by tests
- static std::string OmahaHashOfBytes(const void* data, size_t length);
- static std::string OmahaHashOfString(const std::string& str);
- static std::string OmahaHashOfData(const brillo::Blob& data);
+ static std::string HashOfBytes(const void* data, size_t length);
+ static std::string HashOfString(const std::string& str);
+ static std::string HashOfData(const brillo::Blob& data);
private:
// If non-empty, the final base64 encoded hash and the raw hash. Will only be
@@ -99,9 +99,9 @@
// The hash state used by OpenSSL
SHA256_CTX ctx_;
- DISALLOW_COPY_AND_ASSIGN(OmahaHashCalculator);
+ DISALLOW_COPY_AND_ASSIGN(HashCalculator);
};
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_OMAHA_HASH_CALCULATOR_H_
+#endif // UPDATE_ENGINE_COMMON_HASH_CALCULATOR_H_
diff --git a/omaha_hash_calculator_unittest.cc b/common/hash_calculator_unittest.cc
similarity index 79%
rename from omaha_hash_calculator_unittest.cc
rename to common/hash_calculator_unittest.cc
index 5032aa4..27dbc56 100644
--- a/omaha_hash_calculator_unittest.cc
+++ b/common/hash_calculator_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/common/hash_calculator.h"
#include <math.h>
#include <unistd.h>
@@ -25,8 +25,8 @@
#include <brillo/secure_blob.h>
#include <gtest/gtest.h>
-#include "update_engine/libcurl_http_fetcher.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/libcurl_http_fetcher.h"
+#include "update_engine/common/utils.h"
using std::string;
using std::vector;
@@ -44,13 +44,13 @@
0xc8, 0x8b, 0x59, 0xb2, 0xdc, 0x32, 0x7a, 0xa4
};
-class OmahaHashCalculatorTest : public ::testing::Test {
+class HashCalculatorTest : public ::testing::Test {
public:
- OmahaHashCalculatorTest() {}
+ HashCalculatorTest() {}
};
-TEST_F(OmahaHashCalculatorTest, SimpleTest) {
- OmahaHashCalculator calc;
+TEST_F(HashCalculatorTest, SimpleTest) {
+ HashCalculator calc;
calc.Update("hi", 2);
calc.Finalize();
EXPECT_EQ(kExpectedHash, calc.hash());
@@ -59,8 +59,8 @@
EXPECT_TRUE(raw_hash == calc.raw_hash());
}
-TEST_F(OmahaHashCalculatorTest, MultiUpdateTest) {
- OmahaHashCalculator calc;
+TEST_F(HashCalculatorTest, MultiUpdateTest) {
+ HashCalculator calc;
calc.Update("h", 1);
calc.Update("i", 1);
calc.Finalize();
@@ -70,12 +70,12 @@
EXPECT_TRUE(raw_hash == calc.raw_hash());
}
-TEST_F(OmahaHashCalculatorTest, ContextTest) {
- OmahaHashCalculator calc;
+TEST_F(HashCalculatorTest, ContextTest) {
+ HashCalculator calc;
calc.Update("h", 1);
string calc_context = calc.GetContext();
calc.Finalize();
- OmahaHashCalculator calc_next;
+ HashCalculator calc_next;
calc_next.SetContext(calc_context);
calc_next.Update("i", 1);
calc_next.Finalize();
@@ -85,8 +85,8 @@
EXPECT_TRUE(raw_hash == calc_next.raw_hash());
}
-TEST_F(OmahaHashCalculatorTest, BigTest) {
- OmahaHashCalculator calc;
+TEST_F(HashCalculatorTest, BigTest) {
+ HashCalculator calc;
int digit_count = 1;
int next_overflow = 10;
@@ -110,7 +110,7 @@
EXPECT_EQ("NZf8k6SPBkYMvhaX8YgzuMgbkLP1XZ+neM8K5wcSsf8=", calc.hash());
}
-TEST_F(OmahaHashCalculatorTest, UpdateFileSimpleTest) {
+TEST_F(HashCalculatorTest, UpdateFileSimpleTest) {
string data_path;
ASSERT_TRUE(
utils::MakeTempFile("data.XXXXXX", &data_path, nullptr));
@@ -119,7 +119,7 @@
static const int kLengths[] = { -1, 2, 10 };
for (size_t i = 0; i < arraysize(kLengths); i++) {
- OmahaHashCalculator calc;
+ HashCalculator calc;
EXPECT_EQ(2, calc.UpdateFile(data_path, kLengths[i]));
EXPECT_TRUE(calc.Finalize());
EXPECT_EQ(kExpectedHash, calc.hash());
@@ -128,7 +128,7 @@
EXPECT_TRUE(raw_hash == calc.raw_hash());
}
- OmahaHashCalculator calc;
+ HashCalculator calc;
EXPECT_EQ(0, calc.UpdateFile(data_path, 0));
EXPECT_EQ(1, calc.UpdateFile(data_path, 1));
EXPECT_TRUE(calc.Finalize());
@@ -136,7 +136,7 @@
EXPECT_EQ("qqlAJmTxpB9A67xSyZk+tmrrNmYClY/fqig7ceZNsSM=", calc.hash());
}
-TEST_F(OmahaHashCalculatorTest, RawHashOfFileSimpleTest) {
+TEST_F(HashCalculatorTest, RawHashOfFileSimpleTest) {
string data_path;
ASSERT_TRUE(
utils::MakeTempFile("data.XXXXXX", &data_path, nullptr));
@@ -148,25 +148,25 @@
brillo::Blob exp_raw_hash(std::begin(kExpectedRawHash),
std::end(kExpectedRawHash));
brillo::Blob raw_hash;
- EXPECT_EQ(2, OmahaHashCalculator::RawHashOfFile(data_path,
- kLengths[i],
- &raw_hash));
+ EXPECT_EQ(2, HashCalculator::RawHashOfFile(data_path,
+ kLengths[i],
+ &raw_hash));
EXPECT_TRUE(exp_raw_hash == raw_hash);
}
}
-TEST_F(OmahaHashCalculatorTest, UpdateFileNonexistentTest) {
- OmahaHashCalculator calc;
+TEST_F(HashCalculatorTest, UpdateFileNonexistentTest) {
+ HashCalculator calc;
EXPECT_EQ(-1, calc.UpdateFile("/some/non-existent/file", -1));
}
-TEST_F(OmahaHashCalculatorTest, AbortTest) {
+TEST_F(HashCalculatorTest, AbortTest) {
// Just make sure we don't crash and valgrind doesn't detect memory leaks
{
- OmahaHashCalculator calc;
+ HashCalculator calc;
}
{
- OmahaHashCalculator calc;
+ HashCalculator calc;
calc.Update("h", 1);
}
}
diff --git a/http_common.cc b/common/http_common.cc
similarity index 98%
rename from http_common.cc
rename to common/http_common.cc
index d2df454..7d98889 100644
--- a/http_common.cc
+++ b/common/http_common.cc
@@ -16,7 +16,7 @@
// Implementation of common HTTP related functions.
-#include "update_engine/http_common.h"
+#include "update_engine/common/http_common.h"
#include <base/macros.h>
diff --git a/http_common.h b/common/http_common.h
similarity index 94%
rename from http_common.h
rename to common/http_common.h
index f3fe63f..041cad5 100644
--- a/http_common.h
+++ b/common/http_common.h
@@ -17,8 +17,8 @@
// This file contains general definitions used in implementing, testing and
// emulating communication over HTTP.
-#ifndef UPDATE_ENGINE_HTTP_COMMON_H_
-#define UPDATE_ENGINE_HTTP_COMMON_H_
+#ifndef UPDATE_ENGINE_COMMON_HTTP_COMMON_H_
+#define UPDATE_ENGINE_COMMON_HTTP_COMMON_H_
#include <cstdlib>
@@ -71,4 +71,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HTTP_COMMON_H_
+#endif // UPDATE_ENGINE_COMMON_HTTP_COMMON_H_
diff --git a/http_fetcher.cc b/common/http_fetcher.cc
similarity index 97%
rename from http_fetcher.cc
rename to common/http_fetcher.cc
index cfe5f00..400b43c 100644
--- a/http_fetcher.cc
+++ b/common/http_fetcher.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/http_fetcher.h"
+#include "update_engine/common/http_fetcher.h"
#include <base/bind.h>
diff --git a/http_fetcher.h b/common/http_fetcher.h
similarity index 97%
rename from http_fetcher.h
rename to common/http_fetcher.h
index 5ea5724..1d4dba9 100644
--- a/http_fetcher.h
+++ b/common/http_fetcher.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HTTP_FETCHER_H_
-#define UPDATE_ENGINE_HTTP_FETCHER_H_
+#ifndef UPDATE_ENGINE_COMMON_HTTP_FETCHER_H_
+#define UPDATE_ENGINE_COMMON_HTTP_FETCHER_H_
#include <deque>
#include <string>
@@ -26,7 +26,7 @@
#include <base/macros.h>
#include <brillo/message_loops/message_loop.h>
-#include "update_engine/http_common.h"
+#include "update_engine/common/http_common.h"
#include "update_engine/proxy_resolver.h"
#include "update_engine/system_state.h"
@@ -204,4 +204,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HTTP_FETCHER_H_
+#endif // UPDATE_ENGINE_COMMON_HTTP_FETCHER_H_
diff --git a/http_fetcher_unittest.cc b/common/http_fetcher_unittest.cc
similarity index 98%
rename from http_fetcher_unittest.cc
rename to common/http_fetcher_unittest.cc
index df3444c..a6ba9c8 100644
--- a/http_fetcher_unittest.cc
+++ b/common/http_fetcher_unittest.cc
@@ -39,14 +39,14 @@
#include <brillo/streams/stream.h>
#include <gtest/gtest.h>
+#include "update_engine/common/http_common.h"
+#include "update_engine/common/libcurl_http_fetcher.h"
+#include "update_engine/common/mock_http_fetcher.h"
+#include "update_engine/common/multi_range_http_fetcher.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/http_common.h"
-#include "update_engine/libcurl_http_fetcher.h"
-#include "update_engine/mock_http_fetcher.h"
-#include "update_engine/multi_range_http_fetcher.h"
#include "update_engine/proxy_resolver.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using brillo::MessageLoop;
using std::make_pair;
diff --git a/hwid_override.cc b/common/hwid_override.cc
similarity index 95%
rename from hwid_override.cc
rename to common/hwid_override.cc
index f29444f..8800e94 100644
--- a/hwid_override.cc
+++ b/common/hwid_override.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/hwid_override.h"
+#include "update_engine/common/hwid_override.h"
#include <map>
#include <string>
diff --git a/hwid_override.h b/common/hwid_override.h
similarity index 89%
rename from hwid_override.h
rename to common/hwid_override.h
index 16e0e52..d39b572 100644
--- a/hwid_override.h
+++ b/common/hwid_override.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_HWID_OVERRIDE_H_
-#define UPDATE_ENGINE_HWID_OVERRIDE_H_
+#ifndef UPDATE_ENGINE_COMMON_HWID_OVERRIDE_H_
+#define UPDATE_ENGINE_COMMON_HWID_OVERRIDE_H_
#include <map>
#include <string>
@@ -43,4 +43,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_HWID_OVERRIDE_H_
+#endif // UPDATE_ENGINE_COMMON_HWID_OVERRIDE_H_
diff --git a/hwid_override_unittest.cc b/common/hwid_override_unittest.cc
similarity index 97%
rename from hwid_override_unittest.cc
rename to common/hwid_override_unittest.cc
index 05ebe08..fff64bc 100644
--- a/hwid_override_unittest.cc
+++ b/common/hwid_override_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/hwid_override.h"
+#include "update_engine/common/hwid_override.h"
#include <string>
diff --git a/libcurl_http_fetcher.cc b/common/libcurl_http_fetcher.cc
similarity index 98%
rename from libcurl_http_fetcher.cc
rename to common/libcurl_http_fetcher.cc
index 5253214..d36e32b 100644
--- a/libcurl_http_fetcher.cc
+++ b/common/libcurl_http_fetcher.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/libcurl_http_fetcher.h"
+#include "update_engine/common/libcurl_http_fetcher.h"
#include <algorithm>
#include <string>
@@ -26,9 +26,9 @@
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/certificate_checker.h"
-#include "update_engine/hardware_interface.h"
-#include "update_engine/platform_constants.h"
+#include "update_engine/common/certificate_checker.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/platform_constants.h"
using base::TimeDelta;
using brillo::MessageLoop;
diff --git a/libcurl_http_fetcher.h b/common/libcurl_http_fetcher.h
similarity index 96%
rename from libcurl_http_fetcher.h
rename to common/libcurl_http_fetcher.h
index e652e37..52a4111 100644
--- a/libcurl_http_fetcher.h
+++ b/common/libcurl_http_fetcher.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H_
-#define UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H_
+#ifndef UPDATE_ENGINE_COMMON_LIBCURL_HTTP_FETCHER_H_
+#define UPDATE_ENGINE_COMMON_LIBCURL_HTTP_FETCHER_H_
#include <map>
#include <string>
@@ -27,9 +27,9 @@
#include <base/macros.h>
#include <brillo/message_loops/message_loop.h>
-#include "update_engine/certificate_checker.h"
-#include "update_engine/hardware_interface.h"
-#include "update_engine/http_fetcher.h"
+#include "update_engine/common/certificate_checker.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/http_fetcher.h"
#include "update_engine/system_state.h"
@@ -254,4 +254,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_LIBCURL_HTTP_FETCHER_H_
+#endif // UPDATE_ENGINE_COMMON_LIBCURL_HTTP_FETCHER_H_
diff --git a/mock_certificate_checker.h b/common/mock_certificate_checker.h
similarity index 81%
rename from mock_certificate_checker.h
rename to common/mock_certificate_checker.h
index c86f502..1f55ca1 100644
--- a/mock_certificate_checker.h
+++ b/common/mock_certificate_checker.h
@@ -14,13 +14,13 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_CERTIFICATE_CHECKER_H_
-#define UPDATE_ENGINE_MOCK_CERTIFICATE_CHECKER_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_CERTIFICATE_CHECKER_H_
+#define UPDATE_ENGINE_COMMON_MOCK_CERTIFICATE_CHECKER_H_
#include <gmock/gmock.h>
#include <openssl/ssl.h>
-#include "update_engine/certificate_checker.h"
+#include "update_engine/common/certificate_checker.h"
namespace chromeos_update_engine {
@@ -35,4 +35,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_CERTIFICATE_CHECKER_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_CERTIFICATE_CHECKER_H_
diff --git a/mock_hardware.h b/common/mock_hardware.h
similarity index 93%
rename from mock_hardware.h
rename to common/mock_hardware.h
index ff387f4..451af91 100644
--- a/mock_hardware.h
+++ b/common/mock_hardware.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_HARDWARE_H_
-#define UPDATE_ENGINE_MOCK_HARDWARE_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_HARDWARE_H_
+#define UPDATE_ENGINE_COMMON_MOCK_HARDWARE_H_
#include <string>
-#include "update_engine/fake_hardware.h"
+#include "update_engine/common/fake_hardware.h"
#include <gmock/gmock.h>
@@ -87,4 +87,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_HARDWARE_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_HARDWARE_H_
diff --git a/mock_http_fetcher.cc b/common/mock_http_fetcher.cc
similarity index 98%
rename from mock_http_fetcher.cc
rename to common/mock_http_fetcher.cc
index 1a28e45..f556c34 100644
--- a/mock_http_fetcher.cc
+++ b/common/mock_http_fetcher.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/mock_http_fetcher.h"
+#include "update_engine/common/mock_http_fetcher.h"
#include <algorithm>
diff --git a/mock_http_fetcher.h b/common/mock_http_fetcher.h
similarity index 95%
rename from mock_http_fetcher.h
rename to common/mock_http_fetcher.h
index 2515b00..16d0504 100644
--- a/mock_http_fetcher.h
+++ b/common/mock_http_fetcher.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_HTTP_FETCHER_H_
-#define UPDATE_ENGINE_MOCK_HTTP_FETCHER_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_HTTP_FETCHER_H_
+#define UPDATE_ENGINE_COMMON_MOCK_HTTP_FETCHER_H_
#include <string>
#include <vector>
@@ -23,8 +23,8 @@
#include <base/logging.h>
#include <brillo/message_loops/message_loop.h>
+#include "update_engine/common/http_fetcher.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/http_fetcher.h"
#include "update_engine/mock_connection_manager.h"
// This is a mock implementation of HttpFetcher which is useful for testing.
@@ -149,4 +149,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_HTTP_FETCHER_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_HTTP_FETCHER_H_
diff --git a/mock_prefs.h b/common/mock_prefs.h
similarity index 87%
rename from mock_prefs.h
rename to common/mock_prefs.h
index d1a97e8..0e639a2 100644
--- a/mock_prefs.h
+++ b/common/mock_prefs.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MOCK_PREFS_H_
-#define UPDATE_ENGINE_MOCK_PREFS_H_
+#ifndef UPDATE_ENGINE_COMMON_MOCK_PREFS_H_
+#define UPDATE_ENGINE_COMMON_MOCK_PREFS_H_
#include <string>
#include <gmock/gmock.h>
-#include "update_engine/constants.h"
-#include "update_engine/prefs_interface.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/prefs_interface.h"
namespace chromeos_update_engine {
@@ -48,4 +48,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MOCK_PREFS_H_
+#endif // UPDATE_ENGINE_COMMON_MOCK_PREFS_H_
diff --git a/multi_range_http_fetcher.cc b/common/multi_range_http_fetcher.cc
similarity index 97%
rename from multi_range_http_fetcher.cc
rename to common/multi_range_http_fetcher.cc
index 18b2aef..0a97b6e 100644
--- a/multi_range_http_fetcher.cc
+++ b/common/multi_range_http_fetcher.cc
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#include "update_engine/multi_range_http_fetcher.h"
+#include "update_engine/common/multi_range_http_fetcher.h"
#include <base/strings/stringprintf.h>
#include <algorithm>
#include <string>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
namespace chromeos_update_engine {
diff --git a/multi_range_http_fetcher.h b/common/multi_range_http_fetcher.h
similarity index 95%
rename from multi_range_http_fetcher.h
rename to common/multi_range_http_fetcher.h
index 4a2ebb4..265d4cc 100644
--- a/multi_range_http_fetcher.h
+++ b/common/multi_range_http_fetcher.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MULTI_RANGE_HTTP_FETCHER_H_
-#define UPDATE_ENGINE_MULTI_RANGE_HTTP_FETCHER_H_
+#ifndef UPDATE_ENGINE_COMMON_MULTI_RANGE_HTTP_FETCHER_H_
+#define UPDATE_ENGINE_COMMON_MULTI_RANGE_HTTP_FETCHER_H_
#include <deque>
#include <memory>
@@ -23,7 +23,7 @@
#include <utility>
#include <vector>
-#include "update_engine/http_fetcher.h"
+#include "update_engine/common/http_fetcher.h"
// This class is a simple wrapper around an HttpFetcher. The client
// specifies a vector of byte ranges. MultiRangeHttpFetcher will fetch bytes
@@ -177,4 +177,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MULTI_RANGE_HTTP_FETCHER_H_
+#endif // UPDATE_ENGINE_COMMON_MULTI_RANGE_HTTP_FETCHER_H_
diff --git a/platform_constants.h b/common/platform_constants.h
similarity index 92%
rename from platform_constants.h
rename to common/platform_constants.h
index 310eed9..8331064 100644
--- a/platform_constants.h
+++ b/common/platform_constants.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PLATFORM_CONSTANTS_H_
-#define UPDATE_ENGINE_PLATFORM_CONSTANTS_H_
+#ifndef UPDATE_ENGINE_COMMON_PLATFORM_CONSTANTS_H_
+#define UPDATE_ENGINE_COMMON_PLATFORM_CONSTANTS_H_
namespace chromeos_update_engine {
namespace constants {
@@ -50,4 +50,4 @@
} // namespace constants
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PLATFORM_CONSTANTS_H_
+#endif // UPDATE_ENGINE_COMMON_PLATFORM_CONSTANTS_H_
diff --git a/platform_constants_android.cc b/common/platform_constants_android.cc
similarity index 95%
rename from platform_constants_android.cc
rename to common/platform_constants_android.cc
index 02889eb..b6084ac 100644
--- a/platform_constants_android.cc
+++ b/common/platform_constants_android.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/platform_constants.h"
+#include "update_engine/common/platform_constants.h"
namespace chromeos_update_engine {
namespace constants {
diff --git a/platform_constants_chromeos.cc b/common/platform_constants_chromeos.cc
similarity index 95%
rename from platform_constants_chromeos.cc
rename to common/platform_constants_chromeos.cc
index fe67002..45ca309 100644
--- a/platform_constants_chromeos.cc
+++ b/common/platform_constants_chromeos.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/platform_constants.h"
+#include "update_engine/common/platform_constants.h"
namespace chromeos_update_engine {
namespace constants {
diff --git a/prefs.cc b/common/prefs.cc
similarity index 97%
rename from prefs.cc
rename to common/prefs.cc
index 0911555..9d3a30f 100644
--- a/prefs.cc
+++ b/common/prefs.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/prefs.h"
+#include "update_engine/common/prefs.h"
#include <algorithm>
@@ -23,7 +23,7 @@
#include <base/strings/string_number_conversions.h>
#include <base/strings/string_util.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using std::string;
diff --git a/prefs.h b/common/prefs.h
similarity index 93%
rename from prefs.h
rename to common/prefs.h
index 1bcfef8..f11abc3 100644
--- a/prefs.h
+++ b/common/prefs.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PREFS_H_
-#define UPDATE_ENGINE_PREFS_H_
+#ifndef UPDATE_ENGINE_COMMON_PREFS_H_
+#define UPDATE_ENGINE_COMMON_PREFS_H_
#include <map>
#include <string>
@@ -24,7 +24,7 @@
#include <base/files/file_path.h>
#include "gtest/gtest_prod.h" // for FRIEND_TEST
-#include "update_engine/prefs_interface.h"
+#include "update_engine/common/prefs_interface.h"
namespace chromeos_update_engine {
@@ -78,4 +78,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PREFS_H_
+#endif // UPDATE_ENGINE_COMMON_PREFS_H_
diff --git a/prefs_interface.h b/common/prefs_interface.h
similarity index 95%
rename from prefs_interface.h
rename to common/prefs_interface.h
index d409a1f..03ae3ec 100644
--- a/prefs_interface.h
+++ b/common/prefs_interface.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PREFS_INTERFACE_H_
-#define UPDATE_ENGINE_PREFS_INTERFACE_H_
+#ifndef UPDATE_ENGINE_COMMON_PREFS_INTERFACE_H_
+#define UPDATE_ENGINE_COMMON_PREFS_INTERFACE_H_
#include <stdint.h>
@@ -94,4 +94,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PREFS_INTERFACE_H_
+#endif // UPDATE_ENGINE_COMMON_PREFS_INTERFACE_H_
diff --git a/prefs_unittest.cc b/common/prefs_unittest.cc
similarity index 99%
rename from prefs_unittest.cc
rename to common/prefs_unittest.cc
index df356b1..354b05b 100644
--- a/prefs_unittest.cc
+++ b/common/prefs_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/prefs.h"
+#include "update_engine/common/prefs.h"
#include <inttypes.h>
diff --git a/subprocess.cc b/common/subprocess.cc
similarity index 98%
rename from subprocess.cc
rename to common/subprocess.cc
index 59b8e1e..f43aaac 100644
--- a/subprocess.cc
+++ b/common/subprocess.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/subprocess.h"
+#include "update_engine/common/subprocess.h"
#include <fcntl.h>
#include <stdlib.h>
diff --git a/subprocess.h b/common/subprocess.h
similarity index 96%
rename from subprocess.h
rename to common/subprocess.h
index 8c72c31..6b952dc 100644
--- a/subprocess.h
+++ b/common/subprocess.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_SUBPROCESS_H_
-#define UPDATE_ENGINE_SUBPROCESS_H_
+#ifndef UPDATE_ENGINE_COMMON_SUBPROCESS_H_
+#define UPDATE_ENGINE_COMMON_SUBPROCESS_H_
#include <unistd.h>
@@ -138,4 +138,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_SUBPROCESS_H_
+#endif // UPDATE_ENGINE_COMMON_SUBPROCESS_H_
diff --git a/subprocess_unittest.cc b/common/subprocess_unittest.cc
similarity index 98%
rename from subprocess_unittest.cc
rename to common/subprocess_unittest.cc
index af8eec3..b37dc91 100644
--- a/subprocess_unittest.cc
+++ b/common/subprocess_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/subprocess.h"
+#include "update_engine/common/subprocess.h"
#include <fcntl.h>
#include <netinet/in.h>
@@ -42,8 +42,8 @@
#include <brillo/strings/string_utils.h>
#include <gtest/gtest.h>
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
using base::TimeDelta;
using brillo::MessageLoop;
diff --git a/terminator.cc b/common/terminator.cc
similarity index 96%
rename from terminator.cc
rename to common/terminator.cc
index 38a6c6f..62adafd 100644
--- a/terminator.cc
+++ b/common/terminator.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/terminator.h"
+#include "update_engine/common/terminator.h"
#include <cstdlib>
diff --git a/terminator.h b/common/terminator.h
similarity index 93%
rename from terminator.h
rename to common/terminator.h
index 7737ec9..20616f6 100644
--- a/terminator.h
+++ b/common/terminator.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_TERMINATOR_H_
-#define UPDATE_ENGINE_TERMINATOR_H_
+#ifndef UPDATE_ENGINE_COMMON_TERMINATOR_H_
+#define UPDATE_ENGINE_COMMON_TERMINATOR_H_
#include <signal.h>
@@ -62,4 +62,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_TERMINATOR_H_
+#endif // UPDATE_ENGINE_COMMON_TERMINATOR_H_
diff --git a/terminator_unittest.cc b/common/terminator_unittest.cc
similarity index 97%
rename from terminator_unittest.cc
rename to common/terminator_unittest.cc
index 4d96a5d..5e8302f 100644
--- a/terminator_unittest.cc
+++ b/common/terminator_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/terminator.h"
+#include "update_engine/common/terminator.h"
#include <gtest/gtest.h>
#include <gtest/gtest-spi.h>
diff --git a/test_utils.cc b/common/test_utils.cc
similarity index 98%
rename from test_utils.cc
rename to common/test_utils.cc
index 036b729..f89c448 100644
--- a/test_utils.cc
+++ b/common/test_utils.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/test_utils.h"
+#include "update_engine/common/test_utils.h"
#include <dirent.h>
#include <errno.h>
@@ -35,8 +35,8 @@
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/file_writer.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/file_writer.h"
using base::StringPrintf;
using std::set;
diff --git a/test_utils.h b/common/test_utils.h
similarity index 96%
rename from test_utils.h
rename to common/test_utils.h
index 91ebcd4..616bdd3 100644
--- a/test_utils.h
+++ b/common/test_utils.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_TEST_UTILS_H_
-#define UPDATE_ENGINE_TEST_UTILS_H_
+#ifndef UPDATE_ENGINE_COMMON_TEST_UTILS_H_
+#define UPDATE_ENGINE_COMMON_TEST_UTILS_H_
#include <sys/stat.h>
#include <sys/types.h>
@@ -32,10 +32,10 @@
#include <base/files/file_path.h>
#include <gtest/gtest.h>
-#include "update_engine/action.h"
-#include "update_engine/subprocess.h"
+#include "update_engine/common/action.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
// These are some handy functions for unittests.
@@ -268,4 +268,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_TEST_UTILS_H_
+#endif // UPDATE_ENGINE_COMMON_TEST_UTILS_H_
diff --git a/utils.cc b/common/utils.cc
similarity index 98%
rename from utils.cc
rename to common/utils.cc
index 476f307..dd08a89 100644
--- a/utils.cc
+++ b/common/utils.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
#include <stdint.h>
@@ -54,13 +54,13 @@
#include <brillo/data_encoding.h>
#include <brillo/message_loops/message_loop.h>
-#include "update_engine/clock_interface.h"
-#include "update_engine/constants.h"
-#include "update_engine/file_descriptor.h"
-#include "update_engine/file_writer.h"
+#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/subprocess.h"
#include "update_engine/omaha_request_params.h"
-#include "update_engine/prefs_interface.h"
-#include "update_engine/subprocess.h"
+#include "update_engine/payload_consumer/file_descriptor.h"
+#include "update_engine/payload_consumer/file_writer.h"
#include "update_engine/system_state.h"
#include "update_engine/update_attempter.h"
diff --git a/utils.h b/common/utils.h
similarity index 98%
rename from utils.h
rename to common/utils.h
index 12197e8..b50cabf 100644
--- a/utils.h
+++ b/common/utils.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_UTILS_H_
-#define UPDATE_ENGINE_UTILS_H_
+#ifndef UPDATE_ENGINE_COMMON_UTILS_H_
+#define UPDATE_ENGINE_COMMON_UTILS_H_
#include <errno.h>
#include <unistd.h>
@@ -34,12 +34,12 @@
#include <brillo/secure_blob.h>
#include "metrics/metrics_library.h"
-#include "update_engine/action.h"
-#include "update_engine/action_processor.h"
+#include "update_engine/common/action.h"
+#include "update_engine/common/action_processor.h"
+#include "update_engine/common/constants.h"
#include "update_engine/connection_manager_interface.h"
-#include "update_engine/constants.h"
-#include "update_engine/file_descriptor.h"
#include "update_engine/metrics.h"
+#include "update_engine/payload_consumer/file_descriptor.h"
#include "update_engine/update_metadata.pb.h"
namespace chromeos_update_engine {
@@ -551,4 +551,4 @@
} \
} while (0)
-#endif // UPDATE_ENGINE_UTILS_H_
+#endif // UPDATE_ENGINE_COMMON_UTILS_H_
diff --git a/utils_unittest.cc b/common/utils_unittest.cc
similarity index 98%
rename from utils_unittest.cc
rename to common/utils_unittest.cc
index 2bdb76b..2fd58e9 100644
--- a/utils_unittest.cc
+++ b/common/utils_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
#include <errno.h>
#include <stdint.h>
@@ -34,11 +34,11 @@
#include <brillo/message_loops/message_loop_utils.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_clock.h"
-#include "update_engine/fake_prefs.h"
+#include "update_engine/common/fake_clock.h"
+#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/test_utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/prefs.h"
-#include "update_engine/test_utils.h"
using brillo::FakeMessageLoop;
using std::map;
diff --git a/connection_manager.cc b/connection_manager.cc
index 4440c4f..778cba5 100644
--- a/connection_manager.cc
+++ b/connection_manager.cc
@@ -25,9 +25,9 @@
#include <shill/dbus-constants.h>
#include <shill/dbus-proxies.h>
-#include "update_engine/prefs.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/utils.h"
#include "update_engine/system_state.h"
-#include "update_engine/utils.h"
using org::chromium::flimflam::ManagerProxyInterface;
using org::chromium::flimflam::ServiceProxyInterface;
diff --git a/connection_manager_unittest.cc b/connection_manager_unittest.cc
index 5bd7179..612929b 100644
--- a/connection_manager_unittest.cc
+++ b/connection_manager_unittest.cc
@@ -30,9 +30,9 @@
#include <shill/dbus-proxies.h>
#include <shill/dbus-proxy-mocks.h>
+#include "update_engine/common/test_utils.h"
#include "update_engine/fake_shill_proxy.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/test_utils.h"
using org::chromium::flimflam::ManagerProxyMock;
using org::chromium::flimflam::ServiceProxyMock;
diff --git a/daemon.cc b/daemon.cc
index 529af58..f37eebb 100644
--- a/daemon.cc
+++ b/daemon.cc
@@ -23,7 +23,7 @@
#include <base/time/time.h>
#include <brillo/message_loops/message_loop.h>
-#include "update_engine/clock.h"
+#include "update_engine/common/clock.h"
#include "update_engine/update_attempter.h"
using brillo::MessageLoop;
diff --git a/daemon.h b/daemon.h
index 01961bc..317cc18 100644
--- a/daemon.h
+++ b/daemon.h
@@ -22,10 +22,10 @@
#include <brillo/daemons/dbus_daemon.h>
-#include "update_engine/certificate_checker.h"
+#include "update_engine/common/certificate_checker.h"
+#include "update_engine/common/subprocess.h"
#include "update_engine/dbus_service.h"
#include "update_engine/real_system_state.h"
-#include "update_engine/subprocess.h"
namespace chromeos_update_engine {
diff --git a/dbus_service.cc b/dbus_service.cc
index 16b10d4..6ed31d4 100644
--- a/dbus_service.cc
+++ b/dbus_service.cc
@@ -28,14 +28,14 @@
#include <policy/device_policy.h>
#include <update_engine/dbus-constants.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/utils.h"
#include "update_engine/connection_manager_interface.h"
-#include "update_engine/hardware_interface.h"
#include "update_engine/omaha_request_params.h"
#include "update_engine/p2p_manager.h"
-#include "update_engine/prefs.h"
#include "update_engine/update_attempter.h"
-#include "update_engine/utils.h"
using base::StringPrintf;
using brillo::ErrorPtr;
diff --git a/fake_file_writer.h b/fake_file_writer.h
index 452b9d2..43b71c7 100644
--- a/fake_file_writer.h
+++ b/fake_file_writer.h
@@ -22,7 +22,7 @@
#include <base/macros.h>
#include <brillo/secure_blob.h>
-#include "update_engine/file_writer.h"
+#include "update_engine/payload_consumer/file_writer.h"
// FakeFileWriter is an implementation of FileWriter. It will succeed
// calls to Open(), Close(), but not do any work. All calls to Write()
diff --git a/fake_p2p_manager_configuration.h b/fake_p2p_manager_configuration.h
index 8563d6e..3d3afe4 100644
--- a/fake_p2p_manager_configuration.h
+++ b/fake_p2p_manager_configuration.h
@@ -17,17 +17,17 @@
#ifndef UPDATE_ENGINE_FAKE_P2P_MANAGER_CONFIGURATION_H_
#define UPDATE_ENGINE_FAKE_P2P_MANAGER_CONFIGURATION_H_
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/p2p_manager.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
#include <string>
#include <vector>
-#include <base/logging.h>
#include <base/files/file_util.h>
-#include <base/strings/string_util.h>
+#include <base/logging.h>
#include <base/strings/string_number_conversions.h>
+#include <base/strings/string_util.h>
namespace chromeos_update_engine {
diff --git a/fake_system_state.h b/fake_system_state.h
index ce283df..75ef315 100644
--- a/fake_system_state.h
+++ b/fake_system_state.h
@@ -24,14 +24,14 @@
#include <power_manager/dbus-proxy-mocks.h>
#include "metrics/metrics_library_mock.h"
-#include "update_engine/fake_boot_control.h"
-#include "update_engine/fake_clock.h"
-#include "update_engine/fake_hardware.h"
+#include "update_engine/common/fake_boot_control.h"
+#include "update_engine/common/fake_clock.h"
+#include "update_engine/common/fake_hardware.h"
+#include "update_engine/common/mock_prefs.h"
#include "update_engine/mock_connection_manager.h"
#include "update_engine/mock_omaha_request_params.h"
#include "update_engine/mock_p2p_manager.h"
#include "update_engine/mock_payload_state.h"
-#include "update_engine/mock_prefs.h"
#include "update_engine/mock_update_attempter.h"
#include "update_engine/system_state.h"
#include "update_engine/update_manager/fake_update_manager.h"
diff --git a/image_properties_android.cc b/image_properties_android.cc
index dea6166..00822da 100644
--- a/image_properties_android.cc
+++ b/image_properties_android.cc
@@ -21,10 +21,10 @@
#include <base/logging.h>
#include <brillo/osrelease_reader.h>
-#include "update_engine/boot_control_interface.h"
-#include "update_engine/constants.h"
-#include "update_engine/platform_constants.h"
-#include "update_engine/prefs_interface.h"
+#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/prefs_interface.h"
#include "update_engine/system_state.h"
namespace chromeos_update_engine {
diff --git a/image_properties_chromeos.cc b/image_properties_chromeos.cc
index ab689f5..501e662 100644
--- a/image_properties_chromeos.cc
+++ b/image_properties_chromeos.cc
@@ -23,9 +23,9 @@
#include <base/logging.h>
#include <brillo/key_value_store.h>
-#include "update_engine/constants.h"
-#include "update_engine/hardware_interface.h"
-#include "update_engine/platform_constants.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/platform_constants.h"
#include "update_engine/system_state.h"
namespace {
diff --git a/main.cc b/main.cc
index 7b2ac19..468de29 100644
--- a/main.cc
+++ b/main.cc
@@ -31,9 +31,9 @@
#include <brillo/message_loops/base_message_loop.h>
#include <metrics/metrics_library.h>
+#include "update_engine/common/terminator.h"
+#include "update_engine/common/utils.h"
#include "update_engine/daemon.h"
-#include "update_engine/terminator.h"
-#include "update_engine/utils.h"
using std::string;
diff --git a/metrics.cc b/metrics.cc
index f2c823e..626897a 100644
--- a/metrics.cc
+++ b/metrics.cc
@@ -20,11 +20,11 @@
#include <base/logging.h>
-#include "update_engine/clock_interface.h"
-#include "update_engine/constants.h"
-#include "update_engine/prefs_interface.h"
+#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/utils.h"
#include "update_engine/system_state.h"
-#include "update_engine/utils.h"
using std::string;
diff --git a/metrics.h b/metrics.h
index 0b62978..cd368d6 100644
--- a/metrics.h
+++ b/metrics.h
@@ -19,8 +19,8 @@
#include <base/time/time.h>
-#include "update_engine/constants.h"
-#include "update_engine/error_code.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/error_code.h"
namespace chromeos_update_engine {
diff --git a/mock_action.h b/mock_action.h
index 5c83bb1..0ba796d 100644
--- a/mock_action.h
+++ b/mock_action.h
@@ -21,7 +21,7 @@
#include <gmock/gmock.h>
-#include "update_engine/action.h"
+#include "update_engine/common/action.h"
namespace chromeos_update_engine {
diff --git a/mock_action_processor.h b/mock_action_processor.h
index 1e203c0..c98ff3c 100644
--- a/mock_action_processor.h
+++ b/mock_action_processor.h
@@ -19,7 +19,7 @@
#include <gmock/gmock.h>
-#include "update_engine/action.h"
+#include "update_engine/common/action.h"
namespace chromeos_update_engine {
diff --git a/mock_file_writer.h b/mock_file_writer.h
index 0d97e33..72d6a86 100644
--- a/mock_file_writer.h
+++ b/mock_file_writer.h
@@ -18,7 +18,7 @@
#define UPDATE_ENGINE_MOCK_FILE_WRITER_H_
#include <gmock/gmock.h>
-#include "update_engine/file_writer.h"
+#include "update_engine/payload_consumer/file_writer.h"
namespace chromeos_update_engine {
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index cc762c8..7a269f8 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -32,17 +32,17 @@
#include <base/time/time.h>
#include <expat.h>
-#include "update_engine/action_pipe.h"
+#include "update_engine/common/action_pipe.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/utils.h"
#include "update_engine/connection_manager.h"
-#include "update_engine/constants.h"
-#include "update_engine/hardware_interface.h"
-#include "update_engine/omaha_hash_calculator.h"
#include "update_engine/omaha_request_params.h"
#include "update_engine/p2p_manager.h"
#include "update_engine/payload_state_interface.h"
-#include "update_engine/platform_constants.h"
-#include "update_engine/prefs_interface.h"
-#include "update_engine/utils.h"
using base::Time;
using base::TimeDelta;
diff --git a/omaha_request_action.h b/omaha_request_action.h
index 57ef250..36d233c 100644
--- a/omaha_request_action.h
+++ b/omaha_request_action.h
@@ -28,8 +28,8 @@
#include <brillo/secure_blob.h>
#include <curl/curl.h>
-#include "update_engine/action.h"
-#include "update_engine/http_fetcher.h"
+#include "update_engine/common/action.h"
+#include "update_engine/common/http_fetcher.h"
#include "update_engine/omaha_response.h"
// The Omaha Request action makes a request to Omaha and can output
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index aa62271..56c7b7d 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -33,18 +33,18 @@
#include <brillo/message_loops/message_loop_utils.h>
#include <gtest/gtest.h>
-#include "update_engine/action_pipe.h"
-#include "update_engine/constants.h"
-#include "update_engine/fake_prefs.h"
+#include "update_engine/common/action_pipe.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/mock_http_fetcher.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/mock_connection_manager.h"
-#include "update_engine/mock_http_fetcher.h"
#include "update_engine/mock_payload_state.h"
-#include "update_engine/omaha_hash_calculator.h"
#include "update_engine/omaha_request_params.h"
-#include "update_engine/platform_constants.h"
-#include "update_engine/prefs.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using base::Time;
using base::TimeDelta;
diff --git a/omaha_request_params.cc b/omaha_request_params.cc
index ef137b4..d0011f7 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -31,11 +31,11 @@
#include <brillo/strings/string_utils.h>
#include <policy/device_policy.h>
-#include "update_engine/constants.h"
-#include "update_engine/hardware_interface.h"
-#include "update_engine/platform_constants.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/utils.h"
#include "update_engine/system_state.h"
-#include "update_engine/utils.h"
#define CALL_MEMBER_FN(object, member) ((object).*(member))
diff --git a/omaha_request_params.h b/omaha_request_params.h
index 90cbc6e..b4534a1 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -25,8 +25,8 @@
#include <base/time/time.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
+#include "update_engine/common/platform_constants.h"
#include "update_engine/image_properties.h"
-#include "update_engine/platform_constants.h"
// This gathers local system information and prepares info used by the
// Omaha request action.
diff --git a/omaha_request_params_unittest.cc b/omaha_request_params_unittest.cc
index 7ee8d98..33dd6d5 100644
--- a/omaha_request_params_unittest.cc
+++ b/omaha_request_params_unittest.cc
@@ -23,12 +23,12 @@
#include <base/files/file_util.h>
#include <gtest/gtest.h>
-#include "update_engine/constants.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/install_plan.h"
-#include "update_engine/platform_constants.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/payload_consumer/install_plan.h"
using chromeos_update_engine::test_utils::WriteFileString;
using std::string;
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index a58ccfc..3fa9348 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -22,14 +22,14 @@
#include <base/strings/string_util.h>
#include <policy/device_policy.h>
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/utils.h"
#include "update_engine/connection_manager_interface.h"
-#include "update_engine/constants.h"
-#include "update_engine/delta_performer.h"
-#include "update_engine/hardware_interface.h"
#include "update_engine/omaha_request_params.h"
+#include "update_engine/payload_consumer/delta_performer.h"
#include "update_engine/payload_state_interface.h"
-#include "update_engine/prefs_interface.h"
-#include "update_engine/utils.h"
using std::string;
diff --git a/omaha_response_handler_action.h b/omaha_response_handler_action.h
index 3cdeb67..51dfa7a 100644
--- a/omaha_response_handler_action.h
+++ b/omaha_response_handler_action.h
@@ -21,9 +21,9 @@
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include "update_engine/action.h"
-#include "update_engine/install_plan.h"
+#include "update_engine/common/action.h"
#include "update_engine/omaha_request_action.h"
+#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/system_state.h"
// This class reads in an Omaha response and converts what it sees into
diff --git a/omaha_response_handler_action_unittest.cc b/omaha_response_handler_action_unittest.cc
index eb6a5af..b996d38 100644
--- a/omaha_response_handler_action_unittest.cc
+++ b/omaha_response_handler_action_unittest.cc
@@ -21,13 +21,13 @@
#include <base/files/file_util.h>
#include <gtest/gtest.h>
-#include "update_engine/constants.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
#include "update_engine/mock_payload_state.h"
-#include "update_engine/payload_constants.h"
-#include "update_engine/platform_constants.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
using chromeos_update_engine::test_utils::System;
using chromeos_update_engine::test_utils::WriteFileString;
diff --git a/p2p_manager.cc b/p2p_manager.cc
index 96aaaaf..658630c 100644
--- a/p2p_manager.cc
+++ b/p2p_manager.cc
@@ -47,10 +47,10 @@
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/subprocess.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
#include "update_engine/update_manager/policy.h"
#include "update_engine/update_manager/update_manager.h"
-#include "update_engine/utils.h"
using base::Bind;
using base::Callback;
diff --git a/p2p_manager.h b/p2p_manager.h
index b87b197..4ffab9a 100644
--- a/p2p_manager.h
+++ b/p2p_manager.h
@@ -27,8 +27,8 @@
#include <policy/device_policy.h>
#include <policy/libpolicy.h>
-#include "update_engine/clock_interface.h"
-#include "update_engine/prefs_interface.h"
+#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/prefs_interface.h"
#include "update_engine/update_manager/update_manager.h"
namespace chromeos_update_engine {
diff --git a/p2p_manager_unittest.cc b/p2p_manager_unittest.cc
index 98cf366..463c0e2 100644
--- a/p2p_manager_unittest.cc
+++ b/p2p_manager_unittest.cc
@@ -41,13 +41,13 @@
#include <policy/libpolicy.h>
#include <policy/mock_device_policy.h>
-#include "update_engine/fake_clock.h"
+#include "update_engine/common/fake_clock.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_p2p_manager_configuration.h"
-#include "update_engine/prefs.h"
-#include "update_engine/test_utils.h"
#include "update_engine/update_manager/fake_update_manager.h"
#include "update_engine/update_manager/mock_policy.h"
-#include "update_engine/utils.h"
using base::TimeDelta;
using brillo::MessageLoop;
diff --git a/bzip_extent_writer.cc b/payload_consumer/bzip_extent_writer.cc
similarity index 97%
rename from bzip_extent_writer.cc
rename to payload_consumer/bzip_extent_writer.cc
index 4fe7148..0fcc8ba 100644
--- a/bzip_extent_writer.cc
+++ b/payload_consumer/bzip_extent_writer.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/bzip_extent_writer.h"
+#include "update_engine/payload_consumer/bzip_extent_writer.h"
using std::vector;
diff --git a/bzip_extent_writer.h b/payload_consumer/bzip_extent_writer.h
similarity index 84%
rename from bzip_extent_writer.h
rename to payload_consumer/bzip_extent_writer.h
index c467670..0ad542e 100644
--- a/bzip_extent_writer.h
+++ b/payload_consumer/bzip_extent_writer.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BZIP_EXTENT_WRITER_H_
-#define UPDATE_ENGINE_BZIP_EXTENT_WRITER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_BZIP_EXTENT_WRITER_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_BZIP_EXTENT_WRITER_H_
#include <bzlib.h>
#include <memory>
@@ -23,8 +23,8 @@
#include <brillo/secure_blob.h>
-#include "update_engine/extent_writer.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/extent_writer.h"
// BzipExtentWriter is a concrete ExtentWriter subclass that bzip-decompresses
// what it's given in Write. It passes the decompressed data to an underlying
@@ -54,4 +54,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BZIP_EXTENT_WRITER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_BZIP_EXTENT_WRITER_H_
diff --git a/bzip_extent_writer_unittest.cc b/payload_consumer/bzip_extent_writer_unittest.cc
similarity index 96%
rename from bzip_extent_writer_unittest.cc
rename to payload_consumer/bzip_extent_writer_unittest.cc
index d84019a..a52a286 100644
--- a/bzip_extent_writer_unittest.cc
+++ b/payload_consumer/bzip_extent_writer_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/bzip_extent_writer.h"
+#include "update_engine/payload_consumer/bzip_extent_writer.h"
#include <fcntl.h>
#include <sys/stat.h>
@@ -28,8 +28,8 @@
#include <brillo/make_unique_ptr.h>
#include <gtest/gtest.h>
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
using std::min;
using std::string;
diff --git a/delta_performer.cc b/payload_consumer/delta_performer.cc
similarity index 98%
rename from delta_performer.cc
rename to payload_consumer/delta_performer.cc
index c4dc2e4..1df5214 100644
--- a/delta_performer.cc
+++ b/payload_consumer/delta_performer.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/delta_performer.h"
+#include "update_engine/payload_consumer/delta_performer.h"
#include <endian.h>
#include <errno.h>
@@ -34,21 +34,21 @@
#include <brillo/make_unique_ptr.h>
#include <google/protobuf/repeated_field.h>
-#include "update_engine/bzip_extent_writer.h"
-#include "update_engine/constants.h"
-#include "update_engine/extent_writer.h"
-#include "update_engine/hardware_interface.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/payload_consumer/bzip_extent_writer.h"
+#include "update_engine/payload_consumer/extent_writer.h"
#if USE_MTD
-#include "update_engine/mtd_file_descriptor.h"
+#include "update_engine/payload_consumer/mtd_file_descriptor.h"
#endif
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/terminator.h"
+#include "update_engine/payload_consumer/payload_constants.h"
+#include "update_engine/payload_consumer/payload_verifier.h"
+#include "update_engine/payload_consumer/xz_extent_writer.h"
#include "update_engine/payload_state_interface.h"
-#include "update_engine/payload_verifier.h"
-#include "update_engine/prefs_interface.h"
-#include "update_engine/subprocess.h"
-#include "update_engine/terminator.h"
#include "update_engine/update_attempter.h"
-#include "update_engine/xz_extent_writer.h"
using google::protobuf::RepeatedPtrField;
using std::min;
@@ -327,7 +327,7 @@
<< " size: " << info.size();
}
-void LogPartitionInfo(const std::vector<PartitionUpdate>& partitions) {
+void LogPartitionInfo(const vector<PartitionUpdate>& partitions) {
for (const PartitionUpdate& partition : partitions) {
LogPartitionInfoHash(partition.old_partition_info(),
"old " + partition.partition_name());
@@ -1262,7 +1262,7 @@
LOG(INFO) << "Verifying metadata hash signature using public key: "
<< path_to_public_key.value();
- OmahaHashCalculator metadata_hasher;
+ HashCalculator metadata_hasher;
metadata_hasher.Update(payload.data(), metadata_size_);
if (!metadata_hasher.Finalize()) {
LOG(ERROR) << "Unable to compute actual hash of manifest";
@@ -1411,7 +1411,7 @@
(operation.data_sha256_hash().data() +
operation.data_sha256_hash().size()));
- OmahaHashCalculator operation_hasher;
+ HashCalculator operation_hasher;
operation_hasher.Update(buffer_.data(), operation.data_length());
if (!operation_hasher.Finalize()) {
LOG(ERROR) << "Unable to compute actual hash of operation "
diff --git a/delta_performer.h b/payload_consumer/delta_performer.h
similarity index 96%
rename from delta_performer.h
rename to payload_consumer/delta_performer.h
index 6bd9d95..db938c1 100644
--- a/delta_performer.h
+++ b/payload_consumer/delta_performer.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DELTA_PERFORMER_H_
-#define UPDATE_ENGINE_DELTA_PERFORMER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_DELTA_PERFORMER_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_DELTA_PERFORMER_H_
#include <inttypes.h>
@@ -27,11 +27,11 @@
#include <google/protobuf/repeated_field.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include "update_engine/file_descriptor.h"
-#include "update_engine/file_writer.h"
-#include "update_engine/install_plan.h"
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/platform_constants.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/payload_consumer/file_descriptor.h"
+#include "update_engine/payload_consumer/file_writer.h"
+#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/system_state.h"
#include "update_engine/update_metadata.pb.h"
@@ -352,12 +352,12 @@
uint32_t block_size_{0};
// Calculates the whole payload file hash, including headers and signatures.
- OmahaHashCalculator payload_hash_calculator_;
+ HashCalculator payload_hash_calculator_;
// Calculates the hash of the portion of the payload signed by the payload
// signature. This hash skips the metadata signature portion, located after
// the metadata and doesn't include the payload signature itself.
- OmahaHashCalculator signed_hash_calculator_;
+ HashCalculator signed_hash_calculator_;
// Signatures message blob extracted directly from the payload.
brillo::Blob signatures_message_data_;
@@ -393,4 +393,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DELTA_PERFORMER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_DELTA_PERFORMER_H_
diff --git a/delta_performer_integration_test.cc b/payload_consumer/delta_performer_integration_test.cc
similarity index 97%
rename from delta_performer_integration_test.cc
rename to payload_consumer/delta_performer_integration_test.cc
index a14383c..728e12e 100644
--- a/delta_performer_integration_test.cc
+++ b/payload_consumer/delta_performer_integration_test.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/delta_performer.h"
+#include "update_engine/payload_consumer/delta_performer.h"
#include <inttypes.h>
#include <sys/mount.h>
@@ -30,17 +30,17 @@
#include <google/protobuf/repeated_field.h>
#include <gtest/gtest.h>
-#include "update_engine/constants.h"
-#include "update_engine/fake_hardware.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/fake_hardware.h"
+#include "update_engine/common/mock_prefs.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_prefs.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
+#include "update_engine/payload_consumer/payload_verifier.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/payload_signer.h"
-#include "update_engine/payload_verifier.h"
-#include "update_engine/test_utils.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
namespace chromeos_update_engine {
@@ -157,7 +157,7 @@
static size_t GetSignatureSize(const string& private_key_path) {
const brillo::Blob data(1, 'x');
brillo::Blob hash;
- EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(data, &hash));
+ EXPECT_TRUE(HashCalculator::RawHashOfData(data, &hash));
brillo::Blob signature;
EXPECT_TRUE(PayloadSigner::SignHash(hash,
private_key_path,
@@ -738,11 +738,11 @@
DeltaPerformerIntegrationTest::SetSupportedVersion(*performer, minor_version);
EXPECT_EQ(state->image_size,
- OmahaHashCalculator::RawHashOfFile(
+ HashCalculator::RawHashOfFile(
state->a_img,
state->image_size,
&root_part.source_hash));
- EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(
+ EXPECT_TRUE(HashCalculator::RawHashOfData(
state->old_kernel_data,
&kernel_part.source_hash));
@@ -843,7 +843,7 @@
LOG(INFO) << "Verifying payload for expected result "
<< expected_result;
EXPECT_EQ(expected_result, performer->VerifyPayload(
- OmahaHashCalculator::OmahaHashOfData(state->delta),
+ HashCalculator::HashOfData(state->delta),
state->delta.size()));
LOG(INFO) << "Verified payload.";
@@ -879,16 +879,16 @@
EXPECT_EQ(kDefaultKernelSize, partitions[1].target_size);
brillo::Blob expected_new_kernel_hash;
- EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(state->new_kernel_data,
- &expected_new_kernel_hash));
+ EXPECT_TRUE(HashCalculator::RawHashOfData(state->new_kernel_data,
+ &expected_new_kernel_hash));
EXPECT_EQ(expected_new_kernel_hash, partitions[1].target_hash);
EXPECT_EQ(state->image_size, partitions[0].target_size);
brillo::Blob expected_new_rootfs_hash;
EXPECT_EQ(state->image_size,
- OmahaHashCalculator::RawHashOfFile(state->b_img,
- state->image_size,
- &expected_new_rootfs_hash));
+ HashCalculator::RawHashOfFile(state->b_img,
+ state->image_size,
+ &expected_new_rootfs_hash));
EXPECT_EQ(expected_new_rootfs_hash, partitions[0].target_hash);
}
diff --git a/delta_performer_unittest.cc b/payload_consumer/delta_performer_unittest.cc
similarity index 98%
rename from delta_performer_unittest.cc
rename to payload_consumer/delta_performer_unittest.cc
index 7a8cdcf..c0a1a57 100644
--- a/delta_performer_unittest.cc
+++ b/payload_consumer/delta_performer_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/delta_performer.h"
+#include "update_engine/payload_consumer/delta_performer.h"
#include <inttypes.h>
@@ -29,18 +29,18 @@
#include <google/protobuf/repeated_field.h>
#include <gtest/gtest.h>
-#include "update_engine/constants.h"
-#include "update_engine/fake_hardware.h"
-#include "update_engine/fake_prefs.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/fake_hardware.h"
+#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/bzip.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/payload_file.h"
#include "update_engine/payload_generator/payload_signer.h"
-#include "update_engine/test_utils.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
namespace chromeos_update_engine {
diff --git a/download_action.cc b/payload_consumer/download_action.cc
similarity index 97%
rename from download_action.cc
rename to payload_consumer/download_action.cc
index 97bdd12..0136f49 100644
--- a/download_action.cc
+++ b/payload_consumer/download_action.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/download_action.h"
+#include "update_engine/payload_consumer/download_action.h"
#include <errno.h>
@@ -25,12 +25,12 @@
#include <base/files/file_path.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/action_pipe.h"
-#include "update_engine/boot_control_interface.h"
+#include "update_engine/common/action_pipe.h"
+#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/utils.h"
#include "update_engine/omaha_request_params.h"
#include "update_engine/p2p_manager.h"
#include "update_engine/payload_state_interface.h"
-#include "update_engine/utils.h"
using base::FilePath;
using std::string;
diff --git a/download_action.h b/payload_consumer/download_action.h
similarity index 92%
rename from download_action.h
rename to payload_consumer/download_action.h
index 2a8fab2..c0f0688 100644
--- a/download_action.h
+++ b/payload_consumer/download_action.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_DOWNLOAD_ACTION_H_
-#define UPDATE_ENGINE_DOWNLOAD_ACTION_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_DOWNLOAD_ACTION_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_DOWNLOAD_ACTION_H_
#include <fcntl.h>
#include <sys/stat.h>
@@ -26,10 +26,10 @@
#include <curl/curl.h>
-#include "update_engine/action.h"
-#include "update_engine/delta_performer.h"
-#include "update_engine/http_fetcher.h"
-#include "update_engine/install_plan.h"
+#include "update_engine/common/action.h"
+#include "update_engine/common/http_fetcher.h"
+#include "update_engine/payload_consumer/delta_performer.h"
+#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/system_state.h"
// The Download Action downloads a specified url to disk. The url should point
@@ -163,4 +163,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_DOWNLOAD_ACTION_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_DOWNLOAD_ACTION_H_
diff --git a/download_action_unittest.cc b/payload_consumer/download_action_unittest.cc
similarity index 97%
rename from download_action_unittest.cc
rename to payload_consumer/download_action_unittest.cc
index 250d7cb..3bef196 100644
--- a/download_action_unittest.cc
+++ b/payload_consumer/download_action_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/download_action.h"
+#include "update_engine/payload_consumer/download_action.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -33,15 +33,15 @@
#include <brillo/message_loops/fake_message_loop.h>
#include <brillo/message_loops/message_loop.h>
-#include "update_engine/action_pipe.h"
+#include "update_engine/common/action_pipe.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/mock_http_fetcher.h"
+#include "update_engine/common/mock_prefs.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_p2p_manager_configuration.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_http_fetcher.h"
-#include "update_engine/mock_prefs.h"
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/test_utils.h"
#include "update_engine/update_manager/fake_update_manager.h"
-#include "update_engine/utils.h"
namespace chromeos_update_engine {
@@ -145,8 +145,7 @@
writer.set_fail_write(fail_write);
// We pull off the first byte from data and seek past it.
- string hash =
- OmahaHashCalculator::OmahaHashOfBytes(&data[1], data.size() - 1);
+ string hash = HashCalculator::HashOfBytes(&data[1], data.size() - 1);
uint64_t size = data.size();
InstallPlan install_plan(false,
false,
@@ -382,7 +381,7 @@
false,
"",
1,
- OmahaHashCalculator::OmahaHashOfString("x"),
+ HashCalculator::HashOfString("x"),
0,
"",
"");
diff --git a/extent_writer.cc b/payload_consumer/extent_writer.cc
similarity index 93%
rename from extent_writer.cc
rename to payload_consumer/extent_writer.cc
index 50767b9..5501e22 100644
--- a/extent_writer.cc
+++ b/payload_consumer/extent_writer.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/extent_writer.h"
+#include "update_engine/payload_consumer/extent_writer.h"
#include <errno.h>
#include <sys/types.h>
@@ -22,8 +22,8 @@
#include <algorithm>
-#include "update_engine/payload_constants.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
using std::min;
diff --git a/extent_writer.h b/payload_consumer/extent_writer.h
similarity index 93%
rename from extent_writer.h
rename to payload_consumer/extent_writer.h
index 83f40e0..6484ebf 100644
--- a/extent_writer.h
+++ b/payload_consumer/extent_writer.h
@@ -14,17 +14,17 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_EXTENT_WRITER_H_
-#define UPDATE_ENGINE_EXTENT_WRITER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_EXTENT_WRITER_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_EXTENT_WRITER_H_
#include <vector>
#include <base/logging.h>
#include <brillo/secure_blob.h>
-#include "update_engine/file_descriptor.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/file_descriptor.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
// ExtentWriter is an abstract class which synchronously writes to a given
// file descriptor at the extents given.
@@ -131,4 +131,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_EXTENT_WRITER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_EXTENT_WRITER_H_
diff --git a/extent_writer_unittest.cc b/payload_consumer/extent_writer_unittest.cc
similarity index 97%
rename from extent_writer_unittest.cc
rename to payload_consumer/extent_writer_unittest.cc
index cccf232..24ea5bf 100644
--- a/extent_writer_unittest.cc
+++ b/payload_consumer/extent_writer_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/extent_writer.h"
+#include "update_engine/payload_consumer/extent_writer.h"
#include <fcntl.h>
#include <sys/stat.h>
@@ -29,9 +29,9 @@
#include <brillo/secure_blob.h>
#include <gtest/gtest.h>
-#include "update_engine/payload_constants.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
using chromeos_update_engine::test_utils::ExpectVectorsEq;
using std::min;
diff --git a/fake_extent_writer.h b/payload_consumer/fake_extent_writer.h
similarity index 88%
rename from fake_extent_writer.h
rename to payload_consumer/fake_extent_writer.h
index 65cd837..762c6d5 100644
--- a/fake_extent_writer.h
+++ b/payload_consumer/fake_extent_writer.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FAKE_EXTENT_WRITER_H_
-#define UPDATE_ENGINE_FAKE_EXTENT_WRITER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_FAKE_EXTENT_WRITER_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_FAKE_EXTENT_WRITER_H_
#include <memory>
#include <vector>
#include <brillo/secure_blob.h>
-#include "update_engine/extent_writer.h"
+#include "update_engine/payload_consumer/extent_writer.h"
namespace chromeos_update_engine {
@@ -68,4 +68,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FAKE_EXTENT_WRITER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_FAKE_EXTENT_WRITER_H_
diff --git a/file_descriptor.cc b/payload_consumer/file_descriptor.cc
similarity index 97%
rename from file_descriptor.cc
rename to payload_consumer/file_descriptor.cc
index 4718528..f26be28 100644
--- a/file_descriptor.cc
+++ b/payload_consumer/file_descriptor.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/file_descriptor.h"
+#include "update_engine/payload_consumer/file_descriptor.h"
#include <fcntl.h>
#include <linux/fs.h>
diff --git a/file_descriptor.h b/payload_consumer/file_descriptor.h
similarity index 96%
rename from file_descriptor.h
rename to payload_consumer/file_descriptor.h
index bf13611..3c15415 100644
--- a/file_descriptor.h
+++ b/payload_consumer/file_descriptor.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FILE_DESCRIPTOR_H_
-#define UPDATE_ENGINE_FILE_DESCRIPTOR_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_FILE_DESCRIPTOR_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_FILE_DESCRIPTOR_H_
#include <errno.h>
#include <memory>
@@ -138,4 +138,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FILE_DESCRIPTOR_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_FILE_DESCRIPTOR_H_
diff --git a/file_writer.cc b/payload_consumer/file_writer.cc
similarity index 96%
rename from file_writer.cc
rename to payload_consumer/file_writer.cc
index 2f5ecee..d280ddb 100644
--- a/file_writer.cc
+++ b/payload_consumer/file_writer.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/file_writer.h"
+#include "update_engine/payload_consumer/file_writer.h"
#include <errno.h>
diff --git a/file_writer.h b/payload_consumer/file_writer.h
similarity index 91%
rename from file_writer.h
rename to payload_consumer/file_writer.h
index fbda009..96ebde6 100644
--- a/file_writer.h
+++ b/payload_consumer/file_writer.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FILE_WRITER_H_
-#define UPDATE_ENGINE_FILE_WRITER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_FILE_WRITER_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_FILE_WRITER_H_
#include <fcntl.h>
#include <sys/stat.h>
@@ -24,8 +24,8 @@
#include <base/logging.h>
-#include "update_engine/error_code.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/error_code.h"
+#include "update_engine/common/utils.h"
// FileWriter is a class that is used to (synchronously, for now) write to
// a file. This file is a thin wrapper around open/write/close system calls,
@@ -100,4 +100,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FILE_WRITER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_FILE_WRITER_H_
diff --git a/file_writer_unittest.cc b/payload_consumer/file_writer_unittest.cc
similarity index 93%
rename from file_writer_unittest.cc
rename to payload_consumer/file_writer_unittest.cc
index 731b6f0..debb4c3 100644
--- a/file_writer_unittest.cc
+++ b/payload_consumer/file_writer_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/file_writer.h"
+#include "update_engine/payload_consumer/file_writer.h"
#include <errno.h>
#include <string.h>
@@ -23,11 +23,11 @@
#include <string>
#include <vector>
-#include <gtest/gtest.h>
#include <brillo/secure_blob.h>
+#include <gtest/gtest.h>
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
using std::string;
using std::vector;
diff --git a/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
similarity index 96%
rename from filesystem_verifier_action.cc
rename to payload_consumer/filesystem_verifier_action.cc
index 9418d14..6768407 100644
--- a/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/filesystem_verifier_action.h"
+#include "update_engine/payload_consumer/filesystem_verifier_action.h"
#include <errno.h>
#include <fcntl.h>
@@ -28,9 +28,9 @@
#include <base/bind.h>
#include <brillo/streams/file_stream.h>
-#include "update_engine/boot_control_interface.h"
-#include "update_engine/payload_constants.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
using std::string;
@@ -162,7 +162,7 @@
buffer_.resize(kReadFileBufferSize);
read_done_ = false;
- hasher_.reset(new OmahaHashCalculator());
+ hasher_.reset(new HashCalculator());
// Start the first read.
ScheduleRead();
diff --git a/filesystem_verifier_action.h b/payload_consumer/filesystem_verifier_action.h
similarity index 91%
rename from filesystem_verifier_action.h
rename to payload_consumer/filesystem_verifier_action.h
index ad9f13b..0a66b01 100644
--- a/filesystem_verifier_action.h
+++ b/payload_consumer/filesystem_verifier_action.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_FILESYSTEM_VERIFIER_ACTION_H_
-#define UPDATE_ENGINE_FILESYSTEM_VERIFIER_ACTION_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_FILESYSTEM_VERIFIER_ACTION_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_FILESYSTEM_VERIFIER_ACTION_H_
#include <sys/stat.h>
#include <sys/types.h>
@@ -26,9 +26,9 @@
#include <brillo/streams/stream.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
-#include "update_engine/action.h"
-#include "update_engine/install_plan.h"
-#include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/common/action.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/payload_consumer/install_plan.h"
// This action will hash all the partitions of a single slot involved in the
// update (either source or target slot). The hashes are then either stored in
@@ -114,7 +114,7 @@
InstallPlan install_plan_;
// Calculates the hash of the data.
- std::unique_ptr<OmahaHashCalculator> hasher_;
+ std::unique_ptr<HashCalculator> hasher_;
// Reads and hashes this many bytes from the head of the input stream. This
// field is initialized from the corresponding InstallPlan::Partition size,
@@ -126,4 +126,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_FILESYSTEM_VERIFIER_ACTION_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_FILESYSTEM_VERIFIER_ACTION_H_
diff --git a/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc
similarity index 95%
rename from filesystem_verifier_action_unittest.cc
rename to payload_consumer/filesystem_verifier_action_unittest.cc
index 6dc9816..7b88aca 100644
--- a/filesystem_verifier_action_unittest.cc
+++ b/payload_consumer/filesystem_verifier_action_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/filesystem_verifier_action.h"
+#include "update_engine/payload_consumer/filesystem_verifier_action.h"
#include <fcntl.h>
@@ -32,11 +32,11 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_boot_control.h"
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/payload_constants.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/fake_boot_control.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
using brillo::MessageLoop;
using std::set;
@@ -175,7 +175,7 @@
part.target_path = a_dev;
fake_boot_control_.SetPartitionDevice(
part.name, install_plan.target_slot, a_dev);
- if (!OmahaHashCalculator::RawHashOfData(a_loop_data, &part.target_hash)) {
+ if (!HashCalculator::RawHashOfData(a_loop_data, &part.target_hash)) {
ADD_FAILURE();
success = false;
}
@@ -185,7 +185,7 @@
part.source_path = a_dev;
fake_boot_control_.SetPartitionDevice(
part.name, install_plan.source_slot, a_dev);
- if (!OmahaHashCalculator::RawHashOfData(a_loop_data, &part.source_hash)) {
+ if (!HashCalculator::RawHashOfData(a_loop_data, &part.source_hash)) {
ADD_FAILURE();
success = false;
}
diff --git a/install_plan.cc b/payload_consumer/install_plan.cc
similarity index 96%
rename from install_plan.cc
rename to payload_consumer/install_plan.cc
index fa6dff7..f404c20 100644
--- a/install_plan.cc
+++ b/payload_consumer/install_plan.cc
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#include "update_engine/install_plan.h"
+#include "update_engine/payload_consumer/install_plan.h"
#include <base/format_macros.h>
#include <base/logging.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/payload_constants.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
using std::string;
diff --git a/install_plan.h b/payload_consumer/install_plan.h
similarity index 94%
rename from install_plan.h
rename to payload_consumer/install_plan.h
index 14e5c5a..f412499 100644
--- a/install_plan.h
+++ b/payload_consumer/install_plan.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_INSTALL_PLAN_H_
-#define UPDATE_ENGINE_INSTALL_PLAN_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_INSTALL_PLAN_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_INSTALL_PLAN_H_
#include <string>
#include <vector>
@@ -23,8 +23,8 @@
#include <base/macros.h>
#include <brillo/secure_blob.h>
-#include "update_engine/action.h"
-#include "update_engine/boot_control_interface.h"
+#include "update_engine/common/action.h"
+#include "update_engine/common/boot_control_interface.h"
#include "update_engine/system_state.h"
// InstallPlan is a simple struct that contains relevant info for many
@@ -154,4 +154,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_INSTALL_PLAN_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_INSTALL_PLAN_H_
diff --git a/mtd_file_descriptor.cc b/payload_consumer/mtd_file_descriptor.cc
similarity index 96%
rename from mtd_file_descriptor.cc
rename to payload_consumer/mtd_file_descriptor.cc
index c4024e9..6f4fae8 100644
--- a/mtd_file_descriptor.cc
+++ b/payload_consumer/mtd_file_descriptor.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/mtd_file_descriptor.h"
+#include "update_engine/payload_consumer/mtd_file_descriptor.h"
#include <fcntl.h>
#include <mtd/ubi-user.h>
@@ -30,7 +30,7 @@
#include <base/strings/stringprintf.h>
#include <update_engine/subprocess.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using std::string;
using std::vector;
@@ -41,7 +41,6 @@
static const char kUsableEbSize[] = "/usable_eb_size";
static const char kReservedEbs[] = "/reserved_ebs";
-using chromeos_update_engine::Subprocess;
using chromeos_update_engine::UbiVolumeInfo;
using chromeos_update_engine::utils::ReadFile;
@@ -51,18 +50,18 @@
base::FilePath device_node(path);
base::FilePath ubi_name(device_node.BaseName());
- std::string sysfs_node(kSysfsClassUbi);
+ string sysfs_node(kSysfsClassUbi);
sysfs_node.append(ubi_name.MaybeAsASCII());
std::unique_ptr<UbiVolumeInfo> ret;
// Obtain volume info from sysfs.
- std::string s_reserved_ebs;
+ string s_reserved_ebs;
if (!ReadFile(sysfs_node + kReservedEbs, &s_reserved_ebs)) {
LOG(ERROR) << "Cannot read " << sysfs_node + kReservedEbs;
return ret;
}
- std::string s_eb_size;
+ string s_eb_size;
if (!ReadFile(sysfs_node + kUsableEbSize, &s_eb_size)) {
LOG(ERROR) << "Cannot read " << sysfs_node + kUsableEbSize;
return ret;
diff --git a/mtd_file_descriptor.h b/payload_consumer/mtd_file_descriptor.h
similarity index 91%
rename from mtd_file_descriptor.h
rename to payload_consumer/mtd_file_descriptor.h
index 954e5e5..9ac1ec1 100644
--- a/mtd_file_descriptor.h
+++ b/payload_consumer/mtd_file_descriptor.h
@@ -14,15 +14,15 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_MTD_FILE_DESCRIPTOR_H_
-#define UPDATE_ENGINE_MTD_FILE_DESCRIPTOR_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_MTD_FILE_DESCRIPTOR_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_MTD_FILE_DESCRIPTOR_H_
// This module defines file descriptors that deal with NAND media. We are
// concerned with raw NAND access (as MTD device), and through UBI layer.
#include <mtdutils.h>
-#include "update_engine/file_descriptor.h"
+#include "update_engine/payload_consumer/file_descriptor.h"
namespace chromeos_update_engine {
@@ -99,4 +99,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_MTD_FILE_DESCRIPTOR_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_MTD_FILE_DESCRIPTOR_H_
diff --git a/payload_constants.cc b/payload_consumer/payload_constants.cc
similarity index 96%
rename from payload_constants.cc
rename to payload_consumer/payload_constants.cc
index b831240..72abf8c 100644
--- a/payload_constants.cc
+++ b/payload_consumer/payload_constants.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
namespace chromeos_update_engine {
diff --git a/payload_constants.h b/payload_consumer/payload_constants.h
similarity index 91%
rename from payload_constants.h
rename to payload_consumer/payload_constants.h
index d423eeb..c3cd363 100644
--- a/payload_constants.h
+++ b/payload_consumer/payload_constants.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PAYLOAD_CONSTANTS_H_
-#define UPDATE_ENGINE_PAYLOAD_CONSTANTS_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_CONSTANTS_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_CONSTANTS_H_
#include <stdint.h>
@@ -62,4 +62,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PAYLOAD_CONSTANTS_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_CONSTANTS_H_
diff --git a/payload_verifier.cc b/payload_consumer/payload_verifier.cc
similarity index 97%
rename from payload_verifier.cc
rename to payload_consumer/payload_verifier.cc
index ed471c2..ab5238c 100644
--- a/payload_verifier.cc
+++ b/payload_consumer/payload_verifier.cc
@@ -14,14 +14,14 @@
// limitations under the License.
//
-#include "update_engine/payload_verifier.h"
+#include "update_engine/payload_consumer/payload_verifier.h"
#include <base/logging.h>
#include <openssl/pem.h>
-#include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/utils.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
using std::string;
diff --git a/payload_verifier.h b/payload_consumer/payload_verifier.h
similarity index 92%
rename from payload_verifier.h
rename to payload_consumer/payload_verifier.h
index 1d3f2f8..22ced40 100644
--- a/payload_verifier.h
+++ b/payload_consumer/payload_verifier.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_PAYLOAD_VERIFIER_H_
-#define UPDATE_ENGINE_PAYLOAD_VERIFIER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_VERIFIER_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_VERIFIER_H_
#include <string>
#include <vector>
@@ -62,4 +62,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_PAYLOAD_VERIFIER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_PAYLOAD_VERIFIER_H_
diff --git a/postinstall_runner_action.cc b/payload_consumer/postinstall_runner_action.cc
similarity index 96%
rename from postinstall_runner_action.cc
rename to payload_consumer/postinstall_runner_action.cc
index 8c871d0..33bbf5b 100644
--- a/postinstall_runner_action.cc
+++ b/payload_consumer/postinstall_runner_action.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/postinstall_runner_action.h"
+#include "update_engine/payload_consumer/postinstall_runner_action.h"
#include <stdlib.h>
#include <sys/mount.h>
@@ -24,9 +24,9 @@
#include <base/files/file_path.h>
#include <base/files/file_util.h>
-#include "update_engine/action_processor.h"
-#include "update_engine/subprocess.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/action_processor.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
namespace chromeos_update_engine {
diff --git a/postinstall_runner_action.h b/payload_consumer/postinstall_runner_action.h
similarity index 89%
rename from postinstall_runner_action.h
rename to payload_consumer/postinstall_runner_action.h
index 8b2f55d..de19c0c 100644
--- a/postinstall_runner_action.h
+++ b/payload_consumer/postinstall_runner_action.h
@@ -14,13 +14,13 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H_
-#define UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_POSTINSTALL_RUNNER_ACTION_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_POSTINSTALL_RUNNER_ACTION_H_
#include <string>
-#include "update_engine/action.h"
-#include "update_engine/install_plan.h"
+#include "update_engine/common/action.h"
+#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/system_state.h"
// The Postinstall Runner Action is responsible for running the postinstall
@@ -83,4 +83,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_POSTINSTALL_RUNNER_ACTION_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_POSTINSTALL_RUNNER_ACTION_H_
diff --git a/postinstall_runner_action_unittest.cc b/payload_consumer/postinstall_runner_action_unittest.cc
similarity index 97%
rename from postinstall_runner_action_unittest.cc
rename to payload_consumer/postinstall_runner_action_unittest.cc
index ca6627e..c54ace8 100644
--- a/postinstall_runner_action_unittest.cc
+++ b/payload_consumer/postinstall_runner_action_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/postinstall_runner_action.h"
+#include "update_engine/payload_consumer/postinstall_runner_action.h"
#include <sys/stat.h>
#include <sys/types.h>
@@ -33,10 +33,10 @@
#include <brillo/message_loops/message_loop_utils.h>
#include <gtest/gtest.h>
-#include "update_engine/constants.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using brillo::MessageLoop;
using chromeos_update_engine::test_utils::System;
diff --git a/xz_extent_writer.cc b/payload_consumer/xz_extent_writer.cc
similarity index 98%
rename from xz_extent_writer.cc
rename to payload_consumer/xz_extent_writer.cc
index 813b349..4bd893d 100644
--- a/xz_extent_writer.cc
+++ b/payload_consumer/xz_extent_writer.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/xz_extent_writer.h"
+#include "update_engine/payload_consumer/xz_extent_writer.h"
using std::vector;
diff --git a/xz_extent_writer.h b/payload_consumer/xz_extent_writer.h
similarity index 87%
rename from xz_extent_writer.h
rename to payload_consumer/xz_extent_writer.h
index 122d914..a6b3257 100644
--- a/xz_extent_writer.h
+++ b/payload_consumer/xz_extent_writer.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_XZ_EXTENT_WRITER_H_
-#define UPDATE_ENGINE_XZ_EXTENT_WRITER_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_CONSUMER_XZ_EXTENT_WRITER_H_
+#define UPDATE_ENGINE_PAYLOAD_CONSUMER_XZ_EXTENT_WRITER_H_
#include <xz.h>
@@ -24,7 +24,7 @@
#include <brillo/secure_blob.h>
-#include "update_engine/extent_writer.h"
+#include "update_engine/payload_consumer/extent_writer.h"
// XzExtentWriter is a concrete ExtentWriter subclass that xz-decompresses
// what it's given in Write using xz-embedded. Note that xz-embedded only
@@ -57,4 +57,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_XZ_EXTENT_WRITER_H_
+#endif // UPDATE_ENGINE_PAYLOAD_CONSUMER_XZ_EXTENT_WRITER_H_
diff --git a/xz_extent_writer_unittest.cc b/payload_consumer/xz_extent_writer_unittest.cc
similarity index 96%
rename from xz_extent_writer_unittest.cc
rename to payload_consumer/xz_extent_writer_unittest.cc
index 4f464e3..fb8bb40 100644
--- a/xz_extent_writer_unittest.cc
+++ b/payload_consumer/xz_extent_writer_unittest.cc
@@ -14,7 +14,7 @@
// limitations under the License.
//
-#include "update_engine/xz_extent_writer.h"
+#include "update_engine/payload_consumer/xz_extent_writer.h"
#include <fcntl.h>
#include <sys/stat.h>
@@ -28,9 +28,9 @@
#include <brillo/make_unique_ptr.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_extent_writer.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/fake_extent_writer.h"
using std::string;
using std::vector;
diff --git a/payload_generator/ab_generator.cc b/payload_generator/ab_generator.cc
index 2658fb8..7caf897 100644
--- a/payload_generator/ab_generator.cc
+++ b/payload_generator/ab_generator.cc
@@ -20,13 +20,13 @@
#include <base/strings/stringprintf.h>
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/annotated_operation.h"
#include "update_engine/payload_generator/bzip.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/delta_diff_utils.h"
-#include "update_engine/utils.h"
using std::string;
using std::vector;
@@ -325,8 +325,7 @@
: BlocksInExtents(aop.op.src_extents()) * kBlockSize;
TEST_AND_RETURN_FALSE(utils::ReadExtents(
source_part_path, src_extents, &src_data, src_length, kBlockSize));
- TEST_AND_RETURN_FALSE(
- OmahaHashCalculator::RawHashOfData(src_data, &src_hash));
+ TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfData(src_data, &src_hash));
aop.op.set_src_sha256_hash(src_hash.data(), src_hash.size());
}
return true;
diff --git a/payload_generator/ab_generator.h b/payload_generator/ab_generator.h
index 31cbb1e..c2837c0 100644
--- a/payload_generator/ab_generator.h
+++ b/payload_generator/ab_generator.h
@@ -23,7 +23,7 @@
#include <base/macros.h>
#include <brillo/secure_blob.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/blob_file_writer.h"
#include "update_engine/payload_generator/extent_utils.h"
#include "update_engine/payload_generator/filesystem_interface.h"
diff --git a/payload_generator/ab_generator_unittest.cc b/payload_generator/ab_generator_unittest.cc
index 8854225..632fc64 100644
--- a/payload_generator/ab_generator_unittest.cc
+++ b/payload_generator/ab_generator_unittest.cc
@@ -25,14 +25,14 @@
#include <gtest/gtest.h>
-#include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/annotated_operation.h"
#include "update_engine/payload_generator/bzip.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/extent_utils.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using std::string;
using std::vector;
@@ -581,7 +581,7 @@
EXPECT_TRUE(aops[0].op.has_src_sha256_hash());
EXPECT_FALSE(aops[1].op.has_src_sha256_hash());
brillo::Blob expected_hash;
- EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(src_data, &expected_hash));
+ EXPECT_TRUE(HashCalculator::RawHashOfData(src_data, &expected_hash));
brillo::Blob result_hash(aops[0].op.src_sha256_hash().begin(),
aops[0].op.src_sha256_hash().end());
EXPECT_EQ(expected_hash, result_hash);
diff --git a/payload_generator/annotated_operation.cc b/payload_generator/annotated_operation.cc
index 3331303..984f921 100644
--- a/payload_generator/annotated_operation.cc
+++ b/payload_generator/annotated_operation.cc
@@ -20,8 +20,8 @@
#include <base/strings/string_number_conversions.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/payload_constants.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
namespace chromeos_update_engine {
diff --git a/payload_generator/blob_file_writer.cc b/payload_generator/blob_file_writer.cc
index 501df0e..8225df4 100644
--- a/payload_generator/blob_file_writer.cc
+++ b/payload_generator/blob_file_writer.cc
@@ -16,7 +16,7 @@
#include "update_engine/payload_generator/blob_file_writer.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
namespace chromeos_update_engine {
diff --git a/payload_generator/blob_file_writer_unittest.cc b/payload_generator/blob_file_writer_unittest.cc
index ff2a23c..5f94ef3 100644
--- a/payload_generator/blob_file_writer_unittest.cc
+++ b/payload_generator/blob_file_writer_unittest.cc
@@ -20,8 +20,8 @@
#include <gtest/gtest.h>
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
using chromeos_update_engine::test_utils::FillWithData;
using std::string;
diff --git a/payload_generator/block_mapping.cc b/payload_generator/block_mapping.cc
index 81ad4bb..ff10f0b 100644
--- a/payload_generator/block_mapping.cc
+++ b/payload_generator/block_mapping.cc
@@ -24,7 +24,7 @@
#include <string>
#include <vector>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using std::string;
using std::vector;
@@ -57,7 +57,7 @@
bool BlockMapping::AddManyDiskBlocks(int fd,
off_t initial_byte_offset,
size_t num_blocks,
- std::vector<BlockId>* block_ids) {
+ vector<BlockId>* block_ids) {
bool ret = true;
block_ids->resize(num_blocks);
for (size_t block = 0; block < num_blocks; block++) {
diff --git a/payload_generator/block_mapping_unittest.cc b/payload_generator/block_mapping_unittest.cc
index 61080f2..18e48c4 100644
--- a/payload_generator/block_mapping_unittest.cc
+++ b/payload_generator/block_mapping_unittest.cc
@@ -25,8 +25,8 @@
#include <gtest/gtest.h>
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
using std::string;
using std::vector;
diff --git a/payload_generator/bzip.cc b/payload_generator/bzip.cc
index 287b69c..9040193 100644
--- a/payload_generator/bzip.cc
+++ b/payload_generator/bzip.cc
@@ -22,7 +22,7 @@
#include <algorithm>
#include <limits>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using std::string;
diff --git a/payload_generator/cycle_breaker.cc b/payload_generator/cycle_breaker.cc
index 6b89190..321732e 100644
--- a/payload_generator/cycle_breaker.cc
+++ b/payload_generator/cycle_breaker.cc
@@ -25,9 +25,9 @@
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/graph_utils.h"
#include "update_engine/payload_generator/tarjan.h"
-#include "update_engine/utils.h"
using std::make_pair;
using std::set;
diff --git a/payload_generator/cycle_breaker_unittest.cc b/payload_generator/cycle_breaker_unittest.cc
index b4243a7..4053cf3 100644
--- a/payload_generator/cycle_breaker_unittest.cc
+++ b/payload_generator/cycle_breaker_unittest.cc
@@ -24,8 +24,8 @@
#include <base/logging.h>
#include <gtest/gtest.h>
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/graph_types.h"
-#include "update_engine/utils.h"
using std::make_pair;
using std::pair;
diff --git a/payload_generator/delta_diff_generator.cc b/payload_generator/delta_diff_generator.cc
index 96730aa..ffe0fe9 100644
--- a/payload_generator/delta_diff_generator.cc
+++ b/payload_generator/delta_diff_generator.cc
@@ -30,15 +30,15 @@
#include <base/logging.h>
-#include "update_engine/delta_performer.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/delta_performer.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/ab_generator.h"
#include "update_engine/payload_generator/blob_file_writer.h"
#include "update_engine/payload_generator/delta_diff_utils.h"
#include "update_engine/payload_generator/full_update_generator.h"
#include "update_engine/payload_generator/inplace_generator.h"
#include "update_engine/payload_generator/payload_file.h"
-#include "update_engine/utils.h"
using std::string;
using std::unique_ptr;
diff --git a/payload_generator/delta_diff_utils.cc b/payload_generator/delta_diff_utils.cc
index 701f27c..ba1aac4 100644
--- a/payload_generator/delta_diff_utils.cc
+++ b/payload_generator/delta_diff_utils.cc
@@ -23,14 +23,14 @@
#include <base/format_macros.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/payload_generator/bzip.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/block_mapping.h"
+#include "update_engine/payload_generator/bzip.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/extent_utils.h"
-#include "update_engine/subprocess.h"
-#include "update_engine/utils.h"
using std::map;
using std::string;
@@ -653,7 +653,7 @@
bool InitializePartitionInfo(const PartitionConfig& part, PartitionInfo* info) {
info->set_size(part.size);
- OmahaHashCalculator hasher;
+ HashCalculator hasher;
TEST_AND_RETURN_FALSE(hasher.UpdateFile(part.path, part.size) ==
static_cast<off_t>(part.size));
TEST_AND_RETURN_FALSE(hasher.Finalize());
diff --git a/payload_generator/delta_diff_utils_unittest.cc b/payload_generator/delta_diff_utils_unittest.cc
index ce37b27..4dc5981 100644
--- a/payload_generator/delta_diff_utils_unittest.cc
+++ b/payload_generator/delta_diff_utils_unittest.cc
@@ -25,12 +25,12 @@
#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/extent_utils.h"
#include "update_engine/payload_generator/fake_filesystem.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using std::string;
using std::vector;
diff --git a/payload_generator/ext2_filesystem.cc b/payload_generator/ext2_filesystem.cc
index 182c098..b452b41 100644
--- a/payload_generator/ext2_filesystem.cc
+++ b/payload_generator/ext2_filesystem.cc
@@ -26,10 +26,10 @@
#include <base/logging.h>
#include <base/strings/stringprintf.h>
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/extent_utils.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
using std::set;
using std::string;
diff --git a/payload_generator/ext2_filesystem_unittest.cc b/payload_generator/ext2_filesystem_unittest.cc
index fef1c9f..df8b98f 100644
--- a/payload_generator/ext2_filesystem_unittest.cc
+++ b/payload_generator/ext2_filesystem_unittest.cc
@@ -25,14 +25,14 @@
#include <base/format_macros.h>
#include <base/logging.h>
-#include <base/strings/stringprintf.h>
#include <base/strings/string_number_conversions.h>
#include <base/strings/string_util.h>
+#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/extent_utils.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using chromeos_update_engine::test_utils::System;
using std::map;
diff --git a/payload_generator/extent_ranges.cc b/payload_generator/extent_ranges.cc
index f538c5e..848fdc7 100644
--- a/payload_generator/extent_ranges.cc
+++ b/payload_generator/extent_ranges.cc
@@ -23,7 +23,7 @@
#include <base/logging.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
using std::set;
using std::vector;
diff --git a/payload_generator/extent_ranges_unittest.cc b/payload_generator/extent_ranges_unittest.cc
index c8026ba..8b39040 100644
--- a/payload_generator/extent_ranges_unittest.cc
+++ b/payload_generator/extent_ranges_unittest.cc
@@ -20,9 +20,9 @@
#include <gtest/gtest.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/extent_utils.h"
-#include "update_engine/test_utils.h"
using std::vector;
diff --git a/payload_generator/extent_utils.cc b/payload_generator/extent_utils.cc
index 37acc47..1093445 100644
--- a/payload_generator/extent_utils.cc
+++ b/payload_generator/extent_utils.cc
@@ -23,7 +23,7 @@
#include <base/logging.h>
#include <base/macros.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/annotated_operation.h"
#include "update_engine/payload_generator/extent_ranges.h"
diff --git a/payload_generator/extent_utils.h b/payload_generator/extent_utils.h
index 992b28f..91729d5 100644
--- a/payload_generator/extent_utils.h
+++ b/payload_generator/extent_utils.h
@@ -19,7 +19,7 @@
#include <vector>
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/update_metadata.pb.h"
// Utility functions for manipulating Extents and lists of blocks.
diff --git a/payload_generator/extent_utils_unittest.cc b/payload_generator/extent_utils_unittest.cc
index 65c0b15..62c8ff1 100644
--- a/payload_generator/extent_utils_unittest.cc
+++ b/payload_generator/extent_utils_unittest.cc
@@ -21,9 +21,9 @@
#include <gtest/gtest.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/extent_ranges.h"
-#include "update_engine/test_utils.h"
using std::vector;
diff --git a/payload_generator/full_update_generator.cc b/payload_generator/full_update_generator.cc
index 1ae01b9..56a3ca8 100644
--- a/payload_generator/full_update_generator.cc
+++ b/payload_generator/full_update_generator.cc
@@ -30,8 +30,8 @@
#include <base/threading/simple_thread.h>
#include <brillo/secure_blob.h>
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/bzip.h"
-#include "update_engine/utils.h"
using std::vector;
diff --git a/payload_generator/full_update_generator_unittest.cc b/payload_generator/full_update_generator_unittest.cc
index 21c23e0..d46346d 100644
--- a/payload_generator/full_update_generator_unittest.cc
+++ b/payload_generator/full_update_generator_unittest.cc
@@ -21,9 +21,9 @@
#include <gtest/gtest.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/extent_utils.h"
-#include "update_engine/test_utils.h"
using chromeos_update_engine::test_utils::FillWithData;
using std::string;
diff --git a/payload_generator/generate_delta_main.cc b/payload_generator/generate_delta_main.cc
index fa56a51..dbb15bc 100644
--- a/payload_generator/generate_delta_main.cc
+++ b/payload_generator/generate_delta_main.cc
@@ -29,16 +29,16 @@
#include <base/strings/string_split.h>
#include <brillo/flag_helper.h>
-#include "update_engine/delta_performer.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/terminator.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/delta_performer.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/delta_diff_utils.h"
#include "update_engine/payload_generator/payload_generation_config.h"
#include "update_engine/payload_generator/payload_signer.h"
-#include "update_engine/prefs.h"
-#include "update_engine/terminator.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
// This file contains a simple program that takes an old path, a new path,
// and an output file as arguments and the path to an output file and
diff --git a/payload_generator/graph_utils.cc b/payload_generator/graph_utils.cc
index 55b0e69..2d5fb63 100644
--- a/payload_generator/graph_utils.cc
+++ b/payload_generator/graph_utils.cc
@@ -23,7 +23,7 @@
#include <base/logging.h>
#include <base/macros.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/annotated_operation.h"
#include "update_engine/payload_generator/extent_utils.h"
diff --git a/payload_generator/graph_utils_unittest.cc b/payload_generator/graph_utils_unittest.cc
index bcfb72b..7d3dbe3 100644
--- a/payload_generator/graph_utils_unittest.cc
+++ b/payload_generator/graph_utils_unittest.cc
@@ -21,7 +21,7 @@
#include <gtest/gtest.h>
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/extent_utils.h"
diff --git a/payload_generator/inplace_generator.cc b/payload_generator/inplace_generator.cc
index 0cfbe02..2111748 100644
--- a/payload_generator/inplace_generator.cc
+++ b/payload_generator/inplace_generator.cc
@@ -23,7 +23,8 @@
#include <utility>
#include <vector>
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/cycle_breaker.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/delta_diff_utils.h"
@@ -32,7 +33,6 @@
#include "update_engine/payload_generator/graph_utils.h"
#include "update_engine/payload_generator/topological_sort.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
using std::make_pair;
using std::map;
diff --git a/payload_generator/inplace_generator_unittest.cc b/payload_generator/inplace_generator_unittest.cc
index d6430c8..9932ef9 100644
--- a/payload_generator/inplace_generator_unittest.cc
+++ b/payload_generator/inplace_generator_unittest.cc
@@ -29,13 +29,13 @@
#include <base/strings/stringprintf.h>
#include <gtest/gtest.h>
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/cycle_breaker.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/graph_types.h"
#include "update_engine/payload_generator/graph_utils.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using std::map;
using std::set;
diff --git a/payload_generator/payload_file.cc b/payload_generator/payload_file.cc
index ae4896a..8b3efa6 100644
--- a/payload_generator/payload_file.cc
+++ b/payload_generator/payload_file.cc
@@ -20,10 +20,10 @@
#include <algorithm>
-#include "update_engine/delta_performer.h"
-#include "update_engine/file_writer.h"
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/payload_consumer/delta_performer.h"
+#include "update_engine/payload_consumer/file_writer.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/annotated_operation.h"
#include "update_engine/payload_generator/delta_diff_utils.h"
#include "update_engine/payload_generator/payload_signer.h"
@@ -218,7 +218,7 @@
if (major_version_ == kBrilloMajorPayloadVersion &&
!private_key_path.empty()) {
brillo::Blob metadata_hash, metadata_signature;
- TEST_AND_RETURN_FALSE(OmahaHashCalculator::RawHashOfFile(payload_file,
+ TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfFile(payload_file,
metadata_size,
&metadata_hash));
TEST_AND_RETURN_FALSE(
@@ -302,7 +302,7 @@
bool PayloadFile::AddOperationHash(InstallOperation* op,
const brillo::Blob& buf) {
- OmahaHashCalculator hasher;
+ HashCalculator hasher;
TEST_AND_RETURN_FALSE(hasher.Update(buf.data(), buf.size()));
TEST_AND_RETURN_FALSE(hasher.Finalize());
const brillo::Blob& hash = hasher.raw_hash();
diff --git a/payload_generator/payload_file_unittest.cc b/payload_generator/payload_file_unittest.cc
index 244d22b..4d18adf 100644
--- a/payload_generator/payload_file_unittest.cc
+++ b/payload_generator/payload_file_unittest.cc
@@ -22,8 +22,8 @@
#include <gtest/gtest.h>
+#include "update_engine/common/test_utils.h"
#include "update_engine/payload_generator/extent_ranges.h"
-#include "update_engine/test_utils.h"
using std::string;
using std::vector;
diff --git a/payload_generator/payload_generation_config.cc b/payload_generator/payload_generation_config.cc
index c2a78cc..63d1884 100644
--- a/payload_generator/payload_generation_config.cc
+++ b/payload_generator/payload_generation_config.cc
@@ -18,11 +18,11 @@
#include <base/logging.h>
-#include "update_engine/delta_performer.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/delta_performer.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/ext2_filesystem.h"
#include "update_engine/payload_generator/raw_filesystem.h"
-#include "update_engine/utils.h"
namespace chromeos_update_engine {
diff --git a/payload_generator/payload_generation_config.h b/payload_generator/payload_generation_config.h
index 8ee8887..8723680 100644
--- a/payload_generator/payload_generation_config.h
+++ b/payload_generator/payload_generation_config.h
@@ -23,7 +23,7 @@
#include <string>
#include <vector>
-#include "update_engine/payload_constants.h"
+#include "update_engine/payload_consumer/payload_constants.h"
#include "update_engine/payload_generator/filesystem_interface.h"
#include "update_engine/update_metadata.pb.h"
diff --git a/payload_generator/payload_signer.cc b/payload_generator/payload_signer.cc
index f1242e1..a0c61b1 100644
--- a/payload_generator/payload_signer.cc
+++ b/payload_generator/payload_signer.cc
@@ -24,15 +24,15 @@
#include <brillo/data_encoding.h>
#include <openssl/pem.h>
-#include "update_engine/delta_performer.h"
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/delta_performer.h"
+#include "update_engine/payload_consumer/payload_constants.h"
+#include "update_engine/payload_consumer/payload_verifier.h"
#include "update_engine/payload_generator/delta_diff_generator.h"
#include "update_engine/payload_generator/payload_file.h"
-#include "update_engine/payload_verifier.h"
-#include "update_engine/subprocess.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
using std::string;
using std::vector;
@@ -180,13 +180,13 @@
if (out_metadata_hash) {
// Calculates the hash on the manifest.
TEST_AND_RETURN_FALSE(
- OmahaHashCalculator::RawHashOfBytes(payload.data(), metadata_size,
- out_metadata_hash));
+ HashCalculator::RawHashOfBytes(payload.data(), metadata_size,
+ out_metadata_hash));
}
if (out_hash_data) {
// Calculates the hash on the updated payload. Note that we skip metadata
// signature and payload signature.
- OmahaHashCalculator calc;
+ HashCalculator calc;
TEST_AND_RETURN_FALSE(calc.Update(payload.data(), metadata_size));
TEST_AND_RETURN_FALSE(calc.Update(
payload.data() + metadata_size + metadata_signature_size,
@@ -222,7 +222,7 @@
}
}
-bool PayloadSigner::LoadPayload(const std::string& payload_path,
+bool PayloadSigner::LoadPayload(const string& payload_path,
brillo::Blob* out_payload,
DeltaArchiveManifest* out_manifest,
uint64_t* out_major_version,
@@ -382,9 +382,9 @@
uint64_t* out_length) {
DCHECK(out_length);
brillo::Blob x_blob(1, 'x'), hash_blob, sig_blob;
- TEST_AND_RETURN_FALSE(OmahaHashCalculator::RawHashOfBytes(x_blob.data(),
- x_blob.size(),
- &hash_blob));
+ TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfBytes(x_blob.data(),
+ x_blob.size(),
+ &hash_blob));
TEST_AND_RETURN_FALSE(
SignHashWithKeys(hash_blob, private_key_paths, &sig_blob));
*out_length = sig_blob.size();
@@ -467,9 +467,9 @@
// Calculates the hash on the updated payload. Note that the payload includes
// the signature op but doesn't include the signature blob at the end.
brillo::Blob metadata_hash;
- TEST_AND_RETURN_FALSE(OmahaHashCalculator::RawHashOfBytes(metadata,
- metadata_size,
- &metadata_hash));
+ TEST_AND_RETURN_FALSE(HashCalculator::RawHashOfBytes(metadata,
+ metadata_size,
+ &metadata_hash));
brillo::Blob signature;
TEST_AND_RETURN_FALSE(SignHash(metadata_hash,
diff --git a/payload_generator/payload_signer_unittest.cc b/payload_generator/payload_signer_unittest.cc
index 42fcc63..b302f52 100644
--- a/payload_generator/payload_signer_unittest.cc
+++ b/payload_generator/payload_signer_unittest.cc
@@ -22,12 +22,12 @@
#include <base/logging.h>
#include <gtest/gtest.h>
-#include "update_engine/omaha_hash_calculator.h"
-#include "update_engine/payload_constants.h"
+#include "update_engine/common/hash_calculator.h"
+#include "update_engine/common/utils.h"
+#include "update_engine/payload_consumer/payload_constants.h"
+#include "update_engine/payload_consumer/payload_verifier.h"
#include "update_engine/payload_generator/payload_file.h"
-#include "update_engine/payload_verifier.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
using std::string;
using std::vector;
@@ -105,9 +105,9 @@
EXPECT_TRUE(PayloadSigner::SignatureBlobLength(private_keys, &length));
EXPECT_GT(length, 0);
brillo::Blob hash_blob;
- EXPECT_TRUE(OmahaHashCalculator::RawHashOfBytes(data_blob.data(),
- data_blob.size(),
- &hash_blob));
+ EXPECT_TRUE(HashCalculator::RawHashOfBytes(data_blob.data(),
+ data_blob.size(),
+ &hash_blob));
EXPECT_TRUE(PayloadSigner::SignHashWithKeys(
hash_blob,
private_keys,
diff --git a/payload_generator/raw_filesystem.cc b/payload_generator/raw_filesystem.cc
index efb944f..2fb1400 100644
--- a/payload_generator/raw_filesystem.cc
+++ b/payload_generator/raw_filesystem.cc
@@ -16,9 +16,9 @@
#include "update_engine/payload_generator/raw_filesystem.h"
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/update_metadata.pb.h"
-#include "update_engine/utils.h"
using std::unique_ptr;
diff --git a/payload_generator/tarjan.cc b/payload_generator/tarjan.cc
index 7e4eabe..98e29f9 100644
--- a/payload_generator/tarjan.cc
+++ b/payload_generator/tarjan.cc
@@ -20,7 +20,7 @@
#include <base/logging.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using std::min;
using std::vector;
diff --git a/payload_generator/tarjan_unittest.cc b/payload_generator/tarjan_unittest.cc
index f22f06d..e40a7ff 100644
--- a/payload_generator/tarjan_unittest.cc
+++ b/payload_generator/tarjan_unittest.cc
@@ -22,8 +22,8 @@
#include <base/logging.h>
#include <gtest/gtest.h>
+#include "update_engine/common/utils.h"
#include "update_engine/payload_generator/graph_types.h"
-#include "update_engine/utils.h"
using std::make_pair;
using std::string;
diff --git a/payload_generator/zip_unittest.cc b/payload_generator/zip_unittest.cc
index f2c569b..49b08b0 100644
--- a/payload_generator/zip_unittest.cc
+++ b/payload_generator/zip_unittest.cc
@@ -22,8 +22,8 @@
#include <gtest/gtest.h>
+#include "update_engine/common/test_utils.h"
#include "update_engine/payload_generator/bzip.h"
-#include "update_engine/test_utils.h"
using chromeos_update_engine::test_utils::kRandomString;
using std::string;
diff --git a/payload_state.cc b/payload_state.cc
index 9a1c740..9160ccd 100644
--- a/payload_state.cc
+++ b/payload_state.cc
@@ -24,14 +24,14 @@
#include <base/strings/stringprintf.h>
#include <policy/device_policy.h>
-#include "update_engine/clock.h"
-#include "update_engine/constants.h"
-#include "update_engine/hardware_interface.h"
-#include "update_engine/install_plan.h"
+#include "update_engine/common/clock.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/utils.h"
#include "update_engine/omaha_request_params.h"
-#include "update_engine/prefs.h"
+#include "update_engine/payload_consumer/install_plan.h"
#include "update_engine/system_state.h"
-#include "update_engine/utils.h"
using base::Time;
using base::TimeDelta;
diff --git a/payload_state.h b/payload_state.h
index 3616826..bec5823 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -23,9 +23,9 @@
#include <base/time/time.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
+#include "update_engine/common/prefs_interface.h"
#include "update_engine/metrics.h"
#include "update_engine/payload_state_interface.h"
-#include "update_engine/prefs_interface.h"
namespace chromeos_update_engine {
diff --git a/payload_state_interface.h b/payload_state_interface.h
index edc57ce..40a13dd 100644
--- a/payload_state_interface.h
+++ b/payload_state_interface.h
@@ -19,8 +19,8 @@
#include <string>
-#include "update_engine/action_processor.h"
-#include "update_engine/constants.h"
+#include "update_engine/common/action_processor.h"
+#include "update_engine/common/constants.h"
#include "update_engine/omaha_response.h"
namespace chromeos_update_engine {
diff --git a/payload_state_unittest.cc b/payload_state_unittest.cc
index 012a3fc..a8067dc 100644
--- a/payload_state_unittest.cc
+++ b/payload_state_unittest.cc
@@ -22,16 +22,16 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "update_engine/constants.h"
-#include "update_engine/fake_clock.h"
-#include "update_engine/fake_hardware.h"
-#include "update_engine/fake_prefs.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/fake_clock.h"
+#include "update_engine/common/fake_hardware.h"
+#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/mock_prefs.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/mock_prefs.h"
#include "update_engine/omaha_request_action.h"
-#include "update_engine/prefs.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using base::Time;
using base::TimeDelta;
diff --git a/proxy_resolver.h b/proxy_resolver.h
index e0e75de..2c8824f 100644
--- a/proxy_resolver.h
+++ b/proxy_resolver.h
@@ -23,7 +23,7 @@
#include <base/logging.h>
#include <brillo/message_loops/message_loop.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
namespace chromeos_update_engine {
diff --git a/real_system_state.cc b/real_system_state.cc
index 8efb903..dd33701 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -20,12 +20,12 @@
#include <base/time/time.h>
#include <brillo/make_unique_ptr.h>
-#include "update_engine/boot_control.h"
-#include "update_engine/boot_control_stub.h"
-#include "update_engine/constants.h"
-#include "update_engine/hardware.h"
+#include "update_engine/common/boot_control.h"
+#include "update_engine/common/boot_control_stub.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware.h"
+#include "update_engine/common/utils.h"
#include "update_engine/update_manager/state_factory.h"
-#include "update_engine/utils.h"
namespace chromeos_update_engine {
diff --git a/real_system_state.h b/real_system_state.h
index fd2a684..651d474 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -27,13 +27,13 @@
#include <power_manager/dbus-proxies.h>
#include <session_manager/dbus-proxies.h>
-#include "update_engine/boot_control_interface.h"
-#include "update_engine/clock.h"
+#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/clock.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/prefs.h"
#include "update_engine/connection_manager.h"
-#include "update_engine/hardware_interface.h"
#include "update_engine/p2p_manager.h"
#include "update_engine/payload_state.h"
-#include "update_engine/prefs.h"
#include "update_engine/shill_proxy.h"
#include "update_engine/update_attempter.h"
#include "update_engine/update_manager/update_manager.h"
diff --git a/test_http_server.cc b/test_http_server.cc
index 7326eb5..eaffba8 100644
--- a/test_http_server.cc
+++ b/test_http_server.cc
@@ -46,7 +46,7 @@
#include <base/strings/string_util.h>
#include <base/strings/stringprintf.h>
-#include "update_engine/http_common.h"
+#include "update_engine/common/http_common.h"
// HTTP end-of-line delimiter; sorry, this needs to be a macro.
diff --git a/testrunner.cc b/testrunner.cc
index 354394b..9e22798 100644
--- a/testrunner.cc
+++ b/testrunner.cc
@@ -23,7 +23,7 @@
#include <brillo/test_helpers.h>
#include <gtest/gtest.h>
-#include "update_engine/terminator.h"
+#include "update_engine/common/terminator.h"
int main(int argc, char **argv) {
LOG(INFO) << "started";
diff --git a/update_attempter.cc b/update_attempter.cc
index 7d6aaf2..ce2acbb 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -41,31 +41,31 @@
#include <power_manager/dbus-proxies.h>
#include <update_engine/dbus-constants.h>
-#include "update_engine/boot_control_interface.h"
-#include "update_engine/certificate_checker.h"
-#include "update_engine/clock_interface.h"
-#include "update_engine/constants.h"
+#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/certificate_checker.h"
+#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/hardware_interface.h"
+#include "update_engine/common/libcurl_http_fetcher.h"
+#include "update_engine/common/multi_range_http_fetcher.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/subprocess.h"
+#include "update_engine/common/utils.h"
#include "update_engine/dbus_service.h"
-#include "update_engine/download_action.h"
-#include "update_engine/filesystem_verifier_action.h"
-#include "update_engine/hardware_interface.h"
-#include "update_engine/libcurl_http_fetcher.h"
#include "update_engine/metrics.h"
-#include "update_engine/multi_range_http_fetcher.h"
#include "update_engine/omaha_request_action.h"
#include "update_engine/omaha_request_params.h"
#include "update_engine/omaha_response_handler_action.h"
#include "update_engine/p2p_manager.h"
+#include "update_engine/payload_consumer/download_action.h"
+#include "update_engine/payload_consumer/filesystem_verifier_action.h"
+#include "update_engine/payload_consumer/postinstall_runner_action.h"
#include "update_engine/payload_state_interface.h"
-#include "update_engine/platform_constants.h"
-#include "update_engine/postinstall_runner_action.h"
-#include "update_engine/prefs_interface.h"
-#include "update_engine/subprocess.h"
#include "update_engine/system_state.h"
#include "update_engine/update_manager/policy.h"
#include "update_engine/update_manager/update_manager.h"
#include "update_engine/update_status_utils.h"
-#include "update_engine/utils.h"
using base::Bind;
using base::Callback;
diff --git a/update_attempter.h b/update_attempter.h
index 5debf21..b08b8a8 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -29,13 +29,13 @@
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "debugd/dbus-proxies.h"
-#include "update_engine/action_processor.h"
#include "update_engine/chrome_browser_proxy_resolver.h"
#include "update_engine/client_library/include/update_engine/update_status.h"
-#include "update_engine/download_action.h"
+#include "update_engine/common/action_processor.h"
#include "update_engine/libcros_proxy.h"
#include "update_engine/omaha_request_params.h"
#include "update_engine/omaha_response_handler_action.h"
+#include "update_engine/payload_consumer/download_action.h"
#include "update_engine/proxy_resolver.h"
#include "update_engine/system_state.h"
#include "update_engine/update_manager/policy.h"
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index c2318f0..e549e38 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -36,23 +36,23 @@
#include "libcros/dbus-proxies.h"
#include "libcros/dbus-proxy-mocks.h"
-#include "update_engine/fake_clock.h"
-#include "update_engine/fake_prefs.h"
+#include "update_engine/common/fake_clock.h"
+#include "update_engine/common/fake_prefs.h"
+#include "update_engine/common/mock_http_fetcher.h"
+#include "update_engine/common/mock_prefs.h"
+#include "update_engine/common/platform_constants.h"
+#include "update_engine/common/prefs.h"
+#include "update_engine/common/test_utils.h"
+#include "update_engine/common/utils.h"
#include "update_engine/fake_system_state.h"
-#include "update_engine/filesystem_verifier_action.h"
-#include "update_engine/install_plan.h"
#include "update_engine/mock_action.h"
#include "update_engine/mock_action_processor.h"
-#include "update_engine/mock_http_fetcher.h"
#include "update_engine/mock_p2p_manager.h"
#include "update_engine/mock_payload_state.h"
-#include "update_engine/mock_prefs.h"
-#include "update_engine/payload_constants.h"
-#include "update_engine/platform_constants.h"
-#include "update_engine/postinstall_runner_action.h"
-#include "update_engine/prefs.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
+#include "update_engine/payload_consumer/filesystem_verifier_action.h"
+#include "update_engine/payload_consumer/install_plan.h"
+#include "update_engine/payload_consumer/payload_constants.h"
+#include "update_engine/payload_consumer/postinstall_runner_action.h"
using base::Time;
using base::TimeDelta;
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',
],
diff --git a/update_manager/boxed_value.cc b/update_manager/boxed_value.cc
index 6648e99..a4aeede 100644
--- a/update_manager/boxed_value.cc
+++ b/update_manager/boxed_value.cc
@@ -24,9 +24,9 @@
#include <base/strings/string_number_conversions.h>
#include <base/time/time.h>
+#include "update_engine/common/utils.h"
#include "update_engine/update_manager/shill_provider.h"
#include "update_engine/update_manager/updater_provider.h"
-#include "update_engine/utils.h"
using std::set;
using std::string;
diff --git a/update_manager/chromeos_policy.cc b/update_manager/chromeos_policy.cc
index 3a81059..6ba6f82 100644
--- a/update_manager/chromeos_policy.cc
+++ b/update_manager/chromeos_policy.cc
@@ -24,11 +24,11 @@
#include <base/strings/string_util.h>
#include <base/time/time.h>
-#include "update_engine/error_code.h"
+#include "update_engine/common/error_code.h"
+#include "update_engine/common/utils.h"
#include "update_engine/update_manager/device_policy_provider.h"
#include "update_engine/update_manager/policy_utils.h"
#include "update_engine/update_manager/shill_provider.h"
-#include "update_engine/utils.h"
using base::Time;
using base::TimeDelta;
@@ -533,7 +533,7 @@
EvalStatus ChromeOSPolicy::P2PEnabled(EvaluationContext* ec,
State* state,
- std::string* error,
+ string* error,
bool* result) const {
bool enabled = false;
@@ -569,7 +569,7 @@
EvalStatus ChromeOSPolicy::P2PEnabledChanged(EvaluationContext* ec,
State* state,
- std::string* error,
+ string* error,
bool* result,
bool prev_result) const {
EvalStatus status = P2PEnabled(ec, state, error, result);
diff --git a/update_manager/chromeos_policy_unittest.cc b/update_manager/chromeos_policy_unittest.cc
index f74eb8b..a78257d 100644
--- a/update_manager/chromeos_policy_unittest.cc
+++ b/update_manager/chromeos_policy_unittest.cc
@@ -25,7 +25,7 @@
#include <brillo/message_loops/fake_message_loop.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_clock.h"
+#include "update_engine/common/fake_clock.h"
#include "update_engine/update_manager/evaluation_context.h"
#include "update_engine/update_manager/fake_state.h"
#include "update_engine/update_manager/umtest_utils.h"
diff --git a/update_manager/default_policy.h b/update_manager/default_policy.h
index c86521e..3f41178 100644
--- a/update_manager/default_policy.h
+++ b/update_manager/default_policy.h
@@ -22,7 +22,7 @@
#include <base/time/time.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
#include "update_engine/update_manager/policy.h"
namespace chromeos_update_manager {
diff --git a/update_manager/evaluation_context.cc b/update_manager/evaluation_context.cc
index 0453eac..03ac0b7 100644
--- a/update_manager/evaluation_context.cc
+++ b/update_manager/evaluation_context.cc
@@ -26,7 +26,7 @@
#include <base/strings/string_util.h>
#include <base/values.h>
-#include "update_engine/utils.h"
+#include "update_engine/common/utils.h"
using base::Callback;
using base::Closure;
diff --git a/update_manager/evaluation_context.h b/update_manager/evaluation_context.h
index a57daa6..df5816a 100644
--- a/update_manager/evaluation_context.h
+++ b/update_manager/evaluation_context.h
@@ -28,7 +28,7 @@
#include <base/time/time.h>
#include <brillo/message_loops/message_loop.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
#include "update_engine/update_manager/boxed_value.h"
#include "update_engine/update_manager/variable.h"
diff --git a/update_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc
index 3f2ff5e..1e61db7 100644
--- a/update_manager/evaluation_context_unittest.cc
+++ b/update_manager/evaluation_context_unittest.cc
@@ -24,7 +24,7 @@
#include <brillo/message_loops/message_loop_utils.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_clock.h"
+#include "update_engine/common/fake_clock.h"
#include "update_engine/update_manager/fake_variable.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/mock_variable.h"
diff --git a/update_manager/policy.h b/update_manager/policy.h
index 7105c57..fae1494 100644
--- a/update_manager/policy.h
+++ b/update_manager/policy.h
@@ -21,7 +21,7 @@
#include <tuple>
#include <vector>
-#include "update_engine/error_code.h"
+#include "update_engine/common/error_code.h"
#include "update_engine/update_manager/evaluation_context.h"
#include "update_engine/update_manager/state.h"
diff --git a/update_manager/real_config_provider.cc b/update_manager/real_config_provider.cc
index ebaac75..2d17a7f 100644
--- a/update_manager/real_config_provider.cc
+++ b/update_manager/real_config_provider.cc
@@ -20,9 +20,9 @@
#include <base/logging.h>
#include <brillo/key_value_store.h>
-#include "update_engine/constants.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/utils.h"
#include "update_engine/update_manager/generic_variables.h"
-#include "update_engine/utils.h"
using brillo::KeyValueStore;
diff --git a/update_manager/real_config_provider.h b/update_manager/real_config_provider.h
index 727bdb0..4de910c 100644
--- a/update_manager/real_config_provider.h
+++ b/update_manager/real_config_provider.h
@@ -20,7 +20,7 @@
#include <memory>
#include <string>
-#include "update_engine/hardware_interface.h"
+#include "update_engine/common/hardware_interface.h"
#include "update_engine/update_manager/config_provider.h"
#include "update_engine/update_manager/generic_variables.h"
diff --git a/update_manager/real_config_provider_unittest.cc b/update_manager/real_config_provider_unittest.cc
index ffdbf7d..2d7dc0d 100644
--- a/update_manager/real_config_provider_unittest.cc
+++ b/update_manager/real_config_provider_unittest.cc
@@ -22,9 +22,9 @@
#include <base/files/scoped_temp_dir.h>
#include <gtest/gtest.h>
-#include "update_engine/constants.h"
-#include "update_engine/fake_hardware.h"
-#include "update_engine/test_utils.h"
+#include "update_engine/common/constants.h"
+#include "update_engine/common/fake_hardware.h"
+#include "update_engine/common/test_utils.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::TimeDelta;
diff --git a/update_manager/real_device_policy_provider.cc b/update_manager/real_device_policy_provider.cc
index e7ddb13..0abd9f7 100644
--- a/update_manager/real_device_policy_provider.cc
+++ b/update_manager/real_device_policy_provider.cc
@@ -23,9 +23,9 @@
#include <base/time/time.h>
#include <policy/device_policy.h>
+#include "update_engine/common/utils.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/real_shill_provider.h"
-#include "update_engine/utils.h"
using base::TimeDelta;
using brillo::MessageLoop;
diff --git a/update_manager/real_device_policy_provider_unittest.cc b/update_manager/real_device_policy_provider_unittest.cc
index cd2829d..c480b60 100644
--- a/update_manager/real_device_policy_provider_unittest.cc
+++ b/update_manager/real_device_policy_provider_unittest.cc
@@ -28,8 +28,8 @@
#include <session_manager/dbus-proxies.h>
#include <session_manager/dbus-proxy-mocks.h>
+#include "update_engine/common/test_utils.h"
#include "update_engine/dbus_test_utils.h"
-#include "update_engine/test_utils.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::TimeDelta;
diff --git a/update_manager/real_shill_provider.h b/update_manager/real_shill_provider.h
index 5f3f6bf..dbd6fc5 100644
--- a/update_manager/real_shill_provider.h
+++ b/update_manager/real_shill_provider.h
@@ -26,7 +26,7 @@
#include <base/time/time.h>
#include <dbus/object_path.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
#include "update_engine/shill_proxy_interface.h"
#include "update_engine/update_manager/generic_variables.h"
#include "update_engine/update_manager/shill_provider.h"
diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc
index 7272019..2fa0628 100644
--- a/update_manager/real_shill_provider_unittest.cc
+++ b/update_manager/real_shill_provider_unittest.cc
@@ -27,10 +27,10 @@
#include <shill/dbus-proxies.h>
#include <shill/dbus-proxy-mocks.h>
+#include "update_engine/common/fake_clock.h"
+#include "update_engine/common/test_utils.h"
#include "update_engine/dbus_test_utils.h"
-#include "update_engine/fake_clock.h"
#include "update_engine/fake_shill_proxy.h"
-#include "update_engine/test_utils.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
diff --git a/update_manager/real_system_provider.cc b/update_manager/real_system_provider.cc
index 90173a0..040f37c 100644
--- a/update_manager/real_system_provider.cc
+++ b/update_manager/real_system_provider.cc
@@ -28,8 +28,8 @@
#include <base/strings/stringprintf.h>
#include <base/time/time.h>
+#include "update_engine/common/utils.h"
#include "update_engine/update_manager/generic_variables.h"
-#include "update_engine/utils.h"
using std::string;
diff --git a/update_manager/real_system_provider.h b/update_manager/real_system_provider.h
index a46a698..0329d74 100644
--- a/update_manager/real_system_provider.h
+++ b/update_manager/real_system_provider.h
@@ -20,8 +20,8 @@
#include <memory>
#include <string>
-#include "update_engine/boot_control_interface.h"
-#include "update_engine/hardware_interface.h"
+#include "update_engine/common/boot_control_interface.h"
+#include "update_engine/common/hardware_interface.h"
#include "update_engine/update_manager/system_provider.h"
namespace chromeos_update_manager {
diff --git a/update_manager/real_system_provider_unittest.cc b/update_manager/real_system_provider_unittest.cc
index 35e9be1..5ee4137 100644
--- a/update_manager/real_system_provider_unittest.cc
+++ b/update_manager/real_system_provider_unittest.cc
@@ -21,8 +21,8 @@
#include <base/time/time.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_boot_control.h"
-#include "update_engine/fake_hardware.h"
+#include "update_engine/common/fake_boot_control.h"
+#include "update_engine/common/fake_hardware.h"
#include "update_engine/update_manager/umtest_utils.h"
using std::unique_ptr;
diff --git a/update_manager/real_time_provider.cc b/update_manager/real_time_provider.cc
index 1f3f6f0..ca3acad 100644
--- a/update_manager/real_time_provider.cc
+++ b/update_manager/real_time_provider.cc
@@ -20,7 +20,7 @@
#include <base/time/time.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
using base::Time;
using base::TimeDelta;
diff --git a/update_manager/real_time_provider.h b/update_manager/real_time_provider.h
index 11bdf06..e7cae94 100644
--- a/update_manager/real_time_provider.h
+++ b/update_manager/real_time_provider.h
@@ -21,7 +21,7 @@
#include <base/time/time.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
#include "update_engine/update_manager/time_provider.h"
namespace chromeos_update_manager {
diff --git a/update_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc
index 15fbe4b..0e1ef34 100644
--- a/update_manager/real_time_provider_unittest.cc
+++ b/update_manager/real_time_provider_unittest.cc
@@ -22,7 +22,7 @@
#include <base/time/time.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_clock.h"
+#include "update_engine/common/fake_clock.h"
#include "update_engine/update_manager/umtest_utils.h"
using base::Time;
diff --git a/update_manager/real_updater_provider.cc b/update_manager/real_updater_provider.cc
index 1c2868d..1a3e65a 100644
--- a/update_manager/real_updater_provider.cc
+++ b/update_manager/real_updater_provider.cc
@@ -25,9 +25,9 @@
#include <base/time/time.h>
#include <update_engine/dbus-constants.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
+#include "update_engine/common/prefs.h"
#include "update_engine/omaha_request_params.h"
-#include "update_engine/prefs.h"
#include "update_engine/update_attempter.h"
using base::StringPrintf;
diff --git a/update_manager/real_updater_provider_unittest.cc b/update_manager/real_updater_provider_unittest.cc
index 2f0f9dd..14eb30b 100644
--- a/update_manager/real_updater_provider_unittest.cc
+++ b/update_manager/real_updater_provider_unittest.cc
@@ -23,8 +23,8 @@
#include <gtest/gtest.h>
#include <update_engine/dbus-constants.h>
-#include "update_engine/fake_clock.h"
-#include "update_engine/fake_prefs.h"
+#include "update_engine/common/fake_clock.h"
+#include "update_engine/common/fake_prefs.h"
#include "update_engine/fake_system_state.h"
#include "update_engine/mock_update_attempter.h"
#include "update_engine/omaha_request_params.h"
diff --git a/update_manager/state_factory.cc b/update_manager/state_factory.cc
index f90bd6e..d4f4aa4 100644
--- a/update_manager/state_factory.cc
+++ b/update_manager/state_factory.cc
@@ -20,7 +20,7 @@
#include <base/logging.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
#include "update_engine/update_manager/real_config_provider.h"
#include "update_engine/update_manager/real_device_policy_provider.h"
#include "update_engine/update_manager/real_random_provider.h"
diff --git a/update_manager/update_manager.h b/update_manager/update_manager.h
index 1d1db2e..a2f35df 100644
--- a/update_manager/update_manager.h
+++ b/update_manager/update_manager.h
@@ -25,7 +25,7 @@
#include <base/memory/ref_counted.h>
#include <base/time/time.h>
-#include "update_engine/clock_interface.h"
+#include "update_engine/common/clock_interface.h"
#include "update_engine/update_manager/default_policy.h"
#include "update_engine/update_manager/evaluation_context.h"
#include "update_engine/update_manager/policy.h"
diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc
index 03f37c7..4cc738d 100644
--- a/update_manager/update_manager_unittest.cc
+++ b/update_manager/update_manager_unittest.cc
@@ -34,7 +34,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "update_engine/fake_clock.h"
+#include "update_engine/common/fake_clock.h"
#include "update_engine/update_manager/default_policy.h"
#include "update_engine/update_manager/fake_state.h"
#include "update_engine/update_manager/mock_policy.h"
diff --git a/update_status_utils.h b/update_status_utils.h
index 78d3530..30ae53b 100644
--- a/update_status_utils.h
+++ b/update_status_utils.h
@@ -14,12 +14,12 @@
// limitations under the License.
//
-#ifndef CLIENT_LIBRARY_UPDATE_STATUS_TO_STRING_H_
-#define CLIENT_LIBRARY_UPDATE_STATUS_TO_STRING_H_
+#ifndef UPDATE_ENGINE_UPDATE_STATUS_UTILS_H_
+#define UPDATE_ENGINE_UPDATE_STATUS_UTILS_H_
#include <string>
-#include "update_engine/update_status.h"
+#include "update_engine/client_library/include/update_engine/update_status.h"
namespace chromeos_update_engine {
@@ -30,4 +30,4 @@
} // namespace chromeos_update_engine
-#endif // CLIENT_LIBRARY_UPDATE_STATUS_TO_STRING_H_
+#endif // UPDATE_ENGINE_UPDATE_STATUS_UTILS_H_