aboutsummaryrefslogtreecommitdiffstats
path: root/do.sh
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-06-02 00:05:56 +0200
committerLouis Burda <quent.burda@gmail.com>2021-06-02 00:07:46 +0200
commit360daa99554be2386ca5389c631281bac42eb1de (patch)
tree3fabafc6c6d6d65205f72ff5bc23b7732830cf0c /do.sh
parent15a2dc79c34c2a9d6634f1a92b12d44f4b62bbcd (diff)
downloadenowars5-service-stldoctor-360daa99554be2386ca5389c631281bac42eb1de.tar.gz
enowars5-service-stldoctor-360daa99554be2386ca5389c631281bac42eb1de.zip
apply patches through PATCHED=1 env var during cleansrc
Diffstat (limited to 'do.sh')
-rw-r--r--do.sh52
1 files changed, 18 insertions, 34 deletions
diff --git a/do.sh b/do.sh
index e01873c..02f6a2f 100644
--- a/do.sh
+++ b/do.sh
@@ -1,14 +1,15 @@
#!/bin/sh
+REPOROOT="$(git rev-parse --show-toplevel)"
SCRIPTPATH="$(dirname $(readlink -f "$0"))"
cd "$SCRIPTPATH"
makefile="
-all: .cleansrc
+all: service/.copyts
-.cleansrc: src/*
+service/.copyts: src/*
bash do.sh cleansrc src service/src
- touch .cleansrc
+ touch service/.copyts
"
shopt -s expand_aliases
@@ -51,40 +52,23 @@ elif [ "$1" == "cleansrc" ]; then
fi
fi
done
+
+ # apply patches if requested
+ if [ ! -z "$PATCHED" ]; then
+ pushd "$dst"
+ git apply "$REPOROOT/src/patches/"*.diff
+ popd
+ fi
elif [ "$1" == "test" ]; then
SRCDIR="$PWD/src" DATADIR="$PWD/service/data" bash "tests/test.sh" ${@:2}
elif [ "$1" == "make" ]; then
- # build a normal version
- pushd src
- if [ -e ".safebuild" ]; then
- make clean
- rm ".safebuild"
- fi
- make
- popd
-elif [ "$1" == "make-safe" ]; then
- # build a 'safe' version with flagstore patches
-
- pushd src
- make clean
- touch ".safebuild"
-
- for f in $(ls | grep '\.[ch]$'); do
- cp "$f" "safe_$f"
- done
-
- git apply patches/flagstore1.diff
- git apply patches/flagstore2.diff
-
- PREFIX="safe_" make
-
- rm safe_*
- popd
+ make -C src
else
- echo "USAGE: do.sh (compose) [args..]"
+ echo "USAGE: do.sh (compose|test|cleansrc) [args..]"
echo "EXAMPLES:"
- echo " do.sh compose up --build # starts the docker container"
- echo " do.sh cleansrc <src> <dst> # post-process source files for release"
- echo " do.sh make-safe # create patched version of binary"
- echo " do.sh test <cmd> # run a test on the binary"
+ echo " do.sh compose up --build # setup src and start the container"
+ echo " do.sh test stl-upload test.stl # test the upload of STL files"
+ echo " do.sh make # build local binary in src"
+ echo " do.sh cleansrc <src> <dst> # post-process source files for release"
+ echo " # if \$PATCHED is set, patches are applied"
fi