blob: 7b9787693e1768c2a76ab90cd29eebad3ae03135 [file] [log] [blame]
Jay Srinivasanae4697c2013-03-18 17:08:08 -07001// 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 Deymo8427b4a2014-11-05 14:00:32 -08007#include <base/logging.h>
Jay Srinivasanae4697c2013-03-18 17:08:08 -07008
9#include "update_engine/utils.h"
10
11using std::string;
12
13namespace chromeos_update_engine {
14
15InstallPlan::InstallPlan(bool is_resume,
Gilad Arnold21504f02013-05-24 08:51:22 -070016 bool is_full_update,
Jay Srinivasanae4697c2013-03-18 17:08:08 -070017 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 Zeuthene7f89172013-10-31 10:21:04 -070023 const string& kernel_install_path,
Allie Woodfdf00512015-03-02 13:34:55 -080024 const string& source_path,
25 const string& kernel_source_path,
Alex Deymof329b932014-10-30 01:37:48 -070026 const string& public_key_rsa)
Jay Srinivasanae4697c2013-03-18 17:08:08 -070027 : is_resume(is_resume),
Gilad Arnold21504f02013-05-24 08:51:22 -070028 is_full_update(is_full_update),
Jay Srinivasanae4697c2013-03-18 17:08:08 -070029 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 Woodfdf00512015-03-02 13:34:55 -080036 source_path(source_path),
37 kernel_source_path(kernel_source_path),
Jay Srinivasanae4697c2013-03-18 17:08:08 -070038 kernel_size(0),
39 rootfs_size(0),
40 hash_checks_mandatory(false),
David Zeuthene7f89172013-10-31 10:21:04 -070041 powerwash_required(false),
42 public_key_rsa(public_key_rsa) {}
Jay Srinivasanae4697c2013-03-18 17:08:08 -070043
44InstallPlan::InstallPlan() : is_resume(false),
Gilad Arnold21504f02013-05-24 08:51:22 -070045 is_full_update(false), // play it safe.
Jay Srinivasanae4697c2013-03-18 17:08:08 -070046 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
54bool InstallPlan::operator==(const InstallPlan& that) const {
55 return ((is_resume == that.is_resume) &&
Gilad Arnold21504f02013-05-24 08:51:22 -070056 (is_full_update == that.is_full_update) &&
Jay Srinivasanae4697c2013-03-18 17:08:08 -070057 (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 Woodfdf00512015-03-02 13:34:55 -080063 (kernel_install_path == that.kernel_install_path) &&
64 (source_path == that.source_path) &&
65 (kernel_source_path == that.kernel_source_path));
Jay Srinivasanae4697c2013-03-18 17:08:08 -070066}
67
68bool InstallPlan::operator!=(const InstallPlan& that) const {
69 return !((*this) == that);
70}
71
72void InstallPlan::Dump() const {
73 LOG(INFO) << "InstallPlan: "
Gilad Arnold21504f02013-05-24 08:51:22 -070074 << (is_resume ? "resume" : "new_update")
75 << ", payload type: " << (is_full_update ? "full" : "delta")
Jay Srinivasanae4697c2013-03-18 17:08:08 -070076 << ", 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 Woodfdf00512015-03-02 13:34:55 -080083 << ", source_path: " << source_path
84 << ", kernel_source_path: " << kernel_source_path
Jay Srinivasanae4697c2013-03-18 17:08:08 -070085 << ", hash_checks_mandatory: " << utils::ToString(
86 hash_checks_mandatory)
87 << ", powerwash_required: " << utils::ToString(
88 powerwash_required);
89}
90
91} // namespace chromeos_update_engine