From 360daa99554be2386ca5389c631281bac42eb1de Mon Sep 17 00:00:00 2001 From: Louis Burda Date: Wed, 2 Jun 2021 00:05:56 +0200 Subject: apply patches through PATCHED=1 env var during cleansrc --- do.sh | 52 ++++++++++++++++++---------------------------------- 1 file changed, 18 insertions(+), 34 deletions(-) (limited to 'do.sh') 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 # post-process source files for release" - echo " do.sh make-safe # create patched version of binary" - echo " do.sh test # 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 # post-process source files for release" + echo " # if \$PATCHED is set, patches are applied" fi -- cgit v1.2.3-71-gd317