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
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

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

Post by Kunda1 »

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.
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
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

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
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

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

Post by sgrogan »

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.
"fight the good fight"
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

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
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

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

Post by sgrogan »

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
"fight the good fight"
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

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

Post by Kunda1 »

So is that our way forward?
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
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

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

Post by Kunda1 »

Bump
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
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

Bump again
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

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

Post by openBrain »

Close to necro-bump :|
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

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

Post by looo »

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.
Post Reply