diff --git a/README.md b/README.md index 27c2474ebb4b5941189ff7d27b87e081bacefa4e..898d7bcfeeb28fcf3234338cc512d89041d55ea9 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,12 @@ $ /cvmfs/container.ihep.ac.cn/bin/hep_container shell SL6 Before run following commands, please make sure you setup the CVMFS: ``` -$ source /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.2/setup.sh $ git clone git@github.com:cepc/CEPCSW.git $ cd CEPCSW $ git checkout master # branch name -$ mkdir build && cd build -$ cmake .. -DHOST_BINARY_TAG=${BINARY_TAG} -$ make -$ ./run gaudirun.py '$EXAMPLESROOT/options/helloalg.py' +$ source setup.sh +$ ./build.sh +$ ./run.sh Examples/options/helloalg.py ``` ## Packages diff --git a/run.sh b/run.sh new file mode 100755 index 0000000000000000000000000000000000000000..d5739c556c2b6d2c6f3e6a9c00e815f6c2a9d898 --- /dev/null +++ b/run.sh @@ -0,0 +1,72 @@ +#!/bin/bash +############################################################################## +# Run script for CEPCSW: +# - run a simple job +# +# Usage: +# $ ./run.sh Examples/options/helloalg.py +# or: +# $ +# +# Author: Tao Lin <lintao@ihep.ac.cn> +############################################################################## + +function info:() { + echo "INFO: $*" 1>&2 +} + +function error:() { + echo "ERROR: $*" 1>&2 +} + +function check-cepcsw-envvar() { + # CEPCSWEXTERNAL is defined in /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/ + if [ -z "${CEPCSWEXTERNAL}" ]; then + error: "The CEPCSW is not setup. Please source setup.sh." + return 1 + fi +} + +function build-dir() { + local blddir=build + + # If detect the extra env var, append it to the build dir + if [ -n "${lcg_version}" ]; then + blddir=${blddir}.${lcg_version} + fi + if [ -n "${lcg_platform}" ]; then + blddir=${blddir}.${lcg_platform} + fi + + echo $blddir +} + +function check-working-builddir() { + local blddir=$(build-dir) + if [ ! -d "$blddir" ]; then + mkdir $blddir || { + error: "Failed to create $blddir" + return 1 + } + fi +} + +function run-job() { + local blddir=$(build-dir) + + $blddir/run gaudirun.py $* +} + +############################################################################## +# Parse the command line options +############################################################################## + +# The current default platform +lcg_platform=x86_64-slc6-gcc8-opt +lcg_version=97.0.2 + +check-cepcsw-envvar || exit -1 + +check-working-builddir || exit -1 + +run-job $* || exit -1