6 Star 23 Fork 5

Gitee 极速下载/polardb-x

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/ApsaraDB/galaxysql
克隆/下载
saveVersion.sh 3.32 KB
一键复制 编辑 原始数据 按行查看 历史
pangzhaoxing 提交于 2024-05-09 19:19 . 5.4.19-20240428_17142882 release
#!/bin/sh
# This file is used to generate the package-info.java class that
# records the version, revision, branch, user, timestamp, and url
unset LANG
unset LC_CTYPE
unset LC_TIME
user="polardbx"
date=`date +'%F %T'`
current_path=`pwd`
case "`uname`" in
Linux)
bin_abs_path=$(readlink -f $(dirname $0))
;;
*)
bin_abs_path=`cd $(dirname $0); pwd`
;;
esac
echo "run saveVersion.sh script"
echo "cd to $bin_abs_path for workaround relative path"
cd $bin_abs_path
if [ -d .svn ]; then
revision=`svn info | sed -n -e 's/Last Changed Rev: \(.*\)/\1/p'`
url=`svn info node | sed -n -e 's/URL: \(.*\)/\1/p'`
# Get canonical branch (branches/X, tags/X, or trunk)
branch=`echo $url | sed -n -e 's,.*\(branches/.*\)$,\1,p' \
-e 's,.*\(tags/.*\)$,\1,p' \
-e 's,.*/trunk$,trunk,p'`
version=`echo $url | sed -n -e 's,.*branches/\(.*\)$,\1,p' \
-e 's,.*tags/\(.*\)$,\1,p' \
-e 's,.*/trunk$,trunk,p'`
elif [ -d .git ]; then
revision=`git log -1 --pretty=format:"%H"`
hostname=`hostname`
url="git@github.com:polardb/polardbx-sql.git"
branch="Unknown"
#url=`git remote -v | grep origin | grep fetch | awk '{print $2}'`
#branch=`git branch --no-color | grep '*' | awk '{print $2}'`
case "`uname`" in
Darwin)
version=`cat .flattened-pom.xml | head -n 10 | egrep -o '<version>5\..*?(-SNAPSHOT)?<' | cut -c 10- | awk -F'<' '{print $1}'`
;;
*)
version=`cat .flattened-pom.xml | head -n 10 | grep -oP '<version>5\..*?(-SNAPSHOT)?<' | cut -c 10- | awk -F'<' '{print $1}'`
;;
esac
else
revision="Unknown"
branch="Unknown"
version="Unknown"
url="file://$bin_abs_path"
fi
# for rpm
if [ "x${RELEASE}" != "x" ];then
# since 5.4.19, version changes into "5.4.19-${DATE}_${BUILDNUMBER}-SNAPSHOT"
ec="echo $version | sed 's/_.*-SNAPSHOT//'"
version=`eval $ec`
elif [ "x${FW_BRANCH_NAME}" != "x" ]; then
# for fastwork read from rpm tag build name
# ex : t-drds-server_A_5_1_28_1396535_20170906 , substring 1396535
tmp_version=`echo ${FW_BRANCH_NAME##*_}`
if [ "${#tmp_version}" == "8" ]; then
tmp_version=`echo ${FW_BRANCH_NAME%_*}`
tmp_version=`echo ${tmp_version##*_}`
version="${tmp_version}"
else
# for fastwork build version
if [ "x${GIT_TAG}" != "x" ]; then
version=`echo ${GIT_TAG} | awk -F'_' '{printf "%s-%s",$1,$3}'`
fi
fi
else
RELEASE=`date +%Y%m%d`
ec="echo $version | sed 's/SNAPSHOT/$RELEASE/g'"
version=`eval $ec`
fi
MD5SUM=$(which md5sum)
if [ ! -z $MD5SUM ] ; then
srcChecksum=`find ./ -maxdepth 1 -name '*.sh' | LC_ALL=C sort | xargs md5sum | md5sum | cut -d ' ' -f 1`
fi
echo "server release version : $version"
cat << EOF | \
sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \
-e "s|URL|$url|" -e "s/REV/$revision/" \
-e "s|BRANCH|$branch|" -e "s/SRCCHECKSUM/$srcChecksum/" \
> polardbx-common/src/main/java/com/alibaba/polardbx/common/utils/version/package-info.java
/*
* Generated by saveVersion.sh
*/
@VersionAnnotation(version="VERSION", revision="REV", branch="BRANCH",
user="USER", date="DATE", url="URL",
srcChecksum="SRCCHECKSUM")
package com.alibaba.polardbx.common.utils.version;
EOF
echo "cd to $current_path for continue"
cd $current_path
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/mirrors/polardb-x.git
git@gitee.com:mirrors/polardb-x.git
mirrors
polardb-x
polardb-x
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385