blob: 59bd5dab19b756d41bfa26e077fe223ec9c6a8b6 [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,
16 const string& url,
17 uint64_t payload_size,
18 const string& payload_hash,
19 uint64_t metadata_size,
20 const string& metadata_signature,
21 const string& install_path,
22 const string& kernel_install_path)
23 : is_resume(is_resume),
24 download_url(url),
25 payload_size(payload_size),
26 payload_hash(payload_hash),
27 metadata_size(metadata_size),
28 metadata_signature(metadata_signature),
29 install_path(install_path),
30 kernel_install_path(kernel_install_path),
31 kernel_size(0),
32 rootfs_size(0),
33 hash_checks_mandatory(false),
34 powerwash_required(false) {}
35
36InstallPlan::InstallPlan() : is_resume(false),
37 payload_size(0),
38 metadata_size(0),
39 kernel_size(0),
40 rootfs_size(0),
41 hash_checks_mandatory(false),
42 powerwash_required(false) {}
43
44
45bool InstallPlan::operator==(const InstallPlan& that) const {
46 return ((is_resume == that.is_resume) &&
47 (download_url == that.download_url) &&
48 (payload_size == that.payload_size) &&
49 (payload_hash == that.payload_hash) &&
50 (metadata_size == that.metadata_size) &&
51 (metadata_signature == that.metadata_signature) &&
52 (install_path == that.install_path) &&
53 (kernel_install_path == that.kernel_install_path));
54}
55
56bool InstallPlan::operator!=(const InstallPlan& that) const {
57 return !((*this) == that);
58}
59
60void InstallPlan::Dump() const {
61 LOG(INFO) << "InstallPlan: "
62 << (is_resume ? ", resume" : ", new_update")
63 << ", url: " << download_url
64 << ", payload size: " << payload_size
65 << ", payload hash: " << payload_hash
66 << ", metadata size: " << metadata_size
67 << ", metadata signature: " << metadata_signature
68 << ", install_path: " << install_path
69 << ", kernel_install_path: " << kernel_install_path
70 << ", hash_checks_mandatory: " << utils::ToString(
71 hash_checks_mandatory)
72 << ", powerwash_required: " << utils::ToString(
73 powerwash_required);
74}
75
76} // namespace chromeos_update_engine
77