Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 1 | // Copyright (c) 2013 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "update_engine/install_plan.h" |
| 6 | |
| 7 | #include "base/logging.h" |
| 8 | |
| 9 | #include "update_engine/utils.h" |
| 10 | |
| 11 | using std::string; |
| 12 | |
| 13 | namespace chromeos_update_engine { |
| 14 | |
| 15 | InstallPlan::InstallPlan(bool is_resume, |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 16 | bool is_full_update, |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 17 | const string& url, |
| 18 | uint64_t payload_size, |
| 19 | const string& payload_hash, |
| 20 | uint64_t metadata_size, |
| 21 | const string& metadata_signature, |
| 22 | const string& install_path, |
David Zeuthen | e7f8917 | 2013-10-31 10:21:04 -0700 | [diff] [blame] | 23 | const string& kernel_install_path, |
Alex Deymo | f329b93 | 2014-10-30 01:37:48 -0700 | [diff] [blame] | 24 | const string& public_key_rsa) |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 25 | : is_resume(is_resume), |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 26 | is_full_update(is_full_update), |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 27 | download_url(url), |
| 28 | payload_size(payload_size), |
| 29 | payload_hash(payload_hash), |
| 30 | metadata_size(metadata_size), |
| 31 | metadata_signature(metadata_signature), |
| 32 | install_path(install_path), |
| 33 | kernel_install_path(kernel_install_path), |
| 34 | kernel_size(0), |
| 35 | rootfs_size(0), |
| 36 | hash_checks_mandatory(false), |
David Zeuthen | e7f8917 | 2013-10-31 10:21:04 -0700 | [diff] [blame] | 37 | powerwash_required(false), |
| 38 | public_key_rsa(public_key_rsa) {} |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 39 | |
| 40 | InstallPlan::InstallPlan() : is_resume(false), |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 41 | is_full_update(false), // play it safe. |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 42 | payload_size(0), |
| 43 | metadata_size(0), |
| 44 | kernel_size(0), |
| 45 | rootfs_size(0), |
| 46 | hash_checks_mandatory(false), |
| 47 | powerwash_required(false) {} |
| 48 | |
| 49 | |
| 50 | bool InstallPlan::operator==(const InstallPlan& that) const { |
| 51 | return ((is_resume == that.is_resume) && |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 52 | (is_full_update == that.is_full_update) && |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 53 | (download_url == that.download_url) && |
| 54 | (payload_size == that.payload_size) && |
| 55 | (payload_hash == that.payload_hash) && |
| 56 | (metadata_size == that.metadata_size) && |
| 57 | (metadata_signature == that.metadata_signature) && |
| 58 | (install_path == that.install_path) && |
| 59 | (kernel_install_path == that.kernel_install_path)); |
| 60 | } |
| 61 | |
| 62 | bool InstallPlan::operator!=(const InstallPlan& that) const { |
| 63 | return !((*this) == that); |
| 64 | } |
| 65 | |
| 66 | void InstallPlan::Dump() const { |
| 67 | LOG(INFO) << "InstallPlan: " |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 68 | << (is_resume ? "resume" : "new_update") |
| 69 | << ", payload type: " << (is_full_update ? "full" : "delta") |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 70 | << ", url: " << download_url |
| 71 | << ", payload size: " << payload_size |
| 72 | << ", payload hash: " << payload_hash |
| 73 | << ", metadata size: " << metadata_size |
| 74 | << ", metadata signature: " << metadata_signature |
| 75 | << ", install_path: " << install_path |
| 76 | << ", kernel_install_path: " << kernel_install_path |
| 77 | << ", hash_checks_mandatory: " << utils::ToString( |
| 78 | hash_checks_mandatory) |
| 79 | << ", powerwash_required: " << utils::ToString( |
| 80 | powerwash_required); |
| 81 | } |
| 82 | |
| 83 | } // namespace chromeos_update_engine |