fix build path in copy.sh is chosen randomly

This commit is contained in:
Kedi Yang
2023-11-11 17:56:52 +08:00
parent 6b9fac55ca
commit 0a85b00bcb
2 changed files with 36 additions and 11 deletions

View File

@ -1,9 +1,31 @@
#!/bin/bash -x #!/bin/bash -x
SOURCE_DIR=$(readlink -f "$(dirname ${BASH_SOURCE[0]})/../..") SOURCE_DIR=$(readlink -f "$(dirname ${BASH_SOURCE[0]})/../..")
BUILD_TYPE_ORDER="debug debug_asan debug_no_unity release release_asan release_coverage release_no_unity
errsim errsim_asan errsim_debug errsim_sanity dissearray rpm perf sanity coverage
enable_latch_diagnose enable_memory_diagnosis enable_obj_leak_check enable_smart_var_check
trans_module_test"
if [ $# -lt 1 ] if [ $# -lt 1 ]
then then
echo "Usage ./copy.sh [oceanbase_dev_dir]" ALL_BUILD_DIRS=$(find $SOURCE_DIR -maxdepth 1 -name 'build_*' -type d | grep -v 'build_ccls' | sort)
BUILD_DIR=$(find $SOURCE_DIR -maxdepth 1 -name 'build_*' -type d | grep -v 'build_ccls' | head -1) for TYPE in ${BUILD_TYPE_ORDER[@]}
do
for BUILD_DIR in ${ALL_BUILD_DIRS[@]}
do
if [[ "build_$TYPE" == "$(basename $BUILD_DIR)" ]]
then
break 2
fi
done
done
[[ "$BUILD_DIR" == "" ]] && BUILD_DIR=${ALL_BUILD_DIRS[0]}
if [[ "$BUILD_DIR" == "" ]]
then
echo "Please specify the build directory of oceanbase."
exit 1
else
echo "Choose $BUILD_DIR as build directory of oceanbase."
fi
else else
BUILD_DIR=$1 BUILD_DIR=$1
fi fi

View File

@ -34,7 +34,7 @@ function obd_exec {
} }
alias obd="obd_exec" alias obd="obd_exec"
function variables_parpare { function variables_prepare {
if [[ "$(readlink -f "$BASE_DIR"/..)" == "$OB_FLOW_WORK_DIR" ]] if [[ "$(readlink -f "$BASE_DIR"/..)" == "$OB_FLOW_WORK_DIR" ]]
then then
path=$(readlink -f "$BASE_DIR") path=$(readlink -f "$BASE_DIR")
@ -74,7 +74,7 @@ function variables_parpare {
function copy_sh { function copy_sh {
if [[ -f copy.sh ]] if [[ -f copy.sh ]]
then then
sh copy.sh sh copy.sh $BUILD_PATH
else else
echo 'can not find copy.sh' echo 'can not find copy.sh'
fi fi
@ -559,7 +559,7 @@ Usage: $entrance <command> [options]
Available commands: Available commands:
prepare [-p DATA_PATH -h HOST] Prepare for deployment. prepare [-b BUILD_PATH -p DATA_PATH -h HOST] Prepare for deployment.
deploy -c YAML_CONF [-n DEPLOY_NAME] Deploy a cluster by a deploy yaml file. Default deploy name will be the name of yaml file. deploy -c YAML_CONF [-n DEPLOY_NAME] Deploy a cluster by a deploy yaml file. Default deploy name will be the name of yaml file.
redeploy [-c YAML_CONF -n DEPLOY_NAME] Redeploy cluster. redeploy [-c YAML_CONF -n DEPLOY_NAME] Redeploy cluster.
reinstall [-n DEPLOY_NAME] Reinstall cluster. (Change bin file, sync libs and restart) reinstall [-n DEPLOY_NAME] Reinstall cluster. (Change bin file, sync libs and restart)
@ -593,20 +593,21 @@ Options:
-n DEPLOY_NAME, --deploy-name DEPLOY_NAME -n DEPLOY_NAME, --deploy-name DEPLOY_NAME
The name of the deployment. The name of the deployment.
-v VERBOSE Activate verbose output. -v VERBOSE Activate verbose output.
-b BUILD_PATH, --build-path BUILD_PATH The build path of oceanbase.
-p DATA_PATH, --data-path DATA_PATH The data path for server deployment, it can be changed in the yaml file. -p DATA_PATH, --data-path DATA_PATH The data path for server deployment, it can be changed in the yaml file.
--ip IPADDRESS The ipaddress for server deployment, it can be changed in the yaml file. --ip IPADDRESS The ipaddress for server deployment, it can be changed in the yaml file.
--port PORT_BEGIN The port starting point. All the ports can be changed in the yaml file. --port PORT_BEGIN The port starting point. All the ports can be changed in the yaml file.
--with-local-obproxy Use local obproxy. --with-local-obproxy Use local obproxy.
--skip-copy Skip copy.sh. --skip-copy Skip copy.sh.
--cp Exec copy.sh. --cp Exec copy.sh.
--reboot Redeploy cluster before mysqltest --reboot Redeploy cluster before mysqltest.
""" """
} }
function main() { function main() {
entrance=${OBD_SH_ENTRANCE:-obd.sh} entrance=${OBD_SH_ENTRANCE:-obd.sh}
variables_parpare variables_prepare
command="$1" command="$1"
shift shift
extra_args="" extra_args=""
@ -625,6 +626,7 @@ function main() {
fi fi
;; ;;
-n | --deploy-name ) DEPLOY_NAME="$2"; shift 2 ;; -n | --deploy-name ) DEPLOY_NAME="$2"; shift 2 ;;
-b | --build-path ) BUILD_PATH="$2"; shift 2 ;;
-p | --data-path ) DATA_PATH="$2"; shift 2 ;; -p | --data-path ) DATA_PATH="$2"; shift 2 ;;
-N ) NO_CONFIRM="1"; shift ;; -N ) NO_CONFIRM="1"; shift ;;
--ip ) IPADDRESS="$2"; shift 2 ;; --ip ) IPADDRESS="$2"; shift 2 ;;
@ -645,6 +647,7 @@ function main() {
YAML_CONF=$(absolute_path ${YAML_CONF}) YAML_CONF=$(absolute_path ${YAML_CONF})
DATA_PATH=$(absolute_path ${DATA_PATH}) DATA_PATH=$(absolute_path ${DATA_PATH})
BUILD_PATH=$(absolute_path ${BUILD_PATH})
OBSERVER_PATH=$(absolute_path ${OBSERVER_PATH}) OBSERVER_PATH=$(absolute_path ${OBSERVER_PATH})
if [[ "$MINI" == "1" && "$DISABLE_REBOOT" != "1" ]] if [[ "$MINI" == "1" && "$DISABLE_REBOOT" != "1" ]]