代码拉取完成,页面将自动刷新
同步操作将从 openGauss/openGauss-DBMind 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env bash
# Copyright (c) 2022 Huawei Technologies Co.,Ltd.
#
# openGauss is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
# See the Mulan PSL v2 for more details.
# ------------Utils------------
function die() {
echo -e "FATAL: $1"
exit 1
}
function extract_libname() {
# Split real library name.
line=$1
tmparr=(${line//==/ })
libname=${tmparr[0]}
tmparr=(${libname//>=/ })
libname=${tmparr[0]}
tmparr=(${libname//<=/ })
libname=${tmparr[0]}
tmparr=(${libname//~=/ })
libname=${tmparr[0]}
# trim
libname=$(echo $libname | sed 's/ *$//g')
echo $libname
}
# ------------Main Process------------
ABSPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DBMIND_PATH=${ABSPATH}/dbmind
ORIGIN_PATH=$(pwd)
cd $ABSPATH
# Check whether Python has been installed onto the OS.
source constant
# Set local Python VM if we have.
export PATH=${ABSPATH}/python/bin:$PATH
PYTHON=$(which python3)
if [[ "$?" != "0" ]]; then
die "Not found the Python environment."
fi
# Check for the Python version.
$PYTHON -c "import sys; exit(${MIN_PYTHON_VERSION} <= sys.version_info[:2] <= ${MAX_PYTHON_VERSION})"
if [[ "$?" != "1" ]]; then
die "Not supported Python (${PYTHON}) version. At least Python ${MIN_PYTHON_VERSION}"
fi
# Run set command
if [[ $1 == "set" ]]; then
cd $ORIGIN_PATH
echo "WARN: The SET operation will not detect the integrity of the module, please install the module in advance."
$PYTHON $DBMIND_PATH/ $@ &
exit $?
fi
cd $ABSPATH
# Check for dependencies
## Firstly, get the machine architecture so that determine different requirement files.
if [[ -f "${DBMIND_PATH}/requirements-x86.txt" ]]; then
REQUIREMENT_PATH=$DBMIND_PATH
else
REQUIREMENT_PATH=$DBMIND_PATH/..
fi
machine=$(uname -m)
if [[ "$machine" =~ "x86" ]]; then
requirements=$REQUIREMENT_PATH/"requirements-x86.txt"
else
requirements=$REQUIREMENT_PATH/"requirements-aarch64.txt"
fi
## Secondly, check whether each library has been installed.
if [[ $PYTHONPATH ]]; then
echo "NOTICE: You have set the variable PYTHONPATH. DBMind ignored it."
fi
export PYTHONPATH=${ABSPATH}/3rd
installed_list=$($PYTHON -m pip list --disable-pip-version-check)
while read line; do
libname=$(extract_libname $line)
# skip comment
if [[ $libname == "#"* ]] || [[ $libname == "" ]] ; then
continue
fi
found=$(echo $installed_list | grep -i "$libname")
if [[ $found == "" ]]; then
die "Need dependency ${libname}. You should use pip to install it, following:\n
${PYTHON} -m pip install -r ${requirements}"
fi
done < $requirements
# Furthermore, if users want to use several components, he should install optional dependencies.
## e.g., gs_dbmind component sqldiag ...
optional_reqs=$REQUIREMENT_PATH/"requirements-optional.txt"
if [[ "$1" == "component" ]] && [[ "$2" == "sqldiag" || "$2" == "xtuner" ]]; then
while read line; do
libname=$(extract_libname $line)
# skip comment
if [[ $libname == "#"* ]] || [[ $libname == "" ]] ; then
continue
fi
found=$(echo $installed_list | grep -i "$libname")
if [[ $found == "" ]]; then
echo -e "NOTICE: Maybe you need dependency ${libname} while using this component. You should use pip to install it, following:\n
${PYTHON} -m pip install -r ${optional_reqs}"
fi
done < $optional_reqs
fi
set -f
for arg in "${@}" ; do
if [[ ${arg:0:1} != '-' ]]; then
arg=`echo $arg |sed 's/"""/\\\\\\"\\\\\\"\\\\\\"/g'`
arg=`${PYTHON} -c "import shlex;print(shlex.quote(\"\"\"$arg\"\"\"))"`
fi
_args=$_args" "$arg
done
cd $ORIGIN_PATH
eval $PYTHON $DBMIND_PATH/ $_args
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。