blob: a17cb52cd7a0382fe5d8b524d48c63ef04beda2b [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,
23 const string& kernel_install_path)
24 : is_resume(is_resume),
Gilad Arnold21504f02013-05-24 08:51:22 -070025 is_full_update(is_full_update),
Jay Srinivasanae4697c2013-03-18 17:08:08 -070026 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
38InstallPlan::InstallPlan() : is_resume(false),
Gilad Arnold21504f02013-05-24 08:51:22 -070039 is_full_update(false), // play it safe.
Jay Srinivasanae4697c2013-03-18 17:08:08 -070040 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
48bool InstallPlan::operator==(const InstallPlan& that) const {
49 return ((is_resume == that.is_resume) &&
Gilad Arnold21504f02013-05-24 08:51:22 -070050 (is_full_update == that.is_full_update) &&
Jay Srinivasanae4697c2013-03-18 17:08:08 -070051 (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
60bool InstallPlan::operator!=(const InstallPlan& that) const {
61 return !((*this) == that);
62}
63
64void InstallPlan::Dump() const {
65 LOG(INFO) << "InstallPlan: "
Gilad Arnold21504f02013-05-24 08:51:22 -070066 << (is_resume ? "resume" : "new_update")
67 << ", payload type: " << (is_full_update ? "full" : "delta")
Jay Srinivasanae4697c2013-03-18 17:08:08 -070068 << ", 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