7 Star 15 Fork 2

Gitee 极速下载/baidu-file-system

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/baidu/bfs
克隆/下载
build_version.sh 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
lylei 提交于 2016-11-16 11:16 . Remove debug info from some simple scripts
#!/usr/bin/env bash
BUILD_DATE_TIME=`date`
BUILD_HOSTNAME=`hostname`
BUILD_GCC_VERSION=`gcc --version | head -n 1`
gen_info_template_header ()
{
echo "// Generated by the build_version.sh. DO NOT EDIT!"
echo " "
echo "#include <iostream>"
echo "#include \"version.h\""
echo "const char kGitInfo[] = \"\\"
}
gen_info_template_foot ()
{
echo "\";"
echo "const char kBuildTime[] = \"$BUILD_DATE_TIME\";"
echo "const char kBuilderName[] = \"$USER\";"
echo "const char kHostName[] = \"$BUILD_HOSTNAME\";"
}
gen_info_print_template ()
{
echo "void PrintSystemVersion() {"
echo " std::cout << \"Baidu File System v\" << kMajorVersion << \".\" << kMinorVersion << \".\" << kRevision << std::endl;"
echo " std::cout << \"===== Git Info ===== \" << std::endl;"
echo " std::cout << kGitInfo << std::endl;"
echo " std::cout << \"===== Build Info ===== \" << std::endl;"
echo " std::cout << \"Build Time: \" << kBuildTime << std::endl;"
echo " std::cout << \"Builder Name: \" << kBuilderName << std::endl;"
echo " std::cout << \"Build Host Name: \" << kHostName << std::endl;"
echo " std::cout << \"Build Compiler: \" << kCompiler << std::endl;"
echo " std::cout << std::endl;"
echo "};"
}
TEMPLATE_HEADER_FILE=template_header.tmp
TEMPLATE_FOOT_FILE=template_foot.tmp
GIT_INFO_FILE=git_info.tmp
VERSION_CPP_FILE=src/version.cc
# generate template file
git remote -v | sed 's/$/&\\n\\/g' > $GIT_INFO_FILE
git log | head -n 3 | sed 's/$/&\\n\\/g' >> $GIT_INFO_FILE
gen_info_template_header > $TEMPLATE_HEADER_FILE
gen_info_template_foot > $TEMPLATE_FOOT_FILE
gen_info_print_template >> $TEMPLATE_FOOT_FILE
# generate version cpp
cat $TEMPLATE_HEADER_FILE $GIT_INFO_FILE $TEMPLATE_FOOT_FILE > $VERSION_CPP_FILE
rm -rf $TEMPLATE_HEADER_FILE $GIT_INFO_FILE $TEMPLATE_FOOT_FILE
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/baidu-file-system.git
git@gitee.com:mirrors/baidu-file-system.git
mirrors
baidu-file-system
baidu-file-system
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385