diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-12-16T14·59+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-12-16T14·59+0000 |
commit | f4041cc175df8bc3fa5810948cc2a33eb1159a06 (patch) | |
tree | c235d22af79323f9f0221f05c6f977916e2fa59e | |
parent | 77970f8dafb540a598fd90ad360c42fbea36bf30 (diff) |
* Commit old changed to bdiff.sh - but bdiff.sh is obsolete.
-rwxr-xr-x | patch/bdiff.sh | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/patch/bdiff.sh b/patch/bdiff.sh index 1515319738d3..1a4381529468 100755 --- a/patch/bdiff.sh +++ b/patch/bdiff.sh @@ -1,7 +1,7 @@ #! /bin/sh -e -#DIFF=/home/eelco/Dev/nix/zdelta-2.1/zdc -DIFF=/home/eelco/Dev/nix/bsdiff-4.2/bsdiff +#DIFF=zdc +DIFF=bsdiff srcA=$1 srcB=$2 @@ -15,26 +15,38 @@ fi if test -f "$srcA/$fn"; then - echo "FILE DELTA FOR $fn" + if ! test -f "$srcB/$fn"; then + echo "DELETE $fn" + else - TMPFILE=/tmp/__bsdiff - $DIFF "$srcA/$fn" "$srcB/$fn" $TMPFILE - cat $TMPFILE + if ! cmp "$srcA/$fn" "$srcB/$fn" > /dev/null; then + + echo "FILE DELTA FOR $fn" - diffSize=$(stat -c '%s' $TMPFILE) + TMPFILE=/tmp/__bsdiff + $DIFF "$srcA/$fn" "$srcB/$fn" $TMPFILE + cat $TMPFILE - # For comparison. - bzipSize=$(bzip2 < "$srcB/$fn" | wc -m) + diffSize=$(stat -c '%s' $TMPFILE) - gain=$(echo "scale=2; ($diffSize - $bzipSize) / $bzipSize * 100" | bc) + # For comparison. + bzipSize=$(bzip2 < "$srcB/$fn" | wc -m) - ouch=$(if test "${gain:0:1}" != "-"; then echo "!"; fi) + gain=$(echo "scale=2; ($diffSize - $bzipSize) / $bzipSize * 100" | bc) - printf "%7.2f %1s %10d %10d %s\n" \ - "$gain" "$ouch" "$diffSize" "$bzipSize" "$fn" >&2 + ouch=$(if test "${gain:0:1}" != "-"; then echo "!"; fi) + + printf "%7.2f %1s %10d %10d %s\n" \ + "$gain" "$ouch" "$diffSize" "$bzipSize" "$fn" >&2 # echo "$fn -> $diffSize $bzipSize ==> $gain $ouch" >&2 - rm $TMPFILE + rm $TMPFILE + + fi + + fi + + # Note: be silent about unchanged files. else |