]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport regress/scripts/async.sh
authorAlain Spineux <alain@baculasystems.com>
Tue, 21 Jul 2020 08:57:40 +0000 (10:57 +0200)
committerEric Bollengier <eric@baculasystems.com>
Tue, 1 Mar 2022 14:36:16 +0000 (15:36 +0100)
Author: Alain Spineux <alain@baculasystems.com>
Date:   Wed Oct 16 19:28:20 2019 +0200

    regress: add a Dedup resource and make async.sh rebuild the SD plugins

Author: Alain Spineux <alain@baculasystems.com>
Date:   Wed Jul 30 09:27:07 2014 +0200

    regress: add support for ${MAKEOPT} to async.sh

Author: Alain Spineux <alain@baculasystems.com>
Date:   Wed Jul 23 01:40:04 2014 +0200

    regress: async.sh, check that bin/bacula exists before to use it

Author: Alain Spineux <alain@baculasystems.com>
Date:   Wed Jul 16 10:07:46 2014 +0200

    regress: do a kill -KILL in scripts/cleanup

    this speedup each test by 10s, because the script do some sleep when using default
    script/cleanup is called only at the begining of each test => not side effect

Author: Alain Spineux <alain@baculasystems.com>
Date:   Tue Jul 15 18:37:33 2014 +0200

    regress: scripts/async don't recompile if no source file have changed

    grep rsync output to see if files have been copied from BACULA_SOURCE

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Jul 14 17:12:02 2014 +0200

    regress: make script/async.sh  take advantage of the improved make

Author: Alain Spineux <alain@baculasystems.com>
Date:   Tue Jul 1 09:55:35 2014 +0200

    regress: new scripts/async.sh

    async.sh do a rsync from BACULA_SOURCE in regress
    and try to do a safe rebuild and display errors a soon as it see it.
    This is only a very helpfull hack
    this is not 100% safe, dont hesitate to use "make setup"
    I use "make setup" often when I change bacula.h or important .h files

regress/scripts/async.sh [new file with mode: 0755]

diff --git a/regress/scripts/async.sh b/regress/scripts/async.sh
new file mode 100755 (executable)
index 0000000..1402913
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+set -e
+
+. ./config
+
+die()
+{
+  echo $1
+  exit 1
+}
+
+check_bin()
+{
+   bin="$1"
+   [ -f ${bin}/bacula-fd ] && [ -f ${bin}/bacula-sd ] && [ -f ${bin}/bacula-dir ]
+}
+
+build()
+{
+   rm -f bin/bacula-fd build/src/filed/bacula-fd bin/bacula-sd build/src/filed/bacula-sd bin/bacula-dir build/src/filed/bacula-dir
+   cd build
+   make ${MAKEOPT} || exit 1
+   make ${MAKEOPT} install || exit 1
+   if [ x$FORCE_DEDUP = xyes ]; then
+      make -C src/stored install-dedup || exit 1
+   fi
+   [ -f ../bin/bacula-fd ] || die "bacula-fd missing"
+   [ -f ../bin/bacula-sd ] || die "bacula-sd missing"
+   [ -f ../bin/bacula-dir ] || die "bacula-dir missing"
+
+   # wait # bin/bacula stop
+   # get all tools -- especially testls
+   cd src/tools
+   make installall || die "make installall tools failed"
+
+
+   cd ${cwd}
+   if [ x${SMTP_HOST} = x -o x${SMTP_HOST} = xdummy ]; then
+      # Turn off email
+      cp scripts/dummy_bsmtp bin/bsmtp
+      chmod 755 bin/bsmtp
+   fi
+}
+
+cwd=`pwd`
+[ -d ${BACULA_SOURCE} ] || die "The BACULA_SOURCE environment variable must be a Bacula release directory, but is not."
+
+MAKEOPTS=${MAKEOPT:-"-j3"}
+
+if [ -x bin/bacula ] ; then
+   bin/bacula stop -KILL &
+fi
+
+#rsync -av ${BACULA_SOURCE}/ build/ --exclude examples/ --exclude patches/ --exclude src/win32 || die "rsync failed"
+rsync -av --stats --exclude examples/ --exclude patches/ --exclude src/win32 --exclude src/config.h --exclude src/hosts.h --exclude src/version.h --include '*/' --include "*.c" --include "*.cc" --include '*.cpp' --include '*.h' --exclude '*' ${BACULA_SOURCE}/ build/ > tmp/rsync.log 2>&1 || die "rsync failed"
+
+if grep "Number of files transferred: 0" tmp/rsync.log > /dev/null && check_bin bin; then
+   echo "No Changes in sources"
+else 
+   build
+   echo "Done"
+fi
+# wait for end of bacula stop above
+wait 
+
+exit 0