Browse Source

Make the developer script versionize bucket_game.

master
poikilos 2 years ago
parent
commit
646210e712
  1. 142
      projects/linux-minetest-kit-get-master.sh

142
projects/linux-minetest-kit-get-master.sh

@ -31,6 +31,8 @@ EXISTING_NAME="linux-minetest-kit"
GOT_NAME="linux-minetest-kit" GOT_NAME="linux-minetest-kit"
GOT_VERSION="" GOT_VERSION=""
TRY_NAME="linux-minetest-kit-$TRY_VERSION" TRY_NAME="linux-minetest-kit-$TRY_VERSION"
MASTER_PATH=""
MASTER_VERSION=""
printf "* checking for '$TRY_NAME' or '$EXISTING_NAME'..." printf "* checking for '$TRY_NAME' or '$EXISTING_NAME'..."
FOUND=false FOUND=false
@ -59,7 +61,8 @@ if [ -d "$EXISTING_NAME" ]; then
else else
echo "OK" echo "OK"
fi fi
echo "'`realpath $EXISTING_NAME`' is ready to use." MASTER_PATH="`realpath $EXISTING_NAME`"
echo "'$MASTER_PATH' (EXISTING_NAME) is ready to use."
DO_EXTRACT=false DO_EXTRACT=false
else else
echo "removing $EXISTING_NAME ($WHY_FORCE)." echo "removing $EXISTING_NAME ($WHY_FORCE)."
@ -75,8 +78,9 @@ if [ -d "$TRY_NAME" ]; then
EXISTING_VERSION="$TRY_VERSION" EXISTING_VERSION="$TRY_VERSION"
echo "Warning: using existing '`realpath $TRY_NAME`'. Specify --force to replace it with the remote version." echo "Warning: using existing '`realpath $TRY_NAME`'. Specify --force to replace it with the remote version."
DO_EXTRACT=false DO_EXTRACT=false
echo "'`realpath $TRY_NAME`' is ready to use." MASTER_PATH="`realpath $TRY_NAME`"
# else true, so check for it later if version matches. echo "'$MASTER_PATH' (local copy: $TRY_NAME today's datestamp) is ready to use."
# else true, so check for it later if version matches.
else else
echo "Found `realpath $TRY_NAME` (will be replaced if same version as remote due to $WHY_FORCE)" echo "Found `realpath $TRY_NAME` (will be replaced if same version as remote due to $WHY_FORCE)"
fi fi
@ -144,7 +148,8 @@ if [ "x$DO_EXTRACT" = "xtrue" ]; then
if [ -d "$GOT_NAME" ]; then if [ -d "$GOT_NAME" ]; then
if [ "x$FORCE_LMK_UPDATE" != "true" ]; then if [ "x$FORCE_LMK_UPDATE" != "true" ]; then
echo "Warning: using existing '`realpath $GOT_NAME`'. Specify --force (or delete it and re-run this script normally) to replace it with the remote version." echo "Warning: using existing '`realpath $GOT_NAME`'. Specify --force (or delete it and re-run this script normally) to replace it with the remote version."
echo "'`realpath $GOT_NAME`' is ready to use." MASTER_PATH="`realpath $GOT_NAME`"
echo "'$MASTER_PATH' (GOT_NAME from previously-extracted local copy's version) is ready to use."
else else
echo "* merging (and moving) '`realpath linux-minetest-kit`' into '`realpath $GOT_NAME`'..." echo "* merging (and moving) '`realpath linux-minetest-kit`' into '`realpath $GOT_NAME`'..."
rsync -rtv --delete --remove-source-files linux-minetest-kit/ "$GOT_NAME" rsync -rtv --delete --remove-source-files linux-minetest-kit/ "$GOT_NAME"
@ -162,17 +167,140 @@ if [ "x$DO_EXTRACT" = "xtrue" ]; then
echo "Warning: 'rm -Rf linux-minetest-kit' failed in '`pwd`'. Remove the incomplete copy manually." echo "Warning: 'rm -Rf linux-minetest-kit' failed in '`pwd`'. Remove the incomplete copy manually."
fi fi
fi fi
echo "'`realpath $GOT_NAME`' is ready to use." MASTER_PATH="`realpath $GOT_NAME`"
echo "'$MASTER_PATH' (GOT_NAME from version downloaded) is ready to use."
fi fi
else else
mv linux-minetest-kit "$GOT_NAME" mv linux-minetest-kit "$GOT_NAME"
code=$? code=$?
printf "* mv 'linux-minetest-kit' '`realpath $GOT_NAME`'..." printf "* mv 'linux-minetest-kit' '`realpath $GOT_NAME`'..."
if [ $code -ne 0 ]; then exit $code; fi if [ $code -ne 0 ]; then exit $code; fi
echo "'`realpath $GOT_NAME`' is ready to use." MASTER_PATH="`realpath $GOT_NAME`"
echo "'$MASTER_PATH' (GOT_NAME newly downloaded and renamed to that) is ready to use."
fi fi
fi fi
# if [ -z "$GOT_VERSION" ]; then
# echo "Error: GOT_VERSION is blank."
# exit 1
# fi
echo Done if [ -z "$MASTER_PATH" ]; then
echo "Error: MASTER_PATH was not set (This path of logic is incomplete)."
exit 1
fi
if [ ! -f "$MASTER_PATH/release.txt" ]; then
echo "Error: MASTER_PATH $MASTER_PATH doesn't contain release.txt"
exit 1
fi
MASTER_VERSION="`cat $MASTER_PATH/release.txt`"
VERSION="$MASTER_VERSION"
# VERSION="$GOT_VERSION"
BG_VERSIONS=$HOME/bucket_game-versions
mkdir -p "$BG_VERSIONS"
if [ -z "$VERSION" ]; then
echo
echo "error: cat release.txt in $MASTER_PATH did not produce a version."
echo
exit 1
fi
echo "linux-minetest-kit VERSION=$VERSION"
cat <<END
# build via:
cd "$MASTER_PATH"
mtcompile-libraries.sh build
# or to give the program out (to do the later step and use the --makeprod option for creating a binary that will run on computers with different configurations), instead run: env DOBOOTSTRAP=1 ./mtcompile-libraries.sh build
perl mtcompile-program.pl build --finetest --client
# ^ based on MoNTE48's protocol-detecting client
# or: perl mtcompile-program.pl build --classic --client
# ^ minetest.org MT6
# or: perl mtcompile-program.pl build --trolltest --client
# ^ based on MT5 client
END
echo
echo "Checking destination..."
DST_MT="$HOME/minetest" # should be a symlink to the latest version such as ~/minetest-220509
DST_DST_MT="`readlink $DST_MT`"
if [ -z "$DST_DST_MT" ]; then
echo "DST_MT=$DST_MT"
else
echo "DST_MT=$DST_MT -> $DST_DST_MT"
fi
echo
echo "Processing bucket_game..."
BG_VERSION=$VERSION
cd $MASTER_PATH/mtsrc/game
code=$?
if [ $code -ne 0 ]; then
exit $code
fi
DST_BG_ARCHIVE=$BG_VERSIONS/bucket_game-$VERSION.tgz
if [ ! -f "$DST_BG_ARCHIVE" ]; then cp bucket_game.tgz "$DST_BG_ARCHIVE"; fi
cd $BG_VERSIONS/
SRC_GAME_NAME=bucket_game-$VERSION
SRC_GAME_PATH=$BG_VERSIONS/$SRC_GAME_NAME
if [ ! -d "$SRC_GAME_PATH" ]; then
tar xfv "$DST_BG_ARCHIVE"
mv bucket_game "$SRC_GAME_PATH"
else
echo "* using existing '$SRC_GAME_PATH' (not extracting '$DST_BG_ARCHIVE')"
fi
BG_VERSION=$VERSION
if [ -f "$SRC_GAME_PATH/release.txt" ]; then BG_VERSION=`cat "$SRC_GAME_PATH/release.txt"`; fi
if [ "$BG_VERSION" != "$VERSION" ]; then
echo "Warning: The bucket_game is version $BG_VERSION but the linux-minetest-kit is version $VERSION. Renaming..."
OLD_DST_BG_ARCHIVE="$DST_BG_ARCHIVE"
DST_BG_ARCHIVE=$BG_VERSIONS/bucket_game-$BG_VERSION.tgz
echo "mv '$OLD_DST_BG_ARCHIVE' '$DST_BG_ARCHIVE'"
mv "$OLD_DST_BG_ARCHIVE" "$DST_BG_ARCHIVE"
TMP_SRC_GAME_PATH="$SRC_GAME_PATH"
SRC_GAME_NAME=bucket_game-$BG_VERSION
SRC_GAME_PATH=$BG_VERSIONS/$SRC_GAME_NAME
if [ -d "$SRC_GAME_PATH" ]; then
echo "Warning: $SRC_GAME_PATH already exists, so $TMP_SRC_GAME_PATH will be removed."
rm -Rf "$TMP_SRC_GAME_PATH"
else
echo "mv '$TMP_SRC_GAME_PATH' '$SRC_GAME_PATH'"
mv "$TMP_SRC_GAME_PATH" "$SRC_GAME_PATH"
code=$?
if [ $code -ne 0 ]; then exit $code; fi
fi
fi
echo "OK"
echo
echo "'$SRC_GAME_PATH' is ready to use such as via:"
# RM_DST_BG_PREFIX=" "
# if [ ! -d "$DST_MT/games/bucket_game" ]; then
# RM_DST_BG_PREFIX="# (doesn't exist so not necessary) "
# fi
# echo "$RM_DST_BG_PREFIX rm -Rf $DST_MT/games/bucket_game"
echo "rsync -rt --delete $SRC_GAME_PATH/ $DST_MT/games/bucket_game"
if [ -d "$DST_MT/games/bucket_game" ]; then
DST_BG_VERSION="`cat $DST_MT/games/bucket_game/version.txt`"
# ^ Poikilos-style version writeup with patch names
if [ -z "$DST_BG_VERSION" ]; then
DST_BG_VERSION="`cat $DST_MT/games/bucket_game/release.txt`"
# ^ new style suggested by Poikilos and implemented by OldCoder
fi
if [ -z "$DST_BG_VERSION" ]; then
echo "^ BE CAREFUL: The version is not known, so make a backup before doing this command!"
elif [ "x$DST_BG_VERSION" != "x$BG_VERSION" ]; then
echo "^ BEFORE PROCEEDING: The source version is $BG_VERSION but the destination version is '$DST_BG_VERSION', so make a backup before doing this command!"
fi
fi
echo

Loading…
Cancel
Save