Ticket #4014 - Finding a solution for the 'version.h' issue

This subforum is specifically to discuss packaging issues on different platforms (windows, mac, linux), and using different packaging systems (conda, etc...)
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Finding a solution for the 'version.h' issue

Post by reox »

I did something similar with my daily build script: https://gist.github.com/reox/522922a1a6 ... ild-sh-L38
But that depends highly on running your own infrastructure for building.
Kunda1 wrote: Thu Jul 04, 2019 12:05 pm Does git meta data exist if the tarball is not retrieved from git?
No, if you create a tarball with git archive, it will not contain the .git folder.
But if you start pbuilder from within a git repo (not gbp!) it will put it into the src tar if you not specify to ignore it: https://github.com/reox/FreeCAD_gitpack ... ce/options
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Finding a solution for the 'version.h' issue

Post by openBrain »

Sorry if this is b*llsh*t, but couldn't that be a way to use a git hook among pre-push, pre-receive, update or post-receive ?
So the version.h is updated at push time & not at compile time. :?:
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Finding a solution for the 'version.h' issue

Post by Kunda1 »

openBrain wrote: Thu Jul 04, 2019 5:31 pm Sorry if this is b*llsh*t, but couldn't that be a way to use a git hook among pre-push, pre-receive, update or post-receive ?
So the version.h is updated at push time & not at compile time. :?:
This makes sense but if I recall correctly from some time ago that there may be a security concern involved with this approach.

Perhaps @kkremitzki remembers?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Finding a solution for the 'version.h' issue

Post by kkremitzki »

The file has to be made at build-time. You can't take a hash of a repository and then put it in a file in that repository because it changes the hash.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Finding a solution for the 'version.h' issue

Post by openBrain »

Sure. But at least the commit number used in the version could be managed that way, right ?

EDIT : it's tricky but could hash be written in a file in a different repo/branch and this file being integrated at compile time ?

EDIT2 : even trickier, a pre-push hook that will append to the last commit message the hash (hopefully commit messages aren't took into account into the hash)
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Finding a solution for the 'version.h' issue

Post by reox »

openBrain wrote: Thu Jul 04, 2019 6:46 pm EDIT : it's tricky but could hash be written in a file in a different repo/branch and this file being integrated at compile time ?
this is what the old daily build did. But the repo grows to very large size and traversing all the objects takes a long time...
So yes, IIRC you can create a "update" hook which has the sha1 hash of the pushed commit and you could write this into some other repo and push it server side.
I'm not sure if it would be possible to create a new commit in the same repo inside the hook... I guess that is prone to infinit recursions and disregarded :mrgreen:
openBrain wrote: Thu Jul 04, 2019 6:46 pm EDIT2 : even trickier, a pre-push hook that will append to the last commit message the hash (hopefully commit messages aren't took into account into the hash)
I would never rewrite anything server side - I'm not sure if this is even possible.
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Finding a solution for the 'version.h' issue

Post by openBrain »

reox wrote: Thu Jul 04, 2019 7:15 pm
openBrain wrote: Thu Jul 04, 2019 6:46 pm EDIT2 : even trickier, a pre-push hook that will append to the last commit message the hash (hopefully commit messages aren't took into account into the hash)
I would never rewrite anything server side - I'm not sure if this is even possible.
AFAIK pre-push is client side. ;)
reox
Posts: 929
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Finding a solution for the 'version.h' issue

Post by reox »

openBrain wrote: Thu Jul 04, 2019 7:26 pm
reox wrote: Thu Jul 04, 2019 7:15 pm
openBrain wrote: Thu Jul 04, 2019 6:46 pm EDIT2 : even trickier, a pre-push hook that will append to the last commit message the hash (hopefully commit messages aren't took into account into the hash)
I would never rewrite anything server side - I'm not sure if this is even possible.
AFAIK pre-push is client side. ;)
ah sorry ;)
okay but this does not solve the issue. everyone developing for FC must have this hook then, and merges on github would not work with this...
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Finding a solution for the 'version.h' issue

Post by jmaustpc »

As other have said, couldn't we include a new line with "build time and date"?
User avatar
kkremitzki
Veteran
Posts: 2511
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Finding a solution for the 'version.h' issue

Post by kkremitzki »

Including build date/time in the packaging output is not an ideal solution, it prevents FreeCAD from ever having reproducible builds. The ideal thing would be some property we get or calculate from the source. We are using a synced copy from the Github repo so the commits should be the same. I noticed the daily build does not have git as a build dependency, so I've added this just now to see what effect it has on today's builds re: the version number.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
Post Reply