Patching to display 0.18.1 & the topic of git commits/patch versions

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
kkremitzki
Posts: 2159
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Patching to display 0.18.1 & the topic of git commits/patch versions

Postby kkremitzki » Tue Apr 16, 2019 11:39 pm

For the Debian package release of 0.18.1, I wanted the application to display 0.18.1 in the splash screen and in Help > About FreeCAD, so I made a basic patch:
https://salsa.debian.org/science-team/f ... ecad.patch

However this has turned out to have problems with 3rd party code relying on the minor version to be an integer, so it's proven to not be ideal. I'd like to be able to set patch version to 1, but a) that doesn't display in the needed places and b) it's already taken by the git commit so we run into the risk of breaking other 3rd party code.

Another problem with this patching method is that it's specific to Debian/Ubuntu family packages and the PPA, so Windows/Mac/other Linuxes won't get the same experience, potentially causing support problems.

It'd be nice to discuss approaches to solving this issue and provide a fix for it in 0.18.2.
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.
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Patching to display 0.18.1 & the topic of git commits/patch versions

Postby vocx » Wed Apr 17, 2019 12:34 am

kkremitzki wrote:
Tue Apr 16, 2019 11:39 pm
...
However this has turned out to have problems with 3rd party code relying on the minor version to be an integer, so it's proven to not be ideal.
...
This is an example: (Bug) Problem running the dependency checker.

The CfdOF workbench checks the version reported by FreeCAD in order to know if the prerequisites are installed. It is not a big problem, as this is only a check for dependencies. If you have everything installed, the check may fail but everything will still work (as far as I know).

My question is, where are these numbers defined in the source code? Only in the CMakeLists.txt file? That is, are they added just before compilation by CMake and make?

In the particular case of CfdOF, it doesn't seem to be a very critical problem. The workbench could parse the output of FreeCAD.Version() better, in order to catch the version number as "18" with a "123456 (Git)", or "18.1", or whatever.

Code: Select all

# FreeCAD stable, Ubuntu PPA
ver = FreeCAD.Version()
print(ver)
['0', '18.1', '', 'https://code.launchpad.net/~vcs-imports/freecad/trunk', '2019/04/06 19:19:55']

Code: Select all

# FreeCAD daily, Ubuntu PPA
ver = FreeCAD.Version()
print(ver)
['0', '18', '16093 (Git)', 'git://github.com/FreeCAD/FreeCAD.git releases/FreeCAD-0-18', '2019/03/12 13:38:07', 'releases/FreeCAD-0-18', '690774c0effe4fd7b8d2b5e2fb2b8c8d145e21ce']
Personally, I prefer something that keeps the git commit number.

Code: Select all

# It would be 0.18
['0', '18', '16093 (Git) (stable)']

# It would be 0.18.1
['0', '18', '17193 (Git) (stable.1)']

# It would be 0.18.2
['0', '18', '18553 (Git) (stable.2)']

# etc.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
kkremitzki
Posts: 2159
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Patching to display 0.18.1 & the topic of git commits/patch versions

Postby kkremitzki » Wed Apr 17, 2019 1:03 am

I think the git commit info should be retained where possible, but 1) it isn't always possible to get that info programatically, 2) commit numbers are not unique between branches, and 3) it's really annoying to have a 5 digit number for a patch version where a 1 digit number would do.
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.
eszlari
Posts: 6
Joined: Mon Mar 25, 2019 9:46 pm

Re: Patching to display 0.18.1 & the topic of git commits/patch versions

Postby eszlari » Wed Apr 17, 2019 5:33 pm

I would be for completely getting ride of the revision number and using cmake's build-in VERSION feature:

Code: Select all

project(FreeCAD VERSION 0.18.2)
https://cmake.org/cmake/help/latest/com ... oject.html
User avatar
kkremitzki
Posts: 2159
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Patching to display 0.18.1 & the topic of git commits/patch versions

Postby kkremitzki » Wed Apr 17, 2019 5:48 pm

That looks like a good option but we still need to accommodate daily builds somehow, and it would be nice to know what code the dailies were built on, so it would seem we would need either the git commit number or hash. It might be enough to include the date the package was built into its version number, but that would require a change in our support procedure, requiring users to supply the info from dpkg -l freecad in addition to the stuff from Help > About FreeCAD.
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.
triplus
Posts: 9475
Joined: Mon Dec 12, 2011 4:45 pm

Re: Patching to display 0.18.1 & the topic of git commits/patch versions

Postby triplus » Wed May 08, 2019 10:37 am

Best if we don't result to non standard behavior for now and lets try to address this when entering 1.0 era. As once that happens, existing code relying on the second number, to be for example > 18, will need to get adjusted anway. Adjusting the code now, just for Debian/Ubuntu packages, that is not optimal solution at all in my opinion.