mirror of
https://gitlab.com/xonotic/xonotic
synced 2025-02-13 00:57:14 +00:00
diff two xonotic release-like builds (untested)
This commit is contained in:
parent
13db60bfb6
commit
37311e3564
52
misc/tools/xzipdiff
Executable file
52
misc/tools/xzipdiff
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
from=$1
|
||||||
|
to=$2
|
||||||
|
output=$3
|
||||||
|
case "$from" in /*) ;; *) from=`pwd`/$from ;; esac
|
||||||
|
case "$to" in /*) ;; *) to=`pwd`/$to ;; esac
|
||||||
|
case "$output" in /*) ;; *) output=`pwd`/$output ;; esac
|
||||||
|
|
||||||
|
excludes="
|
||||||
|
data/xonotic-*-data.pk3
|
||||||
|
data/xonotic-*-maps.pk3
|
||||||
|
data/xonotic-*-music.pk3
|
||||||
|
data/xonotic-*-nexcompat.pk3
|
||||||
|
"
|
||||||
|
|
||||||
|
makepatchname()
|
||||||
|
{
|
||||||
|
wildcard=$1
|
||||||
|
fromname=$2
|
||||||
|
toname=$3
|
||||||
|
prefix=${wildcard##*\*}
|
||||||
|
suffix=${wildcard%\**}
|
||||||
|
fromversion=${fromname#$prefix}
|
||||||
|
fromversion=${fromversion%$suffix}
|
||||||
|
toversion=${fromname#$prefix}
|
||||||
|
toversion=${fromversion%$suffix}
|
||||||
|
echo "$prefix$fromversion"patch"$toversion$suffix"
|
||||||
|
}
|
||||||
|
|
||||||
|
zipdiff -f "$from" -t "$to" -o "$output" -x "$excludes"
|
||||||
|
|
||||||
|
tempdir=`mktemp -d -t zipdiff.XXXXXX`
|
||||||
|
cd "$tempdir"
|
||||||
|
|
||||||
|
for x in $excludes; do
|
||||||
|
mkdir a b c
|
||||||
|
(cd a && unzip "$from" "$x")
|
||||||
|
fromname=`find a/ -type f`; fromname=${fromname#a/}
|
||||||
|
(cd b && unzip "$to" "$x")
|
||||||
|
toname=`find b/ -type f`; toname=${toname#b/}
|
||||||
|
patchname=`makepatchname "$x" "$fromname" "$toname"`
|
||||||
|
patchdir="c/$patchname"; patchdir=${patchdir%/*}
|
||||||
|
mkdir -p "$patchdir"
|
||||||
|
zipdiff -f a/"$fromname" -t b/"$toname" -o c/"$patchname"
|
||||||
|
if [ -f c/"$patchname" ]; then
|
||||||
|
(cd c && zip -0r "$output" "$patchname")
|
||||||
|
fi
|
||||||
|
rm -rf a b c
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -rf "$tempdir"
|
@ -148,23 +148,25 @@ case "$output" in
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
rm -f "$output"
|
rm -f "$output"
|
||||||
echo "$result" | while IFS= read -r line; do
|
if [ -n "$result" ]; then
|
||||||
echo >&2 "extracting $line..."
|
echo "$result" | while IFS= read -r line; do
|
||||||
dline=./$line
|
echo >&2 "extracting $line..."
|
||||||
mkdir -p "$tempdir/${dline%/*}"
|
dline=./$line
|
||||||
unzip -p "$to" "$line" > "$tempdir/$line" # this may create an empty file - don't care, DP handles this as deletion
|
mkdir -p "$tempdir/${dline%/*}"
|
||||||
done
|
unzip -p "$to" "$line" > "$tempdir/$line" # this may create an empty file - don't care, DP handles this as deletion
|
||||||
case "$output" in
|
done
|
||||||
/*)
|
case "$output" in
|
||||||
;;
|
/*)
|
||||||
*)
|
;;
|
||||||
output=`pwd`/$output
|
*)
|
||||||
;;
|
output=`pwd`/$output
|
||||||
esac
|
;;
|
||||||
cd "$tempdir"
|
esac
|
||||||
#zip -9r "$output" .
|
cd "$tempdir"
|
||||||
7za a -tzip -mx=9 "$output" .
|
#zip -9r "$output" .
|
||||||
cd ..
|
7za a -tzip -mx=9 "$output" .
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user