- Create a PR that updates the
snap/snapcraft.yaml
file (see #75 for example) and merge it to the stable branch Result: Once merged this will build a candidate release. - Test the 'candidate' release. If no issues present then...
- Login to https://snapcraft.io/freecad/releases and promote the candidate release to stable Result: Stable will now be the latest stable branch
This must be done once per year by someone with Maintainer access to this repo and the Snap Store login credentials. As of this writing, those people are @yorik, @luzpaz, and @chennes. On a Linux command line with snapcraft
installed, generate new credentials with:
snapcraft export-login <credentials-filename>
Copy the contents of this file to the clipboard and go to the FreeCAD-snap GitHub secrets page. Edit the STORE_LOGIN secret to be the contents of the generated key.
Edit snap/local/snap-setup-mod/Init.py, which is called on every start of FreeCAD.
E.g.
def configure_mod_raytracing():
import FreeCAD
param = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Raytracing")
if not param.GetString("PovrayExecutable", ""):
param.SetString("PovrayExecutable", "/snap/freecad/current/usr/bin/povray")
configure_mod_raytracing()
This automatically sets the PovrayExecutable
parameter to the correct path inside the snap.
Convention: One function per workbench, don't overwrite the user's settings.
The github action called 'Publish Daily' is an automated process that is triggered every evening to publish a new 'edge' build. It can also be triggered manually to build on-demand.
In the screenshot above clicking the 'Run workflow' button will open a dialog with 2 buttons:
The Branch:
button indicates what branch of FreeCAD-snap you'd like to trigger. Default is 'master'.
The green Run workflow
button actually triggers the build to start. Once this is clicked, the build takes whatever time it takes to build FreeCAD from source and then push the new build to the 'edge' channel. After that all the user has to do is snap refresh
and the latest 'edge' will auto-download to their machine
Running multiple snaps AKA 'Parallel Installs' (parallel but separate).
By default, snap packages that have several 'channels' will share configs between them. For testing purposes sometimes this isn't wanted, the solution per the snapcraft docs is using the parallel install feature.
Parallel installs enable you to run multiple instances of the same snap on the same system. Each instance is completely isolated from all other instances, including its name, configuration, interface connections, data locations, services, applications and aliases.
Note: at the time of writing this the parallel install feature is still considered experimental
In the context of FreeCAD, this feature would be useful for example if there are experimental changes (in an experimental build) to the FreeCAD config files that could corrupt the snap stable or snap edge channel FreeCAD config files.
Example: Install edge snap in parallel to the stable snap
# Enable experimental parallel instances feature
$ sudo snap set system experimental.parallel-instances=true
# Install freecad snap from channel edge as 'freecad_edge'
$ sudo snap install freecad_edge --channel=edge
# run FreeCAD from this parallel install
$ freecad_edge
It is possible to build snaps from any branch of fork of the FreeCAD repository. This option is also open to outside users that can simply make a PR to trigger and re-trigger a build.
- Fork the FreeCAD-snap repo.
- Create a new branch to work on.
- Open snap/snapcraft.yaml in a text editor
- Locate the
freecad
block of the yaml file - Modify the
source:
variable to reflect the specific fork of FreeCAD master to build. Note: must end with.git
extension. - Add a
source-branch:
variable to indicate what specific branch of said fork to build. In the example below is a before and after in which we're building a snap of user @WandererFan'shlrThreadrc1
branch from his FreeCAD clone (borrowed from actual example):freecad: plugin: cmake source: https://github.com/FreeCAD/FreeCAD.git
freecad: plugin: cmake source: https://github.com/WandererFan/FreeCAD.git source-branch: hlrThreadrc1
- Save the
snap/snapcraft.yaml
changes to the branch and make Pull Request to FreeCAD-snap. - Ask a maintainer to assign the 'safe to publish' green tag to the PR.
- Result: the snap should build and output 'Installation Instructions'.
- PR should be closed when said experimental snap builds aren't further necessary.
- Important note: each commit to the branch will need a manual retrigger in order to re-build the snap. See below:
As mentioned above, new commits to a branch will not retrigger the rebuilding of a snap. It needs to be done manually.
-
Open the same
snap/snapcraft.yaml
above -
Find the
environment:
block -
Add
BUILD_ME: 1
to the end of the block -
Push change to the open PR
-
Note: To retrigger, iterate
BUILD_ME:
.environment: LD_LIBRARY_PATH: $SNAP/usr/lib/ $SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/ $SNAPCRAFT_ARCH_TRIPLET/lapack # numpy LD_PRELOAD: $SNAP/usr/lib/ $SNAPCRAFT_ARCH_TRIPLET/libstubchown.so ... ... ... POVINI: $SNAP/etc/povray/3.7/povray.ini # Raytracing
environment: LD_LIBRARY_PATH: $SNAP/usr/lib/ $SNAPCRAFT_ARCH_TRIPLET/blas:$SNAP/usr/lib/ $SNAPCRAFT_ARCH_TRIPLET/lapack # numpy LD_PRELOAD: $SNAP/usr/lib/ $SNAPCRAFT_ARCH_TRIPLET/libstubchown.so ... ... ... POVINI: $SNAP/etc/povray/3.7/povray.ini # Raytracing BUILD_ME: 1
-
When task is complete and no more snap builds are needed, simply close the PR and delete the branch.
See example #44
Every so often it is necessary to update the KDE Frameworks. See #80.
This is related to the kde-neon
extension, read the official documentation (may be outdated) https://snapcraft.io/docs/kde-neon-extension.
Different package ecosystems name their dependencies differently. Questions:
- Where does Snap pull dependencies from ?
- How does one query to ascertain the correct name of the dependency ?
Answers:
- Dependencies are listed using their apt package names and are retrieved from the set of repositories officially supported by the distribution (make sure you pulling an apt package for the correct distro version that the snap packaging is utilizing).
- https://packages.ubuntu.com (it may be beneficial to cross-reference https://repology.org)