Any qmake experts out there?

Linus Torvalds torvalds at linux-foundation.org
Wed Jan 28 11:04:21 PST 2015


The subsurface version generation code is wrong, and I don't know
enough about qmake to fix it.

Isubsurface-gen-version.pridoes this:

   exists(.git/HEAD): {
        win32: SET_GIT_DIR = set GIT_DIR
        else: SET_GIT_DIR = GIT_DIR
        GIT_HEAD = .git/HEAD
        VERSION_SCRIPT = $$PWD/scripts/get-version
   ...

and qmake will generate dependencies in .git/HEAD etc. But that's
actually completely bogus, as shows by this trivial situation:

    git gc --prune=now

which will pack things and actually remioves the .git/refs/master
file, because it's just going to be one entry in the packed ref file
(.git/packed-refs). Which then results in

    make: *** No rule to make target '.git/refs/heads/master', needed
by 'ssrf-version.h'.  Stop.

because qmake has decided that there's that hard dependency on that
internal git file that pruning and packing the repository got rid of
as unnecessary.

The proper way to get the git version is to just do

     # get raw SHA1
     git rev-parse HEAD

     # get "description" of it
     git describe --tags --abbrev=12

but actually accessing the .git/HEAD file directly is very wrong. But
I have no idea how to do git commands in the *.pri file, and handling
failure gracefully (in case it's not a git repository etc).

Hmm?

                           Linus


More information about the subsurface mailing list