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 | |
Alex Deymo | 8427b4a | 2014-11-05 14:00:32 -0800 | [diff] [blame] | 7 | #include <base/logging.h> |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 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, |
Allie Wood | fdf0051 | 2015-03-02 13:34:55 -0800 | [diff] [blame] | 24 | const string& source_path, |
| 25 | const string& kernel_source_path, |
Alex Deymo | f329b93 | 2014-10-30 01:37:48 -0700 | [diff] [blame] | 26 | const string& public_key_rsa) |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 27 | : is_resume(is_resume), |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 28 | is_full_update(is_full_update), |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 29 | download_url(url), |
| 30 | payload_size(payload_size), |
| 31 | payload_hash(payload_hash), |
| 32 | metadata_size(metadata_size), |
| 33 | metadata_signature(metadata_signature), |
| 34 | install_path(install_path), |
| 35 | kernel_install_path(kernel_install_path), |
Allie Wood | fdf0051 | 2015-03-02 13:34:55 -0800 | [diff] [blame] | 36 | source_path(source_path), |
| 37 | kernel_source_path(kernel_source_path), |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 38 | kernel_size(0), |
| 39 | rootfs_size(0), |
| 40 | hash_checks_mandatory(false), |
David Zeuthen | e7f8917 | 2013-10-31 10:21:04 -0700 | [diff] [blame] | 41 | powerwash_required(false), |
| 42 | public_key_rsa(public_key_rsa) {} |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 43 | |
| 44 | InstallPlan::InstallPlan() : is_resume(false), |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 45 | is_full_update(false), // play it safe. |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 46 | payload_size(0), |
| 47 | metadata_size(0), |
| 48 | kernel_size(0), |
| 49 | rootfs_size(0), |
| 50 | hash_checks_mandatory(false), |
| 51 | powerwash_required(false) {} |
| 52 | |
| 53 | |
| 54 | bool InstallPlan::operator==(const InstallPlan& that) const { |
| 55 | return ((is_resume == that.is_resume) && |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 56 | (is_full_update == that.is_full_update) && |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 57 | (download_url == that.download_url) && |
| 58 | (payload_size == that.payload_size) && |
| 59 | (payload_hash == that.payload_hash) && |
| 60 | (metadata_size == that.metadata_size) && |
| 61 | (metadata_signature == that.metadata_signature) && |
| 62 | (install_path == that.install_path) && |
Allie Wood | fdf0051 | 2015-03-02 13:34:55 -0800 | [diff] [blame] | 63 | (kernel_install_path == that.kernel_install_path) && |
| 64 | (source_path == that.source_path) && |
| 65 | (kernel_source_path == that.kernel_source_path)); |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | bool InstallPlan::operator!=(const InstallPlan& that) const { |
| 69 | return !((*this) == that); |
| 70 | } |
| 71 | |
| 72 | void InstallPlan::Dump() const { |
| 73 | LOG(INFO) << "InstallPlan: " |
Gilad Arnold | 21504f0 | 2013-05-24 08:51:22 -0700 | [diff] [blame] | 74 | << (is_resume ? "resume" : "new_update") |
| 75 | << ", payload type: " << (is_full_update ? "full" : "delta") |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 76 | << ", url: " << download_url |
| 77 | << ", payload size: " << payload_size |
| 78 | << ", payload hash: " << payload_hash |
| 79 | << ", metadata size: " << metadata_size |
| 80 | << ", metadata signature: " << metadata_signature |
| 81 | << ", install_path: " << install_path |
| 82 | << ", kernel_install_path: " << kernel_install_path |
Allie Wood | fdf0051 | 2015-03-02 13:34:55 -0800 | [diff] [blame] | 83 | << ", source_path: " << source_path |
| 84 | << ", kernel_source_path: " << kernel_source_path |
Jay Srinivasan | ae4697c | 2013-03-18 17:08:08 -0700 | [diff] [blame] | 85 | << ", hash_checks_mandatory: " << utils::ToString( |
| 86 | hash_checks_mandatory) |
| 87 | << ", powerwash_required: " << utils::ToString( |
| 88 | powerwash_required); |
| 89 | } |
| 90 | |
| 91 | } // namespace chromeos_update_engine |