OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "update_engine/delta_diff_generator.h" | 5 #include "update_engine/delta_diff_generator.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <inttypes.h> | 9 #include <inttypes.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 &block_size)); | 604 &block_size)); |
605 size = static_cast<int64_t>(block_count) * block_size; | 605 size = static_cast<int64_t>(block_count) * block_size; |
606 } | 606 } |
607 TEST_AND_RETURN_FALSE(size > 0); | 607 TEST_AND_RETURN_FALSE(size > 0); |
608 info->set_size(size); | 608 info->set_size(size); |
609 OmahaHashCalculator hasher; | 609 OmahaHashCalculator hasher; |
610 TEST_AND_RETURN_FALSE(hasher.UpdateFile(partition, size) == size); | 610 TEST_AND_RETURN_FALSE(hasher.UpdateFile(partition, size) == size); |
611 TEST_AND_RETURN_FALSE(hasher.Finalize()); | 611 TEST_AND_RETURN_FALSE(hasher.Finalize()); |
612 const vector<char>& hash = hasher.raw_hash(); | 612 const vector<char>& hash = hasher.raw_hash(); |
613 info->set_hash(hash.data(), hash.size()); | 613 info->set_hash(hash.data(), hash.size()); |
| 614 LOG(INFO) << "hash: " << hasher.hash(); |
614 return true; | 615 return true; |
615 } | 616 } |
616 | 617 |
617 bool InitializePartitionInfos(const string& old_kernel, | 618 bool InitializePartitionInfos(const string& old_kernel, |
618 const string& new_kernel, | 619 const string& new_kernel, |
619 const string& old_rootfs, | 620 const string& old_rootfs, |
620 const string& new_rootfs, | 621 const string& new_rootfs, |
621 DeltaArchiveManifest* manifest) { | 622 DeltaArchiveManifest* manifest) { |
622 if (!old_kernel.empty()) { | 623 // TODO(petkov): Generate the old kernel info when we stop generating full |
623 TEST_AND_RETURN_FALSE( | 624 // updates for the kernel partition. |
624 InitializePartitionInfo(true, | |
625 old_kernel, | |
626 manifest->mutable_old_kernel_info())); | |
627 } | |
628 TEST_AND_RETURN_FALSE( | 625 TEST_AND_RETURN_FALSE( |
629 InitializePartitionInfo(true, | 626 InitializePartitionInfo(true, |
630 new_kernel, | 627 new_kernel, |
631 manifest->mutable_new_kernel_info())); | 628 manifest->mutable_new_kernel_info())); |
632 if (!old_rootfs.empty()) { | 629 if (!old_rootfs.empty()) { |
633 TEST_AND_RETURN_FALSE( | 630 TEST_AND_RETURN_FALSE( |
634 InitializePartitionInfo(false, | 631 InitializePartitionInfo(false, |
635 old_rootfs, | 632 old_rootfs, |
636 manifest->mutable_old_rootfs_info())); | 633 manifest->mutable_old_rootfs_info())); |
637 } | 634 } |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 | 1509 |
1513 LOG(INFO) << "All done. Successfully created delta file."; | 1510 LOG(INFO) << "All done. Successfully created delta file."; |
1514 return true; | 1511 return true; |
1515 } | 1512 } |
1516 | 1513 |
1517 const char* const kBsdiffPath = "/usr/bin/bsdiff"; | 1514 const char* const kBsdiffPath = "/usr/bin/bsdiff"; |
1518 const char* const kBspatchPath = "/usr/bin/bspatch"; | 1515 const char* const kBspatchPath = "/usr/bin/bspatch"; |
1519 const char* const kDeltaMagic = "CrAU"; | 1516 const char* const kDeltaMagic = "CrAU"; |
1520 | 1517 |
1521 }; // namespace chromeos_update_engine | 1518 }; // namespace chromeos_update_engine |
OLD | NEW |