From fdc3f2cc172e1c1926f4febc1c4618189b6be3f3 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 24 Jul 2015 01:01:38 +0200 Subject: [PATCH] build: add OVERRIDE_VERSION, used in Travis Fixes https://github.com/awesomeWM/awesome/issues/160. --- .travis.yml | 5 ++++- awesomeConfig.cmake | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43b1c5913..850b1a0fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,6 +90,9 @@ install: # Deps for functional tests. - sudo apt-get install -qq dbus-x11 xterm xdotool xterm xvfb + # Determine custom version. + - '[ "$TRAVIS_PULL_REQUEST" = false ] && version="${TRAVIS_BRANCH}-g$(git rev-parse --short HEAD)-$(date -Iseconds)" || version="${TRAVIS_BRANCH}-PR${TRAVIS_PULL_REQUEST}-g$(git rev-parse --short HEAD)-$(date -Iseconds)"' + script: - - export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIB} -DLUA_INCLUDE_DIR=/usr/include/lua${LUAPKG}" + - export CMAKE_ARGS="-DLUA_LIBRARY=${LUALIB} -DLUA_INCLUDE_DIR=/usr/include/lua${LUAPKG} -D OVERRIDE_VERSION=$version" - make && sudo env PATH=$PATH make install && awesome --version && tests/run.sh diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index bd9b374fe..ddf3cd781 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -89,14 +89,16 @@ endif() # }}} # {{{ Version stamp -if(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE) +if(OVERRIDE_VERSION) + set(VERSION ${OVERRIDE_VERSION}) +elseif(EXISTS ${SOURCE_DIR}/.git/HEAD AND GIT_EXECUTABLE) # get current version execute_process( COMMAND ${GIT_EXECUTABLE} describe --dirty WORKING_DIRECTORY ${SOURCE_DIR} OUTPUT_VARIABLE VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) - # file the git-version-stamp.sh script will look into + # File the build-utils/git-version-stamp.sh script will look into. set(VERSION_STAMP_FILE ${BUILD_DIR}/.version_stamp) file(WRITE ${VERSION_STAMP_FILE} ${VERSION}) # create a version_stamp target later