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...)
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 »

@kkremitzi, as you proposed in the ticket, may you please explain roughly in some lines the current building process ? Thx.
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 »

openBrain wrote: Sun Jun 23, 2019 5:43 pm @kkremitzi, as you proposed in the ticket, may you please explain roughly in some lines the current building process ? Thx.
Definitely!

The build is controlled by this Launchpad recipe which automatically gets built every day: https://code.launchpad.net/~freecad-mai ... dual-build

Here's the recipe:

Code: Select all

# git-build-recipe format 0.4 deb-version {debupstream}~{time}
lp:~freecad-maintainers/freecad/+git/freecad master
nest-part debian lp:freecad debian debian ppa/daily
So, if you look at lines 2 & 3 you see it pulls in code from two Launchpad repos: https://code.launchpad.net/~freecad-mai ... it/freecad and https://code.launchpad.net/~freecad-mai ... ecad-salsa.

The first is set to automatically sync with github.com/freecad/freecad, the code repo. The second syncs automatically to salsa.debian.org/science-team/freecad, the packaging repo. You can see it pulls in the debian folder from the ppa/daily branch of the science-team repo and combines it with the github master, putting it in ./debian.

From there, the normal Debian build process takes place.

BTW, this issue is also related to the fact that i have to use a patch in order to display "0.18.2" in Help > About FreeCAD and on the splash screen during startup: https://salsa.debian.org/science-team/f ... ecad.patch

So, if we can fix the daily builds showing the git commit hash after 0.19, that solution may also allow us to correctly set the release version number without needing a patch.
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.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

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

Post by sgrogan »

kkremitzki wrote: Sun Jun 23, 2019 7:35 pm The first is set to automatically sync with github.com/freecad/freecad, the code repo
It does this about every 5 hours. It's not guaranteed that the source is in-sync with upstream.
"fight the good fight"
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 »

Hi guys,

Thanks for details. Tried to dig a bit. I'm new to this, so tell me if I'm wrong :
  • The build revision displayed in the about box is get from the "BuildRevisionBranch" of the App Config
  • It is populated in the Config by the preprocessor if the "FCRepositoryBranch" macro has been #defined
  • This macro is appended to the code in "SubWCRev.py" which get info through git
  • This script is itself called in CMakeLists.txt at build time
Given that, how does that sound to patch "SubWCRev.py" ? Notice that I actually don't know ATM why it fails. :)
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

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

Post by sgrogan »

openBrain wrote: Mon Jun 24, 2019 2:40 pm Given that, how does that sound to patch "SubWCRev.py" ? Notice that I actually don't know ATM why it fails. :)
The script works as intended.
The issue is that the Lauchpad build process creates a Debian source package. When the source package is created the git info (revision history) is stripped, so the needed info doesn't exist in the package anymore. Further during the build process there is no web access (abdullah tried to use the GithubWeb API to get the info)

EDIT: This link is interesting for future discussion https://docs.travis-ci.com/user/deployment/launchpad/
"fight the good fight"
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 »

Just a thought : couldn't that topic be pushed in the Configuration Management GSoC ?
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

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

Post by sgrogan »

openBrain wrote: Mon Jul 01, 2019 6:20 pm Just a thought : couldn't that topic be pushed in the Configuration Management GSoC ?
Phase 1 was Linux, which is passed.
Phase 2 is Windows.
Maybe if there is extra time at the end (HaHa extra time for packaging configuration management is a pipe dream)

Maybe we could get the date into the About FreeCAD copy to clipboard? Better than nothing as Quick61 points out.
"fight the good fight"
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

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

Post by wmayer »

As long as the source code is handled by a VCS then the Version.h is created at build time trying to access the information through commands of the VCS.
When creating a tarball stripping the VCS meta data then usually a Version.h doesn't exist and it becomes impossible to determine the needed information afterwards.

So far the only reliable way to create a source tarball with a Version.h is to call make dist-git from within the build directory and where the source directory still has the git meta data.
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 »

wmayer wrote: Thu Jul 04, 2019 7:52 am So far the only reliable way to create a source tarball with a Version.h is to call make dist-git from within the build directory and where the source directory still has the git meta data.
Does git meta data exist if the tarball is not retrieved from git?
I'm asking about distros/packages that don't compile from the git repo.
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
PrzemoF
Veteran
Posts: 3520
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

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

Post by PrzemoF »

As far as I know the info is not there. I build for fedora and I use some tricks to get the numbers:

- bash function that generates number of git commits [1]
- section of fedora spec file that fixes Version.h using sed [2]

[1] https://github.com/FreeCAD/FreeCAD/blob ... .macros#L1
[2] https://github.com/FreeCAD/FreeCAD/blob ... .spec#L160
Post Reply