[Proposal] debian/ubuntu packages of community modules

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

[Proposal] debian/ubuntu packages of community modules

Postby NormandC » Thu Apr 23, 2015 3:32 am

Hey guys,

A user on the French forum teaches FreeCAD to his students, and all the PCs are running Ubuntu. He asked me today to include hamish's Assembly2 module in the Daily Builds PPA. I replied that I could not do that for the following reasons:
  • Assembly2 is not part of the FreeCAD project, and as such is not supported
  • FreeCAD installs over all platforms should be exactly the same on Windows, MacOS X or Linux. The different OCC versions we had for 0.14 binaries was a major headache for those of us who support users.
  • Licensing issue: Assembly2 is GPLv3.
I know that there is a current project to facilitate install of plugins (Plugin Loader), but the project was just started by microelly2.

What's great about the Launchpad infrastructure is:
  • We can create as many PPA repos as we want
  • We can import Git branches from anywhere and they will synchronize every 6 hours or upon request
  • Build recipes allow us to automate package building (that's what we use on the Daily Builds)
Also, a debian package sets dependencies, therefore a packaged module will automatically install the requisite libraries, making it a lot simpler for the end user.

After some thought (and I was also inspired by issue #857), I believe this could be a useful project, to facilitate installation and maintenance of community modules. I also see this as a way to make the Ubuntu platform even more attractive (a secondary goal of mine ;) ).

Here's what I propose: create a new PPA dedicated to packaging community modules. I'm not sure if it should be managed by the
FreeCAD Maintainers Team, or be managed by a new team more open to the community (by choice, membership to FreeCAD Maintainers is restricted).

I did a test tonight, I was able to create a .deb package of the Assembly2 workbench.

You can download it here : (2015-04-23) link deleted, please see this post for the last version: viewtopic.php?f=8&t=10658&p=85940#p85940
This package is compatible with any Ubuntu version, and is surely compatible with Debian and Debian/Ubuntu-based distros (after all it's mostly a bunch of python scripts and svg files). There's a hard dependency to freecad >= 0.15.4671 which currently makes it incompatible with the Daily Builds... The next update should fix it.

The current problems with my package: it basically just writes the files in /usr/lib/freecad/Mod/. I quickly tested it and it seems to work, but with the Daily Builds, will the files be deleted when the freecad package next updates? Secondly, copying the files into the freecad directory may cause a license conflict.

Could the module files be written to a separate directory (/usr/lib/freecad-plugins/?) without having to change anything in the source code?

The external modules I'm thinking could be packaged would first be:
  • Assembly2 (in progress)
  • Drawing Dimensioning (add dimensions to views in the Drawing workbench) (in progress)
  • BOLTS (parts library)
  • FCGear
  • Cura Engine Plugin
  • EaglePCB importer
  • Animation toolkit
  • full list in Additional modules and related projects (wiki)
So, what do you guys think?

If we go ahead, this time I would like to get help with packaging. :geek:
Last edited by NormandC on Tue Apr 28, 2015 1:32 am, edited 2 times in total.
Reason: added more modules and link to Download#Additional_modules
wmayer
Site Admin
Posts: 15001
Joined: Thu Feb 19, 2009 10:32 am

Re: [Proposal] debian/ubuntu packages of community modules

Postby wmayer » Thu Apr 23, 2015 12:55 pm

The current problems with my package: it basically just writes the files in /usr/lib/freecad/Mod/. I quickly tested it and it seems to work, but with the Daily Builds, will the files be deleted when the freecad package next updates?
On Ubuntu I am still using Synaptic as my default package manager and there you can easily see which files are being installed with a package. So, by default when a package is uninstalled it only removes the files listed there. Btw, FreeCAD also installs a few files in directories other than /usr/lib/freecad and they aren't deleted either. However, with Debian packages it's also possible to run a "prerm" script which gets executed before the removal and there you may delete a few things more but for FreeCAD we don't use this option.
Secondly, copying the files into the freecad directory may cause a license conflict.
IANAL but I don't think that there is a license conflict because FreeCAD is not a "derived work" from the Assembly2 workbench. And in case I am wrong then the conflict is definitely not caused by where you install the files.
Could the module files be written to a separate directory (/usr/lib/freecad-plugins/?) without having to change anything in the source code?
Without changing source code this is not possible.
User avatar
PrzemoF
Posts: 2657
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: [Proposal] debian/ubuntu packages of community modules

Postby PrzemoF » Thu Apr 23, 2015 1:25 pm

NormandC wrote:[..]
Could the module files be written to a separate directory (/usr/lib/freecad-plugins/?) without having to change anything in the source code?
[..]
What about adding an option to Preferences -> General. The option would be a path or even better a list of pathes where FreeCAD should look for external workbenches?
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Proposal] debian/ubuntu packages of community modules

Postby NormandC » Thu Apr 23, 2015 2:10 pm

wmayer wrote:
normandc wrote:Could the module files be written to a separate directory (/usr/lib/freecad-plugins/?) without having to change anything in the source code?
Without changing source code this is not possible.
Then maybe add a symlink by creating a /debian/freecad-assembly2.links file?

In the French forum topic, CkwA suggested usr/lib/freecad-extras instead of freecad-plugins.

Packages could be named freecad-extras-modulename... This makes it a little clearer it's not part of FreeCAD.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Proposal] debian/ubuntu packages of community modules

Postby NormandC » Thu Apr 23, 2015 2:13 pm

PrzemoF wrote:What about adding an option to Preferences -> General. The option would be a path or even better a list of pathes where FreeCAD should look for external workbenches?
This would be good too in the long run, for the moment I'm looking for a solution that does not require change in the source code of releases/FreeCAD-0-15.
wmayer
Site Admin
Posts: 15001
Joined: Thu Feb 19, 2009 10:32 am

Re: [Proposal] debian/ubuntu packages of community modules

Postby wmayer » Thu Apr 23, 2015 2:43 pm

What about adding an option to Preferences -> General. The option would be a path or even better a list of pathes where FreeCAD should look for external workbenches?
This can become problematic. If we allow too many paths then the risk raises that users put Python modules there that are written in C/C++ but link to a different Python version than FreeCAD. In this case the modules will be loaded into memory and then we have two Python runtime libs in the same process -- with undefined behaviour. And that's also the reason why we ignore the PYTHONPATH environment variable.
wmayer
Site Admin
Posts: 15001
Joined: Thu Feb 19, 2009 10:32 am

Re: [Proposal] debian/ubuntu packages of community modules

Postby wmayer » Thu Apr 23, 2015 8:22 pm

Here some pointers to the FSF:
http://www.gnu.org/licenses/gpl-faq.htm ... GPLPlugins
http://www.gnu.org/licenses/gpl-faq.html#IfLibraryIsGPL

Since FreeCAD is a mixture of LGPL and BSD licensed code and both are compatible to GPL there is no problem to use the Assembly2 workbench.
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: [Proposal] debian/ubuntu packages of community modules

Postby yorik » Thu Apr 23, 2015 8:52 pm

Indeed this is a very good idea... I don't think there is any problem with the license either. Even if FreeCAD was strictly LGPL2, and could therefore not be distributed depending on anything GPL3, the contrary, GPL3 stuff that depends on LGPL2, would still be allowed!

But since FreeCAD is LGPL2+, actually it is compatible with GPL3. But let's say this is a complex matter, with different opinions, better to stay on the safe side. In any case, having the GPL3 assembly2 pckage that depends on the LGPL2 freecad, and not the contrary, is totally okay.

I think installing to the Mod folder is the correct way. If you make the assembly2 package depend on freecad, then any attempt to uninstall freecad would give: "Warning: the following packages will also be REMOVED: assembly2" which is what we want... Seems perfect to me
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: [Proposal] debian/ubuntu packages of community modules

Postby NormandC » Thu Apr 23, 2015 9:04 pm

Thanks guys.

Regarding the path to the Mod directory, I just saw in the file list for the Ubuntu package that there is a path to /usr/share/freecad/Mod.
http://packages.ubuntu.com/vivid/amd64/freecad/filelist

I have to check if our own PPA packages have the same path (I'm not home right now), if true I think it's a more appropriate location for modules than /usr/lib/freecad/Mod.

I'm also thinking: would it be relevant to package the FreeCAD-Library repo, and possibly IFCOpenShell?
wmayer
Site Admin
Posts: 15001
Joined: Thu Feb 19, 2009 10:32 am

Re: [Proposal] debian/ubuntu packages of community modules

Postby wmayer » Thu Apr 23, 2015 9:50 pm

Regarding the path to the Mod directory, I just saw in the file list for the Ubuntu package that there is a path to /usr/share/freecad/Mod.
http://packages.ubuntu.com/vivid/amd64/freecad/filelist
The Debian maintainer has changed the data path of FreeCAD to be/usr/lib/freecad/data/Mod while in our PPA package it's /usr/share/freecad/Mod. So, it's probably a mistake to still have this empty directory.
I have to check if our own PPA packages have the same path (I'm not home right now), if true I think it's a more appropriate location for modules than /usr/lib/freecad/Mod.
No. The only proper root directory for modules is /usr/lib/freecad/Mod -- nothing else.