Closed farseerfc closed 5 years ago
We need some solution for this without making debugging a nightmare (generate an alternative, meaningful gitversion.h if .git/HEAD is missing)
What about defaulting it to the current version? So packagers don't need to hardcode a gitversion.h (like archlinux does, and the nix package I'm writing too)
Do you have a good way of doing it automatically? I know I'll keep forgetting to do that, I forget this all the time with androidmanifest.xml in my Android projects.
Does nix require building from the tarball, BTW? There are signed tags available.
On October 31, 2017 3:55:29 PM GMT+01:00, Francesco Gazzetta notifications@github.com wrote:
What about defaulting it to the current version? So packagers don't need to hardcode a gitversion.h (like archlinux does, and the nix package I'm writing too)
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/gjedeer/tuntox/issues/35#issuecomment-340788302
-- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Just a suggestion: if you are fine about debugging with a version number instead of a git hash id, then maybe you can force a version number to match with the tag name by using a pre-push hook like this: https://gist.github.com/farseerfc/0729c08cd7c82b07000f20105f733b17
So that when you forget to update version number manually, this hook will prevent you from doing git push --tags
@farseerfc nice! I'll use that when releasing 0.0.8. I'll combine that with a .FORCE target for gitversion.h in Makefile which will overwrite it with a git release if git is available and leave as-is otherwise. This way I'll get commit hashes for releases between versions and package maintainers get a version string.
@farseerfc If you want to appear in the commit history, please send a pull request creating pre-push.sh in the scripts/ directory.
Hmm then if it's ok to have the version tag instead of the commit hash I could already put it automatically in gitversion.h
, since I already use 0.0.7
both as the package version and to get the appropriate commit.
Then in version 0.0.8 I'll just remove the patch
EDIT: Well, actually hardcoding the hash just for a single version isn't that bad. I just don't like redundant data. Thanks @farseerfc for the hook idea!
@fgaz as long as 0.0.7 means the commit tagged as 0.0.7 then sure, it's okay. 0.0.8 is coming in a moment because 0.0.7 was a bit faulty.
I'm not making a git release yet but can you guys check out if 0.0.8 tag works for you? ( 44a23bb )
Seems working:
2017-11-01 20:36:20: [INFO] Tuntox built from git commit 0.0.8
Thanks!
Waiting for the 0.0.8 release ~
~/nixpkgs/pkgs/tools/networking/tuntox $ ./result/bin/tuntox
2017-11-01 12:34:41: [INFO] Tuntox built from git commit 0.0.8
Works for me too! thanks!
Closing, it seems it works for everyone now
But the released tarball only have source codes. So the build will fail with