代码拉取完成,页面将自动刷新
#!/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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。