2 Star 0 Fork 0

mirrors_pingcap/tidb-insight

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
package.sh 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
Allen Zhong 提交于 2021-12-01 11:53 . update depends
#!/bin/sh
# make a release tarball
PKGNAME=tidb-insight
git submodule update --init --recursive
if [ -z $1 ]; then
RELVER=`git describe --tags`
else
RELVER=$1
fi
RELPATH=${PKGNAME}-${RELVER}
GO_RELEASE_BIN=go1.16.10.linux-${HOSTARCH}
BUILD_ROOT="`pwd`/.build"
mkdir -p ${BUILD_ROOT}
cd ${BUILD_ROOT}
if [ ! -f ${GO_RELEASE_BIN}.tar.gz ]; then
wget https://dl.google.com/go/${GO_RELEASE_BIN}.tar.gz
tar zxf ${GO_RELEASE_BIN}.tar.gz
fi
# clean exist binaries
rm -rf ${BUILD_ROOT}/${PKGNAME} ${BUILD_ROOT}/${PKGNAME}-*.tar.gz
mkdir -p ${BUILD_ROOT}/${PKGNAME}
cp -rf ${BUILD_ROOT}/../* ${BUILD_ROOT}/${PKGNAME}/ 2>/dev/null
# prepare dependencies
GOROOT="${BUILD_ROOT}/go"
export GOROOT
BUILD_FLAGS="-trimpath"
export BUILD_FLAGS
# compile a static binary
cd ${BUILD_ROOT}/${PKGNAME}/collector/
GOBIN=${GOROOT}/bin/go GOOS=${GOOS} GOARCH=${GOARCH} make static || exit 1
cd ${BUILD_ROOT}/${PKGNAME}/tools/
GOBIN=${GOROOT}/bin/go GOOS=${GOOS} GOARCH=${GOARCH} make static || exit 1
# compile other tools
cd ${BUILD_ROOT}/${PKGNAME}/tools/vmtouch
LDFLAGS="-static" make || exit 1
install -Dsm755 vmtouch ${BUILD_ROOT}/${PKGNAME}/bin/
# clean unecessary files
cd ${BUILD_ROOT}/${PKGNAME}/
mv tools/docker bin/ && sed -i 's/tools/bin/g' docker.sh
rm -rf collector data tools docs tests pkg Makefile package.sh Gopkg.* *.log
find ${BUILD_ROOT}/${PKGNAME}/ -name "*.pyc" | xargs rm 2>/dev/null
find ${BUILD_ROOT}/${PKGNAME}/ -name "__pycache__" | xargs rm -rf 2>/dev/null
find ${BUILD_ROOT}/${PKGNAME}/ -name "*.out" | xargs rm 2>/dev/null
# make tarball archive
cd ${BUILD_ROOT}
tar zcf ${RELPATH}.tar.gz ${PKGNAME}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_pingcap/tidb-insight.git
[email protected]:mirrors_pingcap/tidb-insight.git
mirrors_pingcap
tidb-insight
tidb-insight
tiup

搜索帮助