Move bzip.h to payload_generator.
The in-memory bzip compression and decompression functions are only
used during payload generation and testing. This patch moves those
functions to the payload_generator/ directory and keeps the streamed
version (bzip_extent_writter.h) in the update_engine daemon.
Bug: None
Test: FEATURES=test emerge-link update_engine; `mm` on Brillo.
Change-Id: I78227fdac15df6461b23debb41c72207b22fb5db
diff --git a/Android.mk b/Android.mk
index c3b0fda..56e2514 100644
--- a/Android.mk
+++ b/Android.mk
@@ -127,7 +127,6 @@
action_processor.cc \
boot_control_android.cc \
boot_control_stub.cc \
- bzip.cc \
bzip_extent_writer.cc \
certificate_checker.cc \
chrome_browser_proxy_resolver.cc \
@@ -272,6 +271,7 @@
payload_generator/annotated_operation.cc \
payload_generator/blob_file_writer.cc \
payload_generator/block_mapping.cc \
+ payload_generator/bzip.cc \
payload_generator/cycle_breaker.cc \
payload_generator/delta_diff_generator.cc \
payload_generator/delta_diff_utils.cc \
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc
index db19729..119ad5f 100644
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -29,12 +29,12 @@
#include <google/protobuf/repeated_field.h>
#include <gtest/gtest.h>
-#include "update_engine/bzip.h"
#include "update_engine/constants.h"
#include "update_engine/fake_hardware.h"
#include "update_engine/fake_prefs.h"
#include "update_engine/fake_system_state.h"
#include "update_engine/payload_constants.h"
+#include "update_engine/payload_generator/bzip.h"
#include "update_engine/payload_generator/extent_ranges.h"
#include "update_engine/payload_generator/payload_file.h"
#include "update_engine/payload_generator/payload_signer.h"
diff --git a/bzip.cc b/payload_generator/bzip.cc
similarity index 98%
rename from bzip.cc
rename to payload_generator/bzip.cc
index b329adc..287b69c 100644
--- a/bzip.cc
+++ b/payload_generator/bzip.cc
@@ -14,17 +14,17 @@
// limitations under the License.
//
-#include "update_engine/bzip.h"
+#include "update_engine/payload_generator/bzip.h"
-#include <stdlib.h>
-#include <algorithm>
#include <bzlib.h>
+#include <stdlib.h>
+
+#include <algorithm>
#include <limits>
#include "update_engine/utils.h"
using std::string;
-using std::vector;
namespace chromeos_update_engine {
diff --git a/bzip.h b/payload_generator/bzip.h
similarity index 87%
rename from bzip.h
rename to payload_generator/bzip.h
index 4293526..ca9956e 100644
--- a/bzip.h
+++ b/payload_generator/bzip.h
@@ -14,8 +14,8 @@
// limitations under the License.
//
-#ifndef UPDATE_ENGINE_BZIP_H_
-#define UPDATE_ENGINE_BZIP_H_
+#ifndef UPDATE_ENGINE_PAYLOAD_GENERATOR_BZIP_H_
+#define UPDATE_ENGINE_PAYLOAD_GENERATOR_BZIP_H_
#include <string>
#include <vector>
@@ -32,4 +32,4 @@
} // namespace chromeos_update_engine
-#endif // UPDATE_ENGINE_BZIP_H_
+#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_BZIP_H_
diff --git a/payload_generator/full_update_generator.cc b/payload_generator/full_update_generator.cc
index f2db3a8..f9173ef 100644
--- a/payload_generator/full_update_generator.cc
+++ b/payload_generator/full_update_generator.cc
@@ -30,10 +30,9 @@
#include <base/threading/simple_thread.h>
#include <brillo/secure_blob.h>
-#include "update_engine/bzip.h"
+#include "update_engine/payload_generator/bzip.h"
#include "update_engine/utils.h"
-using std::string;
using std::vector;
namespace chromeos_update_engine {
diff --git a/zip_unittest.cc b/payload_generator/zip_unittest.cc
similarity index 78%
rename from zip_unittest.cc
rename to payload_generator/zip_unittest.cc
index 4d6eb21..f2c569b 100644
--- a/zip_unittest.cc
+++ b/payload_generator/zip_unittest.cc
@@ -22,9 +22,8 @@
#include <gtest/gtest.h>
-#include "update_engine/bzip.h"
+#include "update_engine/payload_generator/bzip.h"
#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
using chromeos_update_engine::test_utils::kRandomString;
using std::string;
@@ -35,14 +34,10 @@
template <typename T>
class ZipTest : public ::testing::Test {
public:
- bool ZipDecompress(const brillo::Blob& in,
- brillo::Blob* out) const = 0;
- bool ZipCompress(const brillo::Blob& in,
- brillo::Blob* out) const = 0;
- bool ZipCompressString(const string& str,
- brillo::Blob* out) const = 0;
- bool ZipDecompressString(const string& str,
- brillo::Blob* out) const = 0;
+ bool ZipDecompress(const brillo::Blob& in, brillo::Blob* out) const = 0;
+ bool ZipCompress(const brillo::Blob& in, brillo::Blob* out) const = 0;
+ bool ZipCompressString(const string& str, brillo::Blob* out) const = 0;
+ bool ZipDecompressString(const string& str, brillo::Blob* out) const = 0;
};
class BzipTest {};
@@ -50,20 +45,16 @@
template <>
class ZipTest<BzipTest> : public ::testing::Test {
public:
- bool ZipDecompress(const brillo::Blob& in,
- brillo::Blob* out) const {
+ bool ZipDecompress(const brillo::Blob& in, brillo::Blob* out) const {
return BzipDecompress(in, out);
}
- bool ZipCompress(const brillo::Blob& in,
- brillo::Blob* out) const {
+ bool ZipCompress(const brillo::Blob& in, brillo::Blob* out) const {
return BzipCompress(in, out);
}
- bool ZipCompressString(const string& str,
- brillo::Blob* out) const {
+ bool ZipCompressString(const string& str, brillo::Blob* out) const {
return BzipCompressString(str, out);
}
- bool ZipDecompressString(const string& str,
- brillo::Blob* out) const {
+ bool ZipDecompressString(const string& str, brillo::Blob* out) const {
return BzipDecompressString(str, out);
}
};
diff --git a/update_engine.gyp b/update_engine.gyp
index 5d229ec..52b8f0f 100644
--- a/update_engine.gyp
+++ b/update_engine.gyp
@@ -160,7 +160,6 @@
'action_processor.cc',
'boot_control_chromeos.cc',
'boot_control_stub.cc',
- 'bzip.cc',
'bzip_extent_writer.cc',
'certificate_checker.cc',
'chrome_browser_proxy_resolver.cc',
@@ -292,6 +291,7 @@
'payload_generator/annotated_operation.cc',
'payload_generator/blob_file_writer.cc',
'payload_generator/block_mapping.cc',
+ 'payload_generator/bzip.cc',
'payload_generator/cycle_breaker.cc',
'payload_generator/delta_diff_generator.cc',
'payload_generator/delta_diff_utils.cc',
@@ -429,6 +429,7 @@
'payload_generator/payload_file_unittest.cc',
'payload_generator/tarjan_unittest.cc',
'payload_generator/topological_sort_unittest.cc',
+ 'payload_generator/zip_unittest.cc',
'payload_state_unittest.cc',
'postinstall_runner_action_unittest.cc',
'prefs_unittest.cc',
@@ -453,7 +454,6 @@
'update_manager/variable_unittest.cc',
'utils_unittest.cc',
'xz_extent_writer_unittest.cc',
- 'zip_unittest.cc',
# Main entry point for runnning tests.
'testrunner.cc',
],