zipdiff: use a trick from ./all: use BOTH infozip AND 7zip to make best possible zip file

This commit is contained in:
Rudolf Polzer 2012-03-11 16:13:12 +01:00
parent b8b02b3817
commit 4f8ddad06a
2 changed files with 15 additions and 3 deletions

View File

@ -33,7 +33,7 @@ makepatchname()
echo "$prefix$fromversion"patch"$toversion$suffix" echo "$prefix$fromversion"patch"$toversion$suffix"
} }
zipdiff -z "zip -9r" -f "$from" -t "$to" -o "$output" -x "$excludes" zipdiff -f "$from" -t "$to" -o "$output" -x "$excludes"
tempdir=`mktemp -d -t zipdiff.XXXXXX` tempdir=`mktemp -d -t zipdiff.XXXXXX`
cd "$tempdir" cd "$tempdir"
@ -47,7 +47,7 @@ for x in $excludes; do
patchname=`makepatchname "$x" "$fromname" "$toname"` patchname=`makepatchname "$x" "$fromname" "$toname"`
patchdir="c/$patchname"; patchdir=${patchdir%/*} patchdir="c/$patchname"; patchdir=${patchdir%/*}
mkdir -p "$patchdir" mkdir -p "$patchdir"
zipdiff -z "zip -9r" -f a/"$fromname" -t b/"$toname" -o c/"$patchname" zipdiff -f a/"$fromname" -t b/"$toname" -o c/"$patchname"
if [ -f c/"$patchname" ]; then if [ -f c/"$patchname" ]; then
(cd c && zip -0r "$output" "$patchname") (cd c && zip -0r "$output" "$patchname")
fi fi

View File

@ -14,7 +14,19 @@ output=
from= from=
to= to=
excludes= excludes=
ziptool="7za a -tzip -mx=9" ziptool="mkzip"
mkzip()
{
archive=$1; shift
sevenzipflags=-mx=9
zipflags=-9
ziplist=`mktemp`
find "$@" -xtype f \( -executable -or -type l \) -print > "$ziplist"
7za a -tzip $sevenzipflags -x@"$ziplist" "$archive" "$@" || true
zip $zipflags -y -@<"$ziplist" "$archive" || true
rm -f "$ziplist"
}
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
o=$1 o=$1