Merge remote branch 'refs/remotes/origin/parasti/import-pk3'
authorRudolf Polzer <divverent@alientrap.org>
Thu, 19 Aug 2010 03:57:06 +0000 (05:57 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 19 Aug 2010 03:57:06 +0000 (05:57 +0200)
all
misc/tools/update-nexcompat.sh [new file with mode: 0755]

diff --git a/all b/all
index 5b7ca9fee05a0125f3446cb901bdbb4d6c7dcecb..92e54cb670930d9b231776c240fd3f50169c2dad 100755 (executable)
--- a/all
+++ b/all
@@ -598,7 +598,7 @@ case "$cmd" in
        run)
                if [ -n "$WE_HATE_OUR_USERS" ]; then
                        client=
-                       export PATH="$d0/misc/buildfiles/win64:$d0/misc/buildfiles/win32:$PATH"
+                       export PATH="$d0/misc/buildfiles/win32:$PATH"
                elif [ x"`uname`" = x"Darwin" ]; then
                        export DYLD_LIBRARY_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/MacOS"
                        export DYLD_FRAMEWORK_PATH="$d0/misc/buildfiles/osx/Xonotic-SDL.app/Contents/Frameworks"
diff --git a/misc/tools/update-nexcompat.sh b/misc/tools/update-nexcompat.sh
new file mode 100755 (executable)
index 0000000..0fa7816
--- /dev/null
@@ -0,0 +1,129 @@
+#!/bin/sh
+
+set -e
+
+d0="$PWD"
+NEXLOC=$1
+XONLOC=$2
+COMPATLOC=$3
+
+rewrite()
+{
+       case "$1" in
+               scripts/*.shader) echo "scripts/nexcompat-${1#scripts/}" ;;
+               *) echo "$1" ;;
+       esac
+}
+
+unrewrite()
+{
+       case "$1" in
+               scripts/nexcompat-*.shader) echo "scripts/${1#scripts/nexcompat-}" ;;
+               *) echo "$1" ;;
+       esac
+}
+
+wantfile()
+{
+       case "$1" in
+               *.ase) return 1 ;;
+               *.blend) return 1 ;;
+               *.cfg) return 1 ;;
+               demos/*) return 1 ;;
+               font-*.pk3dir/*) return 1 ;;
+               gfx/*) return 1 ;;
+               *.map) return 1 ;;
+               maps/*) return 1 ;;
+               models/player/*) return 1 ;;
+               models/weapons/*) return 1 ;;
+               *.modinfo) return 1 ;;
+               *.pk3) return 1 ;;
+               qcsrc/*) return 1 ;;
+               *.sh) return 1 ;;
+               sound/*) return 1 ;;
+               textures/carni*) return 1 ;;
+               textures/fb*) return 1 ;;
+               textures/fricka*) return 1 ;;
+               textures/grunt*) return 1 ;;
+               textures/headhunter*) return 1 ;;
+               textures/heroine*) return 1 ;;
+               textures/insurrectionist*) return 1 ;;
+               textures/lurk*) return 1 ;;
+               textures/lycanthrope*) return 1 ;;
+               textures/marine*) return 1 ;;
+               textures/mulder*) return 1 ;;
+               textures/nexgun*) return 1 ;;
+               textures/nexus*) return 1 ;;
+               textures/quark*) return 1 ;;
+               textures/shock*) return 1 ;;
+               textures/skadi*) return 1 ;;
+               textures/specop*) return 1 ;;
+               textures/uzi*) return 1 ;;
+               textures/xolar*) return 1 ;;
+               *.txt) return 1 ;;
+       esac
+       if ! [ -f "$NEXLOC/$1" ]; then
+               return 1
+       fi
+       R=`rewrite "$1"`
+       for f in "$XONLOC"/*/"$R" "$XONLOC"/*/"$1"; do
+               case "$f" in
+                       "$XONLOC"/\*/"$R") continue ;;
+                       "$XONLOC"/xonotic-nexcompat.pk3dir/"$R") continue ;;
+                       "$XONLOC"/\*/"$1") continue ;;
+                       "$XONLOC"/xonotic-nexcompat.pk3dir/"$1") continue ;;
+               esac
+               return 1
+       done
+       return 0
+}
+
+cd "$d0"
+cd "$COMPATLOC"
+
+# 1. clear deleted files from the compat pack
+git reset --hard
+git clean -xdf
+git ls-files | while IFS= read -r L; do
+       case "$L" in
+               .gitattributes) continue ;;
+       esac
+       if ! wantfile "`unrewrite "$L"`"; then
+               echo "D $L"
+               git rm -f "$L"
+       fi
+done
+
+CR="\r"
+LF="
+"
+KILL="\e[K"
+UP="\e[A"
+
+# 2. add new files to the compat pack
+echo "* -crlf" > .gitattributes
+git add .gitattributes
+find "$NEXLOC" -type f | while IFS= read -r L; do
+       L0=${L#$NEXLOC/}
+       echo "$UP$L0$KILL" >&2
+       LR=`rewrite "$L0"`
+       if wantfile "$L0"; then
+               newhash=`cd "$NEXLOC"; git rev-parse ":data/$L0"`
+               if oldhash=`git rev-parse ":$LR" 2>/dev/null`; then
+                       if [ x"$oldhash" != x"$newhash" ]; then
+                               echo "$UP""U $LR$LF"
+                               cp "$L" "$LR"
+                               git add "$LR"
+                       fi
+               else
+                       echo "$UP""A $LR$LF"
+                       mkdir -p "$LR"
+                       rmdir "$LR"
+                       cp "$L" "$LR"
+                       git add "$LR"
+               fi
+       fi
+done
+
+git status
+#git commit