gsliepen / tinc

a VPN daemon
http://tinc-vpn.org/
Other
1.87k stars 280 forks source link

version.py: fall back to a version file if git directory is missing #359

Closed hg closed 2 years ago

hg commented 2 years ago

We first try to get the git tag if .git directory is present. git is forced to look in the source tree and not go above it in case tinc's source is located inside another git repository.

If this fails, we read the VERSION file.

If that fails, we fall back to unknown.

The file will have to be updated manually. I can adjust the script to update the file automatically if it's called by the user (and not by meson), this is easy to do by looking at environment variables.

This should fix #358.

gsliepen commented 2 years ago

It's not correct. If I try to build tinc without a .git/ directory, I get this error:

/tmp/tinc-1.1> meson build
[...]
/tmp/tinc-1.1> ninja -C build
ninja: Entering directory `build'
[29/95] Generating src/include/version_git.h with a custom command
fatal: not a git repository: '/tmp/tinc-1.1/src/include/.git'
could not read version from file [Errno 2] No such file or directory: '/tmp/tinc-1.1/src/include/VERSION'
[95/95] Linking target src/tinc
hg commented 2 years ago

Oops, sorry. I forgot the source was located inside another repository. Should be fine now.