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, |
| 23 | const string& kernel_install_path) |
| 24 | : is_resume(is_resume), |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame^] | 25 | is_full_update(is_full_update), |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 26 | download_url(url), |
| 27 | payload_size(payload_size), |
| 28 | payload_hash(payload_hash), |
| 29 | metadata_size(metadata_size), |
| 30 | metadata_signature(metadata_signature), |
| 31 | install_path(install_path), |
| 32 | kernel_install_path(kernel_install_path), |
| 33 | kernel_size(0), |
| 34 | rootfs_size(0), |
| 35 | hash_checks_mandatory(false), |
| 36 | powerwash_required(false) {} |
| 37 | |
| 38 | InstallPlan::InstallPlan() : is_resume(false), |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame^] | 39 | is_full_update(false), // play it safe. |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 40 | payload_size(0), |
| 41 | metadata_size(0), |
| 42 | kernel_size(0), |
| 43 | rootfs_size(0), |
| 44 | hash_checks_mandatory(false), |
| 45 | powerwash_required(false) {} |
| 46 | |
| 47 | |
| 48 | bool InstallPlan::operator==(const InstallPlan& that) const { |
| 49 | return ((is_resume == that.is_resume) && |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame^] | 50 | (is_full_update == that.is_full_update) && |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 51 | (download_url == that.download_url) && |
| 52 | (payload_size == that.payload_size) && |
| 53 | (payload_hash == that.payload_hash) && |
| 54 | (metadata_size == that.metadata_size) && |
| 55 | (metadata_signature == that.metadata_signature) && |
| 56 | (install_path == that.install_path) && |
| 57 | (kernel_install_path == that.kernel_install_path)); |
| 58 | } |
| 59 | |
| 60 | bool InstallPlan::operator!=(const InstallPlan& that) const { |
| 61 | return !((*this) == that); |
| 62 | } |
| 63 | |
| 64 | void InstallPlan::Dump() const { |
| 65 | LOG(INFO) << "InstallPlan: " |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame^] | 66 | << (is_resume ? "resume" : "new_update") |
| 67 | << ", payload type: " << (is_full_update ? "full" : "delta") |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 68 | << ", url: " << download_url |
| 69 | << ", payload size: " << payload_size |
| 70 | << ", payload hash: " << payload_hash |
| 71 | << ", metadata size: " << metadata_size |
| 72 | << ", metadata signature: " << metadata_signature |
| 73 | << ", install_path: " << install_path |
| 74 | << ", kernel_install_path: " << kernel_install_path |
| 75 | << ", hash_checks_mandatory: " << utils::ToString( |
| 76 | hash_checks_mandatory) |
| 77 | << ", powerwash_required: " << utils::ToString( |
| 78 | powerwash_required); |
| 79 | } |
| 80 | |
| 81 | } // namespace chromeos_update_engine |
| 82 | |