diff options
author | Doug Zongker <dougz@android.com> | 2010-02-22 14:46:32 -0800 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2010-02-22 15:30:33 -0800 |
commit | c4351c791052ad529a4e83c600b1aa6e6420ea86 (patch) | |
tree | cdc534868eb58ea980bcca2fbc8e04b68fd9936c /applypatch/applypatch.sh | |
parent | 583fc12c3dbe09e3a9b759b9466c505b006e6a39 (diff) | |
download | bootable_recovery-c4351c791052ad529a4e83c600b1aa6e6420ea86.zip bootable_recovery-c4351c791052ad529a4e83c600b1aa6e6420ea86.tar.gz bootable_recovery-c4351c791052ad529a4e83c600b1aa6e6420ea86.tar.bz2 |
refactor applypatch and friends
Change the applypatch function to take meaningful arguments instead of
argc and argv. Move all the parsing of arguments into main.c (for the
standalone binary) and into install.c (for the updater function).
applypatch() takes patches as Value objects, so we can pass in blobs
extracted from the package without ever writing them to temp files.
The patching code is changed to read the patch from memory instead of
a file.
A bunch of compiler warnings (mostly about signed vs unsigned types)
are fixed.
Support for the IMGDIFF1 format is dropped. (We've been generating
IMGDIFF2 packages for some time now.)
Change-Id: I217563c500012750f27110db821928a06211323f
Diffstat (limited to 'applypatch/applypatch.sh')
-rwxr-xr-x | applypatch/applypatch.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/applypatch/applypatch.sh b/applypatch/applypatch.sh index 88f3025..8ea68a1 100755 --- a/applypatch/applypatch.sh +++ b/applypatch/applypatch.sh @@ -11,7 +11,7 @@ # the tests. EMULATOR_PORT=5580 -DATA_DIR=$ANDROID_BUILD_TOP/build/tools/applypatch/testdata +DATA_DIR=$ANDROID_BUILD_TOP/bootable/recovery/applypatch/testdata # This must be the filename that applypatch uses for its copies. CACHE_TEMP_SOURCE=/cache/saved.file @@ -81,6 +81,7 @@ cleanup() { testname "removing test files" run_command rm $WORK_DIR/bloat.dat run_command rm $WORK_DIR/old.file + run_command rm $WORK_DIR/foo run_command rm $WORK_DIR/patch.bsdiff run_command rm $WORK_DIR/applypatch run_command rm $CACHE_TEMP_SOURCE @@ -88,10 +89,12 @@ cleanup() { [ "$pid_emulator" == "" ] || kill $pid_emulator - rm -rf $tmpdir + if [ $# == 0 ]; then + rm -rf $tmpdir + fi } -cleanup +cleanup leave_tmp $ADB push $ANDROID_PRODUCT_OUT/system/bin/applypatch $WORK_DIR/applypatch @@ -153,6 +156,8 @@ run_command $WORK_DIR/applypatch -c $WORK_DIR/old.file $BAD2_SHA1 $BAD1_SHA1 && $ADB push $DATA_DIR/old.file $WORK_DIR $ADB push $DATA_DIR/patch.bsdiff $WORK_DIR +echo hello > $tmpdir/foo +$ADB push $tmpdir/foo $WORK_DIR # Check that the partition has enough space to apply the patch without # copying. If it doesn't, we'll be testing the low-space condition |