summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-10-11 19:09:25 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-10-11 19:09:25 +0200
commitff9b6f63a289c792eb69e7fee59a1f308e9fc4aa (patch)
tree415073930d2bb71cae132e38a57cea3f2c15d7e1
parentMerge "otautil: Fix mac build." (diff)
parentMove rangeset.h and print_sha1.h into otautil. (diff)
downloadandroid_bootable_recovery-ff9b6f63a289c792eb69e7fee59a1f308e9fc4aa.tar
android_bootable_recovery-ff9b6f63a289c792eb69e7fee59a1f308e9fc4aa.tar.gz
android_bootable_recovery-ff9b6f63a289c792eb69e7fee59a1f308e9fc4aa.tar.bz2
android_bootable_recovery-ff9b6f63a289c792eb69e7fee59a1f308e9fc4aa.tar.lz
android_bootable_recovery-ff9b6f63a289c792eb69e7fee59a1f308e9fc4aa.tar.xz
android_bootable_recovery-ff9b6f63a289c792eb69e7fee59a1f308e9fc4aa.tar.zst
android_bootable_recovery-ff9b6f63a289c792eb69e7fee59a1f308e9fc4aa.zip
Diffstat (limited to '')
-rw-r--r--Android.mk1
-rw-r--r--applypatch/Android.mk34
-rw-r--r--applypatch/applypatch.cpp2
-rw-r--r--applypatch/bspatch.cpp2
-rw-r--r--applypatch/imgdiff.cpp2
-rw-r--r--applypatch/include/applypatch/imgdiff_image.h2
-rw-r--r--otautil/include/otautil/print_sha1.h (renamed from print_sha1.h)20
-rw-r--r--otautil/include/otautil/rangeset.h (renamed from rangeset.h)0
-rw-r--r--tests/Android.mk1
-rw-r--r--tests/component/applypatch_test.cpp2
-rw-r--r--tests/component/updater_test.cpp2
-rw-r--r--tests/unit/rangeset_test.cpp4
-rw-r--r--updater/blockimg.cpp4
-rw-r--r--updater/install.cpp4
-rw-r--r--verifier.cpp2
15 files changed, 42 insertions, 40 deletions
diff --git a/Android.mk b/Android.mk
index b40e23dc4..5fe37fd60 100644
--- a/Android.mk
+++ b/Android.mk
@@ -229,6 +229,7 @@ LOCAL_SRC_FILES := \
asn1_decoder.cpp \
verifier.cpp
LOCAL_STATIC_LIBRARIES := \
+ libotautil \
libcrypto_utils \
libcrypto \
libbase
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index 05d937004..66494e607 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -25,12 +25,13 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libapplypatch
LOCAL_MODULE_TAGS := eng
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
- bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+ $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
libedify \
libotafault \
+ libotautil \
libbase \
libcrypto \
libbspatch \
@@ -50,11 +51,12 @@ LOCAL_SRC_FILES := \
imgpatch.cpp
LOCAL_MODULE := libimgpatch
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
- bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+ $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
libedify \
+ libotautil \
libcrypto \
libbspatch \
libbase \
@@ -75,11 +77,12 @@ LOCAL_SRC_FILES := \
LOCAL_MODULE := libimgpatch
LOCAL_MODULE_HOST_OS := linux
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
- bootable/recovery
-LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
+ $(LOCAL_PATH)/include
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
libedify \
+ libotautil \
libcrypto \
libbspatch \
libbase \
@@ -97,9 +100,9 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
applypatch_modes.cpp
LOCAL_MODULE := libapplypatch_modes
-LOCAL_C_INCLUDES := bootable/recovery
LOCAL_STATIC_LIBRARIES := \
libapplypatch \
+ libotautil \
libbase \
libedify \
libcrypto
@@ -111,7 +114,6 @@ include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := applypatch_main.cpp
LOCAL_MODULE := applypatch
-LOCAL_C_INCLUDES := bootable/recovery
LOCAL_STATIC_LIBRARIES := \
libapplypatch_modes \
libapplypatch \
@@ -141,6 +143,7 @@ libimgdiff_cflags := \
-DZLIB_CONST
libimgdiff_static_libraries := \
+ libotautil \
libbsdiff \
libdivsufsort \
libdivsufsort64 \
@@ -161,8 +164,7 @@ LOCAL_CFLAGS := \
LOCAL_STATIC_LIBRARIES := \
$(libimgdiff_static_libraries)
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
- bootable/recovery
+ $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_STATIC_LIBRARY)
@@ -177,8 +179,7 @@ LOCAL_CFLAGS := \
LOCAL_STATIC_LIBRARIES := \
$(libimgdiff_static_libraries)
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
- bootable/recovery
+ $(LOCAL_PATH)/include
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -193,6 +194,5 @@ LOCAL_STATIC_LIBRARIES := \
$(libimgdiff_static_libraries) \
libbz
LOCAL_C_INCLUDES := \
- $(LOCAL_PATH)/include \
- bootable/recovery
+ $(LOCAL_PATH)/include
include $(BUILD_HOST_EXECUTABLE)
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index 729d2a910..c8b75df79 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -40,7 +40,7 @@
#include "edify/expr.h"
#include "otafault/ota_io.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
static int LoadPartitionContents(const std::string& filename, FileContents* file);
static size_t FileSink(const unsigned char* data, size_t len, int fd);
diff --git a/applypatch/bspatch.cpp b/applypatch/bspatch.cpp
index b2f29fbd6..c291464a8 100644
--- a/applypatch/bspatch.cpp
+++ b/applypatch/bspatch.cpp
@@ -31,7 +31,7 @@
#include "applypatch/applypatch.h"
#include "edify/expr.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
void ShowBSDiffLicense() {
puts("The bsdiff library used herein is:\n"
diff --git a/applypatch/imgdiff.cpp b/applypatch/imgdiff.cpp
index c887a854d..3a61a7d0d 100644
--- a/applypatch/imgdiff.cpp
+++ b/applypatch/imgdiff.cpp
@@ -166,7 +166,7 @@
#include <zlib.h>
#include "applypatch/imgdiff_image.h"
-#include "rangeset.h"
+#include "otautil/rangeset.h"
using android::base::get_unaligned;
diff --git a/applypatch/include/applypatch/imgdiff_image.h b/applypatch/include/applypatch/imgdiff_image.h
index 491043dc1..3d29547cb 100644
--- a/applypatch/include/applypatch/imgdiff_image.h
+++ b/applypatch/include/applypatch/imgdiff_image.h
@@ -29,7 +29,7 @@
#include <zlib.h>
#include "imgdiff.h"
-#include "rangeset.h"
+#include "otautil/rangeset.h"
class ImageChunk {
public:
diff --git a/print_sha1.h b/otautil/include/otautil/print_sha1.h
index d0c18b355..03a8d292a 100644
--- a/print_sha1.h
+++ b/otautil/include/otautil/print_sha1.h
@@ -23,25 +23,25 @@
#include <openssl/sha.h>
static std::string print_sha1(const uint8_t* sha1, size_t len) {
- const char* hex = "0123456789abcdef";
- std::string result = "";
- for (size_t i = 0; i < len; ++i) {
- result.push_back(hex[(sha1[i]>>4) & 0xf]);
- result.push_back(hex[sha1[i] & 0xf]);
- }
- return result;
+ const char* hex = "0123456789abcdef";
+ std::string result = "";
+ for (size_t i = 0; i < len; ++i) {
+ result.push_back(hex[(sha1[i] >> 4) & 0xf]);
+ result.push_back(hex[sha1[i] & 0xf]);
+ }
+ return result;
}
[[maybe_unused]] static std::string print_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
- return print_sha1(sha1, SHA_DIGEST_LENGTH);
+ return print_sha1(sha1, SHA_DIGEST_LENGTH);
}
[[maybe_unused]] static std::string short_sha1(const uint8_t sha1[SHA_DIGEST_LENGTH]) {
- return print_sha1(sha1, 4);
+ return print_sha1(sha1, 4);
}
[[maybe_unused]] static std::string print_hex(const uint8_t* bytes, size_t len) {
- return print_sha1(bytes, len);
+ return print_sha1(bytes, len);
}
#endif // RECOVERY_PRINT_SHA1_H
diff --git a/rangeset.h b/otautil/include/otautil/rangeset.h
index f224a08be..f224a08be 100644
--- a/rangeset.h
+++ b/otautil/include/otautil/rangeset.h
diff --git a/tests/Android.mk b/tests/Android.mk
index 31c7de177..b0f71a832 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -201,6 +201,7 @@ LOCAL_SRC_FILES := \
LOCAL_STATIC_LIBRARIES := \
libimgdiff \
libimgpatch \
+ libotautil \
libbsdiff \
libbspatch \
libziparchive \
diff --git a/tests/component/applypatch_test.cpp b/tests/component/applypatch_test.cpp
index 42542898b..15ec08fe7 100644
--- a/tests/component/applypatch_test.cpp
+++ b/tests/component/applypatch_test.cpp
@@ -35,7 +35,7 @@
#include "applypatch/applypatch.h"
#include "applypatch/applypatch_modes.h"
#include "common/test_constants.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
static void sha1sum(const std::string& fname, std::string* sha1, size_t* fsize = nullptr) {
ASSERT_NE(nullptr, sha1);
diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp
index e35870dc7..e6aec4ad6 100644
--- a/tests/component/updater_test.cpp
+++ b/tests/component/updater_test.cpp
@@ -41,7 +41,7 @@
#include "edify/expr.h"
#include "otautil/SysUtil.h"
#include "otautil/error_code.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
#include "updater/blockimg.h"
#include "updater/install.h"
#include "updater/updater.h"
diff --git a/tests/unit/rangeset_test.cpp b/tests/unit/rangeset_test.cpp
index 15bcec855..b3ed99215 100644
--- a/tests/unit/rangeset_test.cpp
+++ b/tests/unit/rangeset_test.cpp
@@ -21,7 +21,7 @@
#include <gtest/gtest.h>
-#include "rangeset.h"
+#include "otautil/rangeset.h"
TEST(RangeSetTest, Parse_smoke) {
RangeSet rs = RangeSet::Parse("2,1,10");
@@ -156,4 +156,4 @@ TEST(SortedRangeSetTest, file_range) {
ASSERT_EQ(static_cast<size_t>(40970), rs.GetOffsetInRangeSet(4096 * 16 + 10));
// block#10 not in range.
ASSERT_EXIT(rs.GetOffsetInRangeSet(40970), ::testing::KilledBySignal(SIGABRT), "");
-} \ No newline at end of file
+}
diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp
index 0f8364441..ce3cea4f3 100644
--- a/updater/blockimg.cpp
+++ b/updater/blockimg.cpp
@@ -52,8 +52,8 @@
#include "edify/expr.h"
#include "otafault/ota_io.h"
#include "otautil/error_code.h"
-#include "print_sha1.h"
-#include "rangeset.h"
+#include "otautil/print_sha1.h"
+#include "otautil/rangeset.h"
#include "updater/install.h"
#include "updater/updater.h"
diff --git a/updater/install.cpp b/updater/install.cpp
index 01210f51c..9425d1872 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -54,6 +54,7 @@
#include <openssl/sha.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
+#include <tune2fs.h>
#include <ziparchive/zip_archive.h>
#include "edify/expr.h"
@@ -61,8 +62,7 @@
#include "otafault/ota_io.h"
#include "otautil/DirUtil.h"
#include "otautil/error_code.h"
-#include "print_sha1.h"
-#include "tune2fs.h"
+#include "otautil/print_sha1.h"
#include "updater/updater.h"
// Send over the buffer to recovery though the command pipe.
diff --git a/verifier.cpp b/verifier.cpp
index 18437fb7a..283e04300 100644
--- a/verifier.cpp
+++ b/verifier.cpp
@@ -32,7 +32,7 @@
#include <openssl/obj_mac.h>
#include "asn1_decoder.h"
-#include "print_sha1.h"
+#include "otautil/print_sha1.h"
static constexpr size_t MiB = 1024 * 1024;