Version/Build number in Launcher window

Feedback on past, current, and future development.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Version/Build number in Launcher window

Post by scrawl »

It seems travis now always fails with:
CMake Error at CMakeLists.txt:39 (message):
Failed to get valid version information from Git
https://travis-ci.org/zinnschlag/openmw/builds/18477085
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: Version/Build number in Launcher window

Post by pvdk »

That must be because Travis can't find git. Does it have git included in its path?

EDIT: the link suggests it does run some git commands successfully, but I suspect find_package(Git QUIET) fails. Maybe removing the QUIET part will give more information.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Version/Build number in Launcher window

Post by scrawl »

Also, this will most definitely fail for downloaded source tarballs, which do not have a git repository in them.
Any idea how to handle that?
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: Version/Build number in Launcher window

Post by pvdk »

Yeah good point, maybe add a CMake flag for that, or only show the version info if the git tag was found?
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Version/Build number in Launcher window

Post by scrawl »

I think we'll still want openmw --version to show the correct version for a tarball, because afaik some distros use that for their packages.
User avatar
cc9cii
Posts: 523
Joined: 28 Mar 2013, 04:01

Re: Version/Build number in Launcher window

Post by cc9cii »

Seems to break windows build. I'm using TortoiseGit so it might be that CMake doesn't know where to find git executable. Worked around by editing CMakeLists for now.

Edit: adding %AppData%\..\Local\Programs\Git\bin to PATH (via Control Panel) fixes it
User avatar
Greendogo
Posts: 1467
Joined: 26 Aug 2011, 02:04

Re: Version/Build number in Launcher window

Post by Greendogo »

I assume at some point the OpenCS's version/build number will be found in a window/menu somewhere inside it?
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Version/Build number in Launcher window

Post by Zini »

At some point. Still very short on manpower for OpenCS, so less important tasks tend to be left by the wayside for now.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Version/Build number in Launcher window

Post by scrawl »

I have found the problem for travis. It uses a git clone --depth=50, that is, a shallow clone with history limited to the last 50 revisions. That means it also doesn't have the tags, and git rev-list --tags will return nothing.

Edit: doing a git fetch --tags first resolves this.

As mentioned earlier though, we still want a way to disable this stuff for tarballs.
User avatar
pvdk
Posts: 528
Joined: 12 Aug 2011, 16:34

Re: Version/Build number in Launcher window

Post by pvdk »

Yes, for the shallow clone problem and for the source tarball version problem I actually found a solution in the Kdenlive CMakeLists.txt:

Code: Select all

# To be switched on when releasing.
option(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" OFF)

# Get current version.
set(VERSION "\"${KDENLIVE_VERSION}\"")
if(NOT RELEASE_BUILD)
  if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
    # Probably a Git workspace: determine the revision.
    find_package(Git)
    if(GIT_FOUND)
      exec_program(${GIT_EXECUTABLE}
        ${CMAKE_CURRENT_SOURCE_DIR}
        ARGS "describe --tags"
        OUTPUT_VARIABLE KDENLIVE_GIT_REVISION
        RETURN_VALUE TAG_RESULT
      )
      # git describe --tags failed, for example it fails if repo was checked with depth=1
      if(NOT ${TAG_RESULT} EQUAL 0)
        exec_program(${GIT_EXECUTABLE}
          ${CMAKE_CURRENT_SOURCE_DIR}
          ARGS "describe --always"
          OUTPUT_VARIABLE KDENLIVE_GIT_REVISION
        )
      endif(NOT ${TAG_RESULT} EQUAL 0)
      message("Current Kdenlive Git revision is ${KDENLIVE_GIT_REVISION}")
      set(VERSION "\"${KDENLIVE_VERSION} (rev. ${KDENLIVE_GIT_REVISION})\"")
    else(GIT_FOUND)
      message("Could not determine the Git revision")
    endif(GIT_FOUND)
  endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
endif(NOT RELEASE_BUILD)
How does that look? We still would have to define the version manually for source tarball builds though.
Post Reply