Generate useful release tag in RPM specfile

This commit is contained in:
Andrew Nelless 2017-05-22 09:52:27 +01:00
parent b52eb95f41
commit 0f137543e4
2 changed files with 24 additions and 8 deletions

View File

@ -76,23 +76,39 @@ endif()
if (NOT DEFINED SYNERGY_REVISION) if (NOT DEFINED SYNERGY_REVISION)
if (DEFINED ENV{GIT_COMMIT}) if (DEFINED ENV{GIT_COMMIT})
string (SUBSTRING $ENV{GIT_COMMIT} 0 7 SYNERGY_REVISION) string (SUBSTRING $ENV{GIT_COMMIT} 0 7 SYNERGY_REVISION)
elseif (SYNERGY_VERSION_STAGE STREQUAL "git")
execute_process (
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE SYNERGY_REVISION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif() endif()
endif() endif()
if (SYNERGY_VERSION_STAGE STREQUAL "git") #if (NOT "${SYNERGY_REVISION}" MATCHES "[a-f0-9]{8}")
if (NOT DEFINED SYNERGY_REVISION) # message (FATAL_ERROR "SYNERGY_VERSION='${SYNERGY_REVISION}' is an invalid git shorthash")
message (FATAL_ERROR "Either SYNERGY_REVISION or SYNERGY_VERSION_STAGE must be set.") #endif()
string (TIMESTAMP SYNERGY_BUILD_DATE "%Y%m%d" UTC)
if (DEFINED ENV{BUILD_NUMBER})
set (SYNERGY_BUILD_NUMBER $ENV{BUILD_NUMBER}})
else()
set (SYNERGY_BUILD_NUMBER 1)
endif() endif()
set (SYNERGY_VERSION_TAG "g${SYNERGY_REVISION}")
set (SYNERGY_VERSION "${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}")
set (SYNERGY_SNAPSHOT_INFO "${SYNERGY_BUILD_DATE}.${SYNERGY_REVISION}")
if (SYNERGY_VERSION_STAGE STREQUAL "git")
set (SYNERGY_VERSION_TAG "b${SYNERGY_BUILD_NUMBER}.${SYNERGY_SNAPSHOT_INFO}")
else() else()
set (SYNERGY_VERSION_TAG "${SYNERGY_VERSION_STAGE}") set (SYNERGY_VERSION_TAG "${SYNERGY_VERSION_STAGE}")
endif() endif()
set (SYNERGY_VERSION "${SYNERGY_VERSION_MAJOR}.${SYNERGY_VERSION_MINOR}.${SYNERGY_VERSION_PATCH}")
set (SYNERGY_VERSION_STRING "${SYNERGY_VERSION}-${SYNERGY_VERSION_TAG}") set (SYNERGY_VERSION_STRING "${SYNERGY_VERSION}-${SYNERGY_VERSION_TAG}")
message (STATUS "Full Synergy version string is " ${SYNERGY_VERSION_STRING}) message (STATUS "Full Synergy version string is " ${SYNERGY_VERSION_STRING})
# TODO: Find out why we need these, and remove them # TODO: Find out why we need these, and remove them
if (COMMAND cmake_policy) if (COMMAND cmake_policy)
cmake_policy (SET CMP0003 NEW) cmake_policy (SET CMP0003 NEW)

View File

@ -7,7 +7,7 @@ Source: https://symless.com/synergy/downloads
Vendor: Symless Vendor: Symless
Packager: Symless <engineering@symless.com> Packager: Symless <engineering@symless.com>
License: GPLv2 License: GPLv2
Release: 1 Release: @SYNERGY_BUILD_NUMBER@.@SYNERGY_SNAPSHOT_INFO@%{?dist}
%description %description
Synergy allows you to share one mouse and keyboard between multiple computers. Synergy allows you to share one mouse and keyboard between multiple computers.