Skip to content


allow gitrev to be read from file #1934

merged 2 commits into from

3 participants

Team Kodi member

needed for building outside of a git repo

for post frodo

Team Kodi member

well, gitrev is just a text file that has the git revision of the build. Its a replacement for what the git log - that is used when configure is run from within a git repo - spits out. Its what the system info screen shows besides the build date.
It would be up to the user to fill it with the last git revision this source has.

This patch is probably only useful for packaging on linux, because e.g. launchpad only takes tarballs, you cannot build out of a git repo. That means that the Xbmc info screen shows buildate with revision Unknown. With this patch the packager could include this gitrev file to include that information and be in line with all other platforms that build from git dirs.

I'm not sure myself if this is necessary to be included in xbmc, up to you.

I agree that the filename could be more self explanatory, can change it if you agree with the idea of the PR.

Team Kodi member

ping @wsnipex

If you use tools/tools/mk-release-source to create your tarballs, you'll get pre-bootstrapped/codegen's sources that also contain a VERSION file.

The first line is the git revision as it was given (it could be a tag, branch, HEAD~5, etc)
The second line is the real git hash for that commit.
For non-tagged revisions, they will be the same thing.

I think this is what you needed here? If you change this to use VERSION (i used that filename because it's relatively common to indicate the version of the tarball), I believe you should be all set.

Team Kodi member

@theuni great :) I adjusted this to use the VERSION file. the cut command trims the revision to 16 chars, which would allow the exact same revision format as like building out of git (e.g. 20121215-abcdefg). What do you think?

Team Kodi member

@theuni I updated to use awk. I'd like to keep it generic enough to work also with VERSION files that contain only one line or more then two, so we always use the last line from the file.

Team Kodi member

@wsnipex mind simplifying a bit for readability?

awk 'END{print substr($1,1,16)}' VERSION

After that, I'd say we should get this in for Frodo, since it's harmless and will help us package it better

Team Kodi member

this is much cleaner indeed :) updated

wsnipex added some commits
@wsnipex wsnipex configure: allow GIT_REV to be read from VERSION file
needed for building outside of a git repo
@wsnipex wsnipex release-source script needs bash
on some systems /bin/sh is a simplistic posix shell
@davilla davilla merged commit 4af88e7 into xbmc:master
@wsnipex wsnipex deleted the wsnipex:gitrev branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 2, 2013
  1. @wsnipex

    configure: allow GIT_REV to be read from VERSION file

    wsnipex committed
    needed for building outside of a git repo
  2. @wsnipex

    release-source script needs bash

    wsnipex committed
    on some systems /bin/sh is a simplistic posix shell
Showing with 7 additions and 2 deletions.
  1. +6 −1
  2. +1 −1 tools/mk-release-source
@@ -2160,7 +2160,12 @@ if test "$HAVE_GIT" = "yes"; then
GIT_REV=$(git --no-pager log --abbrev=7 -n 1 --pretty=format:"%h %ci" HEAD | awk '{gsub("-", "");print $2"-"$1}')
if test "$GIT_REV" = ""; then
- GIT_REV="Unknown"
+ if test -f VERSION ; then
+ GIT_REV=$(awk 'END{print substr($1,1,16)}' VERSION)
+ if test -z $GIT_REV ; then GIT_REV="Unknown" ; fi
+ else
+ GIT_REV="Unknown"
+ fi
if test "$host_vendor" = "apple"; then
echo "#define GIT_REV \"$GIT_REV\"" > git_revision.h
2 tools/mk-release-source
@@ -1,4 +1,4 @@
Something went wrong with that request. Please try again.