Convert POSIX paths to Windows paths for mbsdiff on Windows

This commit is contained in:
Dan Stillman 2023-05-20 12:20:28 +01:00
parent d9f86a6293
commit 8dd1db9839
3 changed files with 18 additions and 19 deletions

View file

@ -57,6 +57,12 @@ if [ "`uname`" = "Darwin" ]; then
shopt -s expand_aliases
fi
if [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
export WIN_NATIVE=1
else
export WIN_NATIVE=0
fi
# Make utilities (mar/mbsdiff) available in the path
PATH="$DIR/xulrunner/bin:$PATH"

View file

@ -32,12 +32,6 @@ urlencode() {
done
}
if [ "`uname -o 2> /dev/null`" = "Cygwin" ]; then
WIN_NATIVE=1
else
WIN_NATIVE=0
fi
BUILD_FULL=0
BUILD_INCREMENTAL=0
FROM=""
@ -285,18 +279,7 @@ for build in "mac" "win32" "win-x64" "linux-i686" "linux-x86_64"; do
if [[ $BUILD_INCREMENTAL == 1 ]] && [[ -d "$UPDATE_STAGE_DIR/$FROM/$dir" ]]; then
echo
echo "Building incremental $build update from $FROM to $TO"
# mbsdiff fails on paths with symlink
if [ $WIN_NATIVE == 1 ]; then
cur=`pwd`
from_dir="`realpath --relative-to=\"$cur\" \"$UPDATE_STAGE_DIR/$FROM/$dir\"`"
to_dir="`realpath --relative-to=\"$cur\" \"$UPDATE_STAGE_DIR/$TO/$dir\"`"
else
from_dir="$UPDATE_STAGE_DIR/$FROM/$dir"
to_dir="$UPDATE_STAGE_DIR/$TO/$dir"
fi
"$SCRIPT_DIR/make_incremental_update.sh" "$DIST_DIR/Zotero-${TO}-${FROM}_$build.mar" "$from_dir" "$to_dir"
"$SCRIPT_DIR/make_incremental_update.sh" "$DIST_DIR/Zotero-${TO}-${FROM}_$build.mar" "$UPDATE_STAGE_DIR/$FROM/$dir" "$UPDATE_STAGE_DIR/$TO/$dir"
CHANGES_MADE=1
# If it's an incremental patch from a 6.0 build, use bzip instead of xz

View file

@ -213,7 +213,17 @@ for ((i=0; $i<$num_oldfiles; i=$i+1)); do
# Disabled for Zotero
#if [ -z "$MBSDIFF_HOOK" ]; then
if true; then
$MBSDIFF "$olddir/$f" "$newdir/$f" "$workdir/$f.patch"
# mbsdiff doesn't like POSIX paths on Windows
if [ $WIN_NATIVE -eq 1 ]; then
oldfile_path=$(cygpath -m "$olddir/$f")
newfile_path=$(cygpath -m "$newdir/$f")
patch_path=$(cygpath -m "$workdir/$f.patch")
else
oldfile_path="$olddir/$f"
newfile_path="$newdir/$f"
patch_path="$workdir/$f.patch"
fi
$MBSDIFF "$oldfile_path" "$newfile_path" "$patch_path"
$XZ $XZ_OPT --compress --lzma2 --format=xz --check=crc64 --force "$workdir/$f.patch"
else
# if service enabled then check patch existence for retrieval