提交 abb3f8fe 编写于 作者: L LiFeng

version: fix version git info

Signed-off-by: NLiFeng <lifeng68@huawei.com>
上级 753af976
......@@ -9,13 +9,7 @@ include(cmake/set_build_flags.cmake)
#set(CMAKE_C_COMPILER "gcc" CACHE PATH "c compiler")
# Get the latest abbreviated commit hash of the working branch
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(GIT_COMMIT_HASH "8ff7dac0993cd75494a281b509c683280417ba5c")
message("-- commit id: " ${GIT_COMMIT_HASH})
add_definitions(-DISULAD_GIT_COMMIT="${GIT_COMMIT_HASH}")
......
%global _version 2.0.0
%global _release 20200321.032232.gitaec8336d
%global _release 20200327.195112.git8ff7dac0
%global is_systemd 1
%global debug_package %{nil}
......
......@@ -17,6 +17,7 @@
# ./update-version.bash
topDir=$(git rev-parse --show-toplevel)
specfile="${topDir}/iSulad.spec"
Cmakefile="${topDir}/CMakeLists.txt"
Version_CMakefile="${topDir}/cmake/options.cmake"
old_version=$(cat ${specfile} | grep "%global" | grep "_version" | awk {'print $3'})
first_old_version=$(cat ${specfile} | grep "%global" | grep "_version" | awk {'print $3'} | awk -F "." {'print $1'})
......@@ -49,6 +50,7 @@ commit_id=${commit_id_long:0:8}
new_release=`date "+%Y%m%d"`.`date "+%H%M%S"`.git$commit_id
echo "The relase version has been modified, it is ${new_release}"
sed -i "s/set(ISULAD_VERSION \"${old_version}\")/set(ISULAD_VERSION \"${new_version}\")/g" ${Version_CMakefile}
sed -i "s/^.*set(GIT_COMMIT_HASH.*$/set(GIT_COMMIT_HASH \"${commit_id_long}\")/g" ${Cmakefile}
sed -i "s/^\%global _version ${old_version}$/\%global _version ${new_version}/g" ${specfile}
sed -i "s/^\%global _release ${old_release}$/\%global _release ${new_release}/g" ${specfile}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册