From c4351c791052ad529a4e83c600b1aa6e6420ea86 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Mon, 22 Feb 2010 14:46:32 -0800 Subject: 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 --- applypatch/applypatch.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'applypatch/applypatch.sh') 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 -- cgit v1.1