Replace SVN and SCM with VCS everywhere

This commit is contained in:
Mike Gelfand 2016-09-02 22:02:51 +03:00
parent b237a260c5
commit b875e79f3d
4 changed files with 39 additions and 39 deletions

View File

@ -56,19 +56,19 @@ else()
set(TR_STABLE_RELEASE 1)
endif()
set(TR_SCM_REVISION_FILE "${CMAKE_SOURCE_DIR}/REVISION")
set(TR_SCM_REVISION_RELIABLE ON)
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{SVN_REVISION}" STREQUAL "")
if(NOT "$ENV{JENKINS_URL}" STREQUAL "" AND NOT "$ENV{VCS_REVISION}" STREQUAL "")
# Jenkins automated build, use the set environment variables to avoid
# version mismatches between java's svn and command line's svn
set(TR_SCM_REVISION "$ENV{SVN_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_SCM_REVISION "${TR_SVN_WC_REVISION}")
set(TR_VCS_REVISION "${TR_SVN_WC_REVISION}")
endif()
endif()
elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
@ -80,37 +80,37 @@ elseif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
WORKING_DIRECTORY
${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE
TR_SCM_REVISION
TR_VCS_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
endif()
if("${TR_SCM_REVISION}" STREQUAL "" AND EXISTS "${TR_SCM_REVISION_FILE}")
file(READ "${TR_SCM_REVISION_FILE}" TR_SCM_REVISION)
string(STRIP "${TR_SCM_REVISION}" TR_SCM_REVISION)
if("${TR_VCS_REVISION}" STREQUAL "" AND EXISTS "${TR_VCS_REVISION_FILE}")
file(READ "${TR_VCS_REVISION_FILE}" TR_VCS_REVISION)
string(STRIP "${TR_VCS_REVISION}" TR_VCS_REVISION)
endif()
if("${TR_SCM_REVISION}" STREQUAL "")
if("${TR_VCS_REVISION}" STREQUAL "")
# Give up and check the source files
set(TR_SCM_REVISION 0)
set(TR_SCM_REVISION_RELIABLE OFF)
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_SCM_REVISION)
set(TR_SCM_REVISION ${CMAKE_MATCH_1})
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_SCM_REVISION}" STREQUAL "")
set(TR_SCM_REVISION 0)
if("${TR_VCS_REVISION}" STREQUAL "")
set(TR_VCS_REVISION 0)
else()
if(TR_SCM_REVISION_RELIABLE)
file(WRITE "${TR_SCM_REVISION_FILE}" "${TR_SCM_REVISION}")
if(TR_VCS_REVISION_RELIABLE)
file(WRITE "${TR_VCS_REVISION_FILE}" "${TR_VCS_REVISION}")
else()
file(REMOVE "${TR_SCM_REVISION_FILE}")
file(REMOVE "${TR_VCS_REVISION_FILE}")
endif()
endif()

View File

@ -3,10 +3,10 @@
#define PEERID_PREFIX "${TR_PEER_ID_PREFIX}"
#define USERAGENT_PREFIX "${TR_USER_AGENT_PREFIX}"
#define SVN_REVISION "${TR_SCM_REVISION}"
#define SVN_REVISION_NUM ${TR_SCM_REVISION}
#define VCS_REVISION "${TR_VCS_REVISION}"
#define VCS_REVISION_NUM ${TR_VCS_REVISION}
#define SHORT_VERSION_STRING "${TR_USER_AGENT_PREFIX}"
#define LONG_VERSION_STRING "${TR_USER_AGENT_PREFIX} (${TR_SCM_REVISION})"
#define LONG_VERSION_STRING "${TR_USER_AGENT_PREFIX} (${TR_VCS_REVISION})"
#define VERSION_STRING_INFOPLIST ${TR_USER_AGENT_PREFIX}
#define MAJOR_VERSION ${TR_VERSION_MAJOR}
#define MINOR_VERSION ${TR_VERSION_MINOR}

View File

@ -28,7 +28,7 @@
<key>CFBundleExecutable</key>
<string>Transmission</string>
<key>CFBundleGetInfoString</key>
<string>VERSION_STRING_INFOPLIST (SVN_REVISION_NUM)</string>
<string>VERSION_STRING_INFOPLIST (VCS_REVISION_NUM)</string>
<key>CFBundleHelpBookFolder</key>
<string>TransmissionHelp</string>
<key>CFBundleHelpBookName</key>
@ -59,7 +59,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>SVN_REVISION_NUM</string>
<string>VCS_REVISION_NUM</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>

View File

@ -20,38 +20,38 @@ peer_id_prefix=`grep m4_define configure.ac | sed "s/[][)(]/,/g" | grep peer_id_
major_version=`echo ${user_agent_prefix} | awk -F . '{print $1}'`
minor_version=`echo ${user_agent_prefix} | awk -F . '{print $2 + 0}'`
svn_revision_file=REVISION
svn_revision_reliable=true
vcs_revision_file=REVISION
vcs_revision_reliable=true
if [ -n "$JENKINS_URL" -a -n "$SVN_REVISION" ]; then
if [ -n "$JENKINS_URL" -a -n "$VCS_REVISION" ]; then
# Jenkins automated build, use the set environment variables to avoid
# version mismatches between java's svn and command line's svn
svn_revision=$SVN_REVISION
vcs_revision=$VCS_REVISION
elif [ -d ".svn" ] && type svnversion >/dev/null 2>&1; then
# If this is a svn tree, and svnversion is available in PATH, use it to
# grab the version.
svn_revision=`svnversion -n . | cut -d: -f1 | cut -dM -f1 | cut -dS -f1`
elif [ -f "$svn_revision_file" ]; then
svn_revision=`cat "$svn_revision_file"`
vcs_revision=`svnversion -n . | cut -d: -f1 | cut -dM -f1 | cut -dS -f1`
elif [ -f "$vcs_revision_file" ]; then
vcs_revision=`cat "$vcs_revision_file"`
else
# Give up and check the source files
svn_revision=`awk '/\\$Id: /{ if ($4>i) i=$4 } END {print i}' */*.cc */*.[chm] */*.po`
svn_revision_reliable=false
vcs_revision=`awk '/\\$Id: /{ if ($4>i) i=$4 } END {print i}' */*.cc */*.[chm] */*.po`
vcs_revision_reliable=false
fi
if $svn_revision_reliable; then
[ -f "$svn_revision_file" ] && [ "`cat "$svn_revision_file"`" -eq "$svn_revision" ] || echo "$svn_revision" > "$svn_revision_file"
if $vcs_revision_reliable; then
[ -f "$vcs_revision_file" ] && [ "`cat "$vcs_revision_file"`" = "$vcs_revision" ] || echo "$vcs_revision" > "$vcs_revision_file"
else
rm -f "$svn_revision_file"
rm -f "$vcs_revision_file"
fi
cat > libtransmission/version.h.new << EOF
#define PEERID_PREFIX "${peer_id_prefix}"
#define USERAGENT_PREFIX "${user_agent_prefix}"
#define SVN_REVISION "${svn_revision}"
#define SVN_REVISION_NUM ${svn_revision}
#define VCS_REVISION "${vcs_revision}"
#define VCS_REVISION_NUM ${vcs_revision}
#define SHORT_VERSION_STRING "${user_agent_prefix}"
#define LONG_VERSION_STRING "${user_agent_prefix} (${svn_revision})"
#define LONG_VERSION_STRING "${user_agent_prefix} (${vcs_revision})"
#define VERSION_STRING_INFOPLIST ${user_agent_prefix}
#define MAJOR_VERSION ${major_version}
#define MINOR_VERSION ${minor_version}