Commit Graph

269 Commits

Author SHA1 Message Date
Tao Bao 7fbc9d39f3 Merge "updater: Add more testcase for symlink()." am: 1b74e8cea8 am: 2c175c302c am: 7da0c7e439
am: 7e62f22d78

Change-Id: Ic5668c046cc51f0a16e98cdb12f3e264d9d8bc39
2016-11-09 19:31:18 +00:00
Tao Bao 8992902aab updater: Add more testcase for symlink().
Clean up SymlinkFn() a bit. Also clean up the temp files created when
running the tests; otherwise non-empty TemporaryDir won't be removed.

Test: recovery_component_test passes.
Change-Id: Id3844abebd168c40125c4dcec54e6ef680a83c3a
2016-11-08 21:29:16 -08:00
Tianjie Xu b66b94c56c Merge "Make make_parent() to take const argument" am: 52e2a97aa7 am: 1fd9f0aff7 am: 260573b3c2
am: cd3513c8dd

Change-Id: I3244b7ff4f67a04b34c3531caae49bb50dc4917f
2016-11-08 21:13:54 +00:00
Tianjie Xu d75003d24c Make make_parent() to take const argument
Switch to use const std::string; and add corresponding tests.

Bug: 32649858
Test: Component tests pass
Change-Id: I640f3ec81f1481fa91aa310f8d4d96dac9649cb9
2016-11-08 10:11:03 -08:00
Tao Bao 88ee9f61bf Merge "updater: Add a testcase for RenameFn()." am: d0daf7f7df am: 05a801ca8e am: 8269eb0d1f
am: 63ae92ded4

Change-Id: Ia4558618507770ff9324883c917b8cc8d09792dd
2016-11-04 21:15:12 +00:00
Tao Bao af03617d81 Merge "updater: Fix a bug in DeleteFn()." am: 529032f4a0 am: 4f91ca78b9 am: 786b083b8e
am: afd1d3af5a

Change-Id: I91d664cdbe14b4b7d70090ba5aebab5a46b57c1c
2016-11-04 16:19:24 +00:00
Tao Bao a659d79b92 updater: Add a testcase for RenameFn().
Test: recovery_component_test passes.

Change-Id: Iba5a0fdf6c79e2bed6b30b8fc19a306c1ab29d8a
2016-11-03 23:35:42 -07:00
Tao Bao 0831d0b592 updater: Fix a bug in DeleteFn().
Also add a testcase for delete() function.

Test: recovery_component_test passes.
Change-Id: I064d1ad4693c3ed339d0a69eabadd08a61a2ea86
2016-11-03 23:28:36 -07:00
Tao Bao 3e8666172b Merge "updater: Fix an off-by-1 bug in file_getprop()." am: da2b34b5d0 am: 917be35f0f am: 4098285e8c
am: 00c7b6112a

Change-Id: Id05ce102be21b9a045a3dac5fa9967914a7e6377
2016-11-04 04:47:15 +00:00
Tao Bao 51d516e913 updater: Fix an off-by-1 bug in file_getprop().
Also add a testcase for file_getprop().

Test: recovery_component_test passes.

Change-Id: I8eb2f9a5702b43997ac9f4b29665eea087b1c146
2016-11-03 14:58:54 -07:00
Tianjie Xu b059c4b554 Merge "Cleanup ReadArgs & ReadValueArgs usage" am: a9b252887c am: 88fc75ee54 am: 0b6085a341
am: c81ef65828

Change-Id: I245bea4f9fd484e7e22422835139b040efa33519
2016-11-02 00:09:35 +00:00
Tianjie Xu 5fe280ac96 Cleanup ReadArgs & ReadValueArgs usage
ReadArgs will switch to using std::string and std::unique_ptr. Also
cleanup the callers.

Test: mma & component test passed.
Change-Id: I4724406ae6c0c134a27bbd1cdd24ad5d343b2a3b
2016-11-01 15:03:06 -07:00
Tao Bao 2f9b98c99f Merge "applypatch: Switch the parameter of Value** to std::vector." am: 3f4030e0ef am: bc48de6bf0 am: edf2928edf
am: 492bd8ca71

Change-Id: Icc5e01085004386771175bda66a9eba9ed76d703
2016-11-01 21:37:21 +00:00
Tao Bao fada91ccf2 applypatch: Switch the parameter of Value** to std::vector.
Test: Unit tests and install-recovery.sh pass on angler and dragon.

Change-Id: I328e6554edca667cf850f5584ebf1ac211e3d4d1
2016-10-28 16:46:12 -07:00
Tianjie Xu 81e54eddd4 resolve merge conflicts of 434697f to master
Change-Id: I0fea3d33b97065a3bf50f8e3669c2b50166a14ed
2016-10-18 15:33:23 -07:00
Tianjie Xu 8cf5c8f60f Replace minzip with libziparchive
Clean up the duplicated codes that handle the zip files in
bootable/recovery; and rename the library of the remaining
utility functions to libotautil.

Test: Update package installed successfully on angler.
Bug: 19472796

Change-Id: Iea8962fcf3004473cb0322b6bb3a9ea3ca7f679e
2016-10-17 17:41:51 -07:00
Tianjie Xu c012c3ce01 Merge "Change StringValue to use std::string" am: 2b17b24ae5 am: 430b7ae469
am: 13d8ee8c72

Change-Id: Ib8730f1656dfea01cb8dcb5a3ee50a40d13179ac
2016-10-18 00:28:30 +00:00
Tianjie Xu aced5d9e4e Change StringValue to use std::string
Changing the field of 'Value' in edify to std::string from char*.
Meanwhile cleaning up the users of 'Value' and switching them to
cpp style.

Test: compontent tests passed.
Bug: 31713288

Change-Id: Iec5a7d601b1e4ca40935bf1c70d325dafecec235
2016-10-15 01:18:23 +00:00
Tao Bao 5f3982056d Merge "edify: Some clean-ups to libedify." am: c5b4b71913 am: 039e9dc5ca am: bd16939bbf
am: 1b1a4edb4b

Change-Id: Idc74e9e549fe61c8b3bb566579821660ecf459c4
2016-10-13 18:02:46 +00:00
Tao Bao 39119ad8ec edify: Some clean-ups to libedify.
- Remove dead declarations in expr.h: SetError(), GetError(),
  ClearError().
- Remove the declaration of Build() out of expr.h.
- Use std::unordered_map to implement RegisterFunction() and
  FindFunction(); kill FinishRegistration().
- Add a testcase for calling unknown functions.

Test: mmma bootable/recovery; recovery_component_test passes.
Change-Id: I9af6825ae677f92b22d716a4a5682f58522af03b
2016-10-12 23:29:59 -07:00
Tao Bao f3d3dca01d Merge "updater: Kill the duplicate PrintSha1() in install.cpp." am: 19bb05dfc7 am: 3ac1995cfd am: aa9f017ceb
am: 998c6debca

Change-Id: Ifb2e1a950c685816a70e4edfb2514319a4b03cc1
2016-10-12 19:48:56 +00:00
Tao Bao df6da4adad Refactor libupdater into a seperate module. am: 0c7839ac14 am: cf1dbfa854 am: 8ff7cd20ba
am: 3a01338332

Change-Id: I1d03d8107d354122edbb88a817b76c490e35210c
2016-10-11 04:00:31 +00:00
Tao Bao 361342cbd2 updater: Kill the duplicate PrintSha1() in install.cpp.
Also add a testcase for sha1_check().

Test: mmma bootable/recovery; recovery_component_test passes.

Change-Id: I4d06d551a771aec84e460148544f68b247a7e721
2016-10-10 20:36:17 -07:00
Tao Bao 0c7839ac14 Refactor libupdater into a seperate module.
So that we can write native tests for updater functions. This CL adds a
testcase for getprop() function.

