blob: 11fe4c33a83eebe1c1d7662c6bce5550fd7cdedb [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
7#include "base/logging.h"
8
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,
Alex Deymof329b932014-10-30 01:37:48 -070024 const string& public_key_rsa)
Jay Srinivasanae4697c2013-03-18 17:08:08 -070025 : is_resume(is_resume),
Gilad Arnold21504f02013-05-24 08:51:22 -070026 is_full_update(is_full_update),
Jay Srinivasanae4697c2013-03-18 17:08:08 -070027 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 Zeuthene7f89172013-10-31 10:21:04 -070037 powerwash_required(false),
38 public_key_rsa(public_key_rsa) {}
Jay Srinivasanae4697c2013-03-18 17:08:08 -070039
40InstallPlan::InstallPlan() : is_resume(false),
Gilad Arnold21504f02013-05-24 08:51:22 -070041 is_full_update(false), // play it safe.
Jay Srinivasanae4697c2013-03-18 17:08:08 -070042 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
50bool InstallPlan::operator==(const InstallPlan& that) const {
51 return ((is_resume == that.is_resume) &&
Gilad Arnold21504f02013-05-24 08:51:22 -070052 (is_full_update == that.is_full_update) &&
Jay Srinivasanae4697c2013-03-18 17:08:08 -070053 (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
62bool InstallPlan::operator!=(const InstallPlan& that) const {
63 return !((*this) == that);
64}
65
66void InstallPlan::Dump() const {
67 LOG(INFO) << "InstallPlan: "
Gilad Arnold21504f02013-05-24 08:51:22 -070068 << (is_resume ? "resume" : "new_update")
69 << ", payload type: " << (is_full_update ? "full" : "delta")
Jay Srinivasanae4697c2013-03-18 17:08:08 -070070 << ", 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