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...)
User avatar
Kunda1
Posts: 5909
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Mon Jul 22, 2019 7:22 pm

openBrain wrote:
Mon Jul 22, 2019 5:04 pm
What about having a server (maybe the one hosting the website ???) subscribing to GitHub hooks (PushEvent and PullRequestEvent are the 2 I see ATM) through the REST API to update commit ID & hash on somewhere else that would be merged at compile time ?

PS : guys, please tell me if I'm making more noise than helping... ;)
For sure your opinion is valid and thank you for keeping the conversation going.
Yes, there is a server that we can use, AFAIK. If we can work on a proposal and get consensus, we may be able to implement this.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
openBrain
Posts: 2332
Joined: Fri Nov 09, 2018 5:38 pm

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

Postby openBrain » Mon Jul 22, 2019 7:43 pm

Would that already be possible to run a dry test eg. by subscribing to the hooks and writing some stupid log like :

Code: Select all

_date_time_ : an event of type _push/pullrequest_ occured
Commit ID is : _commit_ID_
New hash is : _repo_hash_
:?:
User avatar
sgrogan
Posts: 5452
Joined: Wed Oct 22, 2014 5:02 pm

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

Postby sgrogan » Mon Jul 22, 2019 8:33 pm

openBrain wrote:
Mon Jul 22, 2019 5:04 pm
What about having a server (maybe the one hosting the website ???) subscribing to GitHub hooks (PushEvent and PullRequestEvent are the 2 I see ATM) through the REST API to update commit ID & hash on somewhere else that would be merged at compile time ?
We can use the Travis-CI servers. For every push to master a build is triggered (this is happening already). This build generates a complete version.h file. We need to push this file to https://git.launchpad.net/~freecad-main ... versioning with either OAUTH or ssh (This is the part I don't know how to do).
Then trigger an update of the mirrored FreeCAD source here: https://git.launchpad.net/~freecad-main ... it/freecad
This can be done like this https://docs.travis-ci.com/user/deployment/launchpad/

The trick seems to be getting the proper credentials to Travis.
openBrain
Posts: 2332
Joined: Fri Nov 09, 2018 5:38 pm

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

Postby openBrain » Mon Jul 22, 2019 8:55 pm

Thanks @sgrogan. Things slowly makes sense to me, but so sorry I have more questions.
sgrogan wrote:
Mon Jul 22, 2019 8:33 pm
We can use the Travis-CI servers. For every push to master a build is triggered (this is happening already).
When you say "build", is that a complete code compilation ? Or just a simplest thing like a script ?
Actually I guess Travis-CI registers to GitHub hooks. ;)
This build generates a complete version.h file.
Is that also done already ? Where does that "build" happen ? On Travis-CI servers ?
We need to push this file to https://git.launchpad.net/~freecad-main ... versioning with either OAUTH or ssh (This is the part I don't know how to do).
According this doc (step 1), you have to send a forged POST request to Launchpad to get your OAUTH key. Then register Launchpad with this key as a provider in Travis (travis.yml file according the doc).
Then I don't know Travis and thus don't know which kind of command can be used to copy the file... :?
User avatar
sgrogan
Posts: 5452
Joined: Wed Oct 22, 2014 5:02 pm

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

Postby sgrogan » Mon Jul 22, 2019 9:13 pm

openBrain wrote:
Mon Jul 22, 2019 8:55 pm
When you say "build", is that a complete code compilation ? Or just a simplest thing like a script ?
Actually I guess Travis-CI registers to GitHub hooks. ;)
Travis first runs cmake (this is where the version.h is created), then make (to compile the code), then it runs FreeCAD's self tests from the command line (so no gui tests)
We can take the file any time in the process we want. ie only deploy if compilation is successful, or if all tests pass.
The magic happens in the .travis.yml file https://github.com/FreeCAD/FreeCAD/blob ... travis.yml
openBrain wrote:
Mon Jul 22, 2019 8:55 pm
Then I don't know Travis and thus don't know which kind of command can be used to copy the file... :?
Travis is basically a bash shell so git clone, cp, git commit, git push
We need to figure out where everything is in the Travis directory structure, but I think that the permissions are the gating item.

EDIT: A typical Travis build log looks like this https://travis-ci.org/FreeCAD/FreeCAD/jobs/562132785
User avatar
Kunda1
Posts: 5909
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Fri Aug 09, 2019 12:11 pm

So is that our way forward?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5909
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Thu Aug 22, 2019 3:58 pm

Bump
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
openBrain
Posts: 2332
Joined: Fri Nov 09, 2018 5:38 pm

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

Postby openBrain » Fri Sep 06, 2019 8:49 am

Bump again
openBrain
Posts: 2332
Joined: Fri Nov 09, 2018 5:38 pm

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

Postby openBrain » Tue Oct 08, 2019 10:24 am

Close to necro-bump :|
looo
Posts: 2948
Joined: Mon Nov 11, 2013 5:29 pm

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

Postby looo » Tue Oct 08, 2019 10:55 am

What is the state of this issue?

I had a brief look at the version creation which seems to happen here:
https://github.com/FreeCAD/FreeCAD/blob ... ubWCRev.py

Maybe we can add another option "GitLogControl" or similar. Then we simply pull the recent commit history with:

Code: Select all

curl  https://api.github.com/repos/FreeCAD/FreeCAD/commits >~/test.txt
and retrieve the necessary information by parsing this file.

For building FreeCAD we can first download the commit information and use this to pull the source. This way we avoid differences of commit information and source-state which can happen if a Commit is made in the time between pulling commit info and pulling the source. I guess for releases we can simply add the commit information to the assets.

This at least would solve the issue for conda where we currently do a "git clone" for every build which is quite a waste of resources.
please help with my conda-packaging efforts: https://liberapay.com/looooo/