Test: mmma bootable/recovery; Run recovery_component_test on device.

Change-Id: Iff4c1ff63c5c71aded2f9686fed6b71cc298c228
2016-10-10 16:49:50 -07:00
Tao Bao de40ba59c8 Update the header path for ext4_utils.
Test: `mmma bootable/recovery`
Change-Id: I70ccddb3ddf46bb012fdc5f632afc46ebdd5473e
2016-10-09 14:02:10 -07:00
Tao Bao df0d2a2ae0 Update the header path for ext4_utils.
Test: `mmma bootable/recovery`
Change-Id: I70ccddb3ddf46bb012fdc5f632afc46ebdd5473e
(cherry picked from commit 3cbe1d20978dc488272e2b1ba10890a006fdfab9)
2016-10-07 14:33:34 -07:00
Tao Bao 876b9391c0 edify: Move State.script and State.errmsg to std::string.
This way we kill a few strdup() and free() calls.

Test: 1. recovery_component_test still passes;
2. Applying an update with the new updater works;
3. The error code in a script with abort("E310: xyz") is recorded into
last_install correctly.

Change-Id: Ibda4da5937346e058a0d7cc81764d6f02920010a
(cherry picked from commit 59dcb9cbea)
2016-10-04 15:33:22 -07:00
Tao Bao 59dcb9cbea edify: Move State.script and State.errmsg to std::string.
This way we kill a few strdup() and free() calls.

Test: 1. recovery_component_test still passes;
2. Applying an update with the new updater works;
3. The error code in a script with abort("E310: xyz") is recorded into
last_install correctly.

Change-Id: Ibda4da5937346e058a0d7cc81764d6f02920010a
2016-10-04 14:24:32 -07:00
Tianjie Xu 10e223c181 Turn on -Werror for recovery
am: 17e316cce0

Change-Id: Ia0e1948491edf7cca8b64d7e7f0cac91314c2025
2016-09-30 20:34:23 +00:00
Tianjie Xu 17e316cce0 Turn on -Werror for recovery
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.

Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
(cherry picked from commit 7aa88748f6)
2016-09-30 11:18:01 -07:00
Tianjie Xu 7aa88748f6 Turn on -Werror for recovery
Also remove the 0xff comparison when validating the bootloader
message fields. As the fields won't be erased to 0xff after we
remove the MTD support.

Bug: 28202046
Test: The recovery folder compiles for aosp_x86-eng
Change-Id: Ibb30ea1b2b28676fb08c7e92a1e5f7b6ef3247ab
2016-09-29 19:21:24 -07:00
Elliott Hughes cb22040c63 Switch to <android-base/properties.h>.
Bug: http://b/23102347
Test: boot into recovery.
Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e
Merged-In: Ib2ca560f1312961c21fbaa294bb068de19cb883e
2016-09-26 09:51:37 -07:00
Elliott Hughes 91e3aee9bd Switch to <android-base/properties.h>.
Bug: http://b/23102347
Test: boot into recovery.
Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e
2016-09-23 18:16:35 -07:00
Tianjie Xu 61590bbf0d Merge "Switch recovery to libbase logging" 2016-09-01 23:04:37 +00:00
Tianjie Xu 7b0ad9c638 Switch recovery to libbase logging
Clean up the recovery image and switch to libbase logging.

Bug: 28191554
Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35
Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
2016-09-01 18:33:25 +00:00
Tianjie Xu e22805ef11 Merge "Check an edge case when read(2) returns 0" am: 3202b8faf4 am: 852ae8d0fb am: 0ae9d80082
am: 28f6c43db5

Change-Id: I8fb1470e0f7e675c205bffe95c4fb9d0f202e4ed
2016-09-01 18:07:40 +00:00
Tianjie Xu 747781433f Switch recovery to libbase logging
Clean up the recovery image and switch to libbase logging.

Bug: 28191554
Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35
2016-09-01 17:43:14 +00:00
Tianjie Xu 71e182bc38 Check an edge case when read(2) returns 0
We might end up in an infinite loop if read(2) reached EOF unexpectedly.
The problematic code in uncrypt mentioned in the bug has been fixed
by switching to libbase ReadFully(). So I grepped through the recovery
code and fixed some other occurences of the issue.

Bug: 31073201
Change-Id: Ib867029158ba23363b8f85d61c25058a635c5a6b
2016-08-31 19:11:41 -07:00
Josh Gao 2d7ff437ae Merge "Fix references to libcrypto_utils_static." am: b97da5e0f0 am: dc97404346 am: e6a4195bf7
am: 66571856a1

Change-Id: Ibae209f6fba7adb549cdf2fd9e0323c42240df19
2016-08-08 18:41:47 +00:00
Josh Gao dc97404346 Merge "Fix references to libcrypto_utils_static."
am: b97da5e0f0

Change-Id: Ia935df84e5ea36dfc6605b41872c36db69a114a0
2016-08-08 18:33:51 +00:00
Josh Gao 073164f24b Fix references to libcrypto_utils_static.
Bug: http://b/30708454
Change-Id: I7a5048beff1d8b783a9683dcb4a79606a77f20ee
2016-08-05 18:08:03 -07:00
Elliott Hughes 5f9d7749e9 Merge \\\\"Fix install.h\\\\'s use of attribute printf.\\\\" am: a82ee456bb am: 691db7ba77 am: 7c4a34195f
am: 937ca850ec

Change-Id: I4c496ee69e554f9616b5da98e3e708880060da0e
2016-06-30 18:32:29 +00:00
Elliott Hughes 691db7ba77 Merge \"Fix install.h\'s use of attribute printf.\"
am: a82ee456bb

Change-Id: Ibcfabbb0e044d503f889f1afea271cf73ad93f45
2016-06-30 18:18:40 +00:00
Elliott Hughes 83ce755518 Fix install.h's use of attribute printf.
And move off the bionic __nonnull macro, which I'm removing.

Change-Id: I40b4424f4fd7bd8076e0eee3ec35de36c3ded8de
2016-06-30 09:28:42 -07:00
Tianjie Xu 254b8d0a99 Check the results from applypatch am: 31f8cc84cf am: d0dcbddd31
am: 24488eb7db

Change-Id: I27ebbde5a6a013152b2595ff4bcd372b55afefee
2016-06-16 18:20:30 +00:00
Tianjie Xu 24488eb7db Check the results from applypatch am: 31f8cc84cf
am: d0dcbddd31

Change-Id: I00439aae8f79b0e2a5f7de6566110240492b526a
2016-06-16 18:11:47 +00:00
Tianjie Xu 93110c767f Check the results from applypatch
am: 31f8cc84cf

Change-Id: I2ea241fb3e688f5f8b0558d638dd3ed502223f97
2016-06-16 18:08:59 +00:00
Tianjie Xu 31f8cc84cf Check the results from applypatch
Check the results from applypatch in PerformCommandDiff; and abort the
update on failure.

Bug:29339536
Change-Id: I5087d79ba532b54250f4c17560524255c8a4fabc
2016-06-15 23:26:59 +00:00
Elliott Hughes 26474639b9 resolve merge conflicts of 179c0d8 to stage-aosp-master am: 274d17dc0f am: eaddde6888
am: b36980cc09

Change-Id: I1ebaa7e62c774f08a07360df7d8498872aaf4e9d
2016-06-15 22:50:01 +00:00
Elliott Hughes 274d17dc0f resolve merge conflicts of 179c0d8 to stage-aosp-master
Change-Id: Iba5aec266444cabf83f600f2bdb45a3c027e5995
2016-06-15 15:22:17 -07:00