mirror of
https://github.com/transmission/transmission
synced 2025-01-03 13:35:36 +00:00
Don't search for SVN revision when calculating version
This commit is contained in:
parent
b875e79f3d
commit
f6b23c02f0
2 changed files with 13 additions and 43 deletions
|
@ -57,20 +57,11 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(TR_VCS_REVISION_FILE "${CMAKE_SOURCE_DIR}/REVISION")
|
set(TR_VCS_REVISION_FILE "${CMAKE_SOURCE_DIR}/REVISION")
|
||||||
set(TR_VCS_REVISION_RELIABLE ON)
|
|
||||||
|
|
||||||
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.svn)
|
if(NOT "$ENV{JENKINS_URL}" STREQUAL "" AND NOT "$ENV{VCS_REVISION}" STREQUAL "")
|
||||||
if(NOT "$ENV{JENKINS_URL}" STREQUAL "" AND NOT "$ENV{VCS_REVISION}" STREQUAL "")
|
# Jenkins automated build, use the set environment variables to avoid
|
||||||
# Jenkins automated build, use the set environment variables to avoid
|
# version mismatches between java's svn and command line's svn
|
||||||
# version mismatches between java's svn and command line's svn
|
set(TR_VCS_REVISION "$ENV{VCS_REVISION}")
|
||||||
set(TR_VCS_REVISION "$ENV{VCS_REVISION}")
|
|
||||||
else()
|
|
||||||
find_package(Subversion)
|
|
||||||
if(Subversion_FOUND)
|
|
||||||
Subversion_WC_INFO(${CMAKE_SOURCE_DIR} TR_SVN)
|
|
||||||
set(TR_VCS_REVISION "${TR_SVN_WC_REVISION}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
if(GIT_FOUND)
|
if(GIT_FOUND)
|
||||||
|
@ -91,27 +82,11 @@ if("${TR_VCS_REVISION}" STREQUAL "" AND EXISTS "${TR_VCS_REVISION_FILE}")
|
||||||
string(STRIP "${TR_VCS_REVISION}" TR_VCS_REVISION)
|
string(STRIP "${TR_VCS_REVISION}" TR_VCS_REVISION)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if("${TR_VCS_REVISION}" STREQUAL "")
|
if(NOT "${TR_VCS_REVISION}" STREQUAL "")
|
||||||
# Give up and check the source files
|
file(WRITE "${TR_VCS_REVISION_FILE}" "${TR_VCS_REVISION}")
|
||||||
set(TR_VCS_REVISION 0)
|
|
||||||
set(TR_VCS_REVISION_RELIABLE OFF)
|
|
||||||
file(GLOB_RECURSE TR_ALL_SOURCES RELATIVE ${CMAKE_SOURCE_DIR} *.cc *.[chm] *.po)
|
|
||||||
foreach(F ${TR_ALL_SOURCES})
|
|
||||||
file(STRINGS ${F} F_ID REGEX "\\$Id:")
|
|
||||||
if(F_ID MATCHES "\\$Id: [^ ]+ ([0-9]+) " AND CMAKE_MATCH_1 GREATER TR_VCS_REVISION)
|
|
||||||
set(TR_VCS_REVISION ${CMAKE_MATCH_1})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if("${TR_VCS_REVISION}" STREQUAL "")
|
|
||||||
set(TR_VCS_REVISION 0)
|
|
||||||
else()
|
else()
|
||||||
if(TR_VCS_REVISION_RELIABLE)
|
set(TR_VCS_REVISION 0)
|
||||||
file(WRITE "${TR_VCS_REVISION_FILE}" "${TR_VCS_REVISION}")
|
file(REMOVE "${TR_VCS_REVISION_FILE}")
|
||||||
else()
|
|
||||||
file(REMOVE "${TR_VCS_REVISION_FILE}")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
|
@ -20,28 +20,23 @@ peer_id_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_
|
||||||
major_version=`echo ${user_agent_prefix} | awk -F . '{print $1}'`
|
major_version=`echo ${user_agent_prefix} | awk -F . '{print $1}'`
|
||||||
minor_version=`echo ${user_agent_prefix} | awk -F . '{print $2 + 0}'`
|
minor_version=`echo ${user_agent_prefix} | awk -F . '{print $2 + 0}'`
|
||||||
|
|
||||||
|
vcs_revision=
|
||||||
vcs_revision_file=REVISION
|
vcs_revision_file=REVISION
|
||||||
vcs_revision_reliable=true
|
|
||||||
|
|
||||||
if [ -n "$JENKINS_URL" -a -n "$VCS_REVISION" ]; then
|
if [ -n "$JENKINS_URL" -a -n "$VCS_REVISION" ]; then
|
||||||
# Jenkins automated build, use the set environment variables to avoid
|
# Jenkins automated build, use the set environment variables to avoid
|
||||||
# version mismatches between java's svn and command line's svn
|
# version mismatches between java's svn and command line's svn
|
||||||
vcs_revision=$VCS_REVISION
|
vcs_revision=$VCS_REVISION
|
||||||
elif [ -d ".svn" ] && type svnversion >/dev/null 2>&1; then
|
elif [ -d ".git" ] && type git >/dev/null 2>&1; then
|
||||||
# If this is a svn tree, and svnversion is available in PATH, use it to
|
vcs_revision=`git rev-list --max-count=1 --abbrev-commit HEAD`
|
||||||
# grab the version.
|
|
||||||
vcs_revision=`svnversion -n . | cut -d: -f1 | cut -dM -f1 | cut -dS -f1`
|
|
||||||
elif [ -f "$vcs_revision_file" ]; then
|
elif [ -f "$vcs_revision_file" ]; then
|
||||||
vcs_revision=`cat "$vcs_revision_file"`
|
vcs_revision=`cat "$vcs_revision_file"`
|
||||||
else
|
|
||||||
# Give up and check the source files
|
|
||||||
vcs_revision=`awk '/\\$Id: /{ if ($4>i) i=$4 } END {print i}' */*.cc */*.[chm] */*.po`
|
|
||||||
vcs_revision_reliable=false
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $vcs_revision_reliable; then
|
if [ -n "$vcs_revision" ]; then
|
||||||
[ -f "$vcs_revision_file" ] && [ "`cat "$vcs_revision_file"`" = "$vcs_revision" ] || echo "$vcs_revision" > "$vcs_revision_file"
|
[ -f "$vcs_revision_file" ] && [ "`cat "$vcs_revision_file"`" = "$vcs_revision" ] || echo "$vcs_revision" > "$vcs_revision_file"
|
||||||
else
|
else
|
||||||
|
vcs_revision=0
|
||||||
rm -f "$vcs_revision_file"
|
rm -f "$vcs_revision_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue