Stage snaps

This topic is a stub, feel free to complete/extend it.

Stage snaps is a mechanism to integrate content from other snaps to your snap, it works like stage-packages but instead dumping the content from the Debian-ish packages, stage-snaps dumps content from a specified snap.

Stage snaps, and Extensions are the two features that are to replace the “Remote parts” feature in the legacy 2.X Snapcraft.

Possible usage

Import a launcher without actually adding it to your source tree

Import an SDK(a.k.a. library) snap and build your part against it

Other things

Implementation example

It is normally recommended to define the stage snap in a separate part and assign a dependency to the consuming part by using the after clause, as you can control which files you want to import from the stage snap:

parts:
  provider-stage-snap:
    plugin: nil
    stage-snaps:
      - _provider_snap_name_
      - _provider_snap_name_/_track_name_/_risk_level_name
    stage:
      - needed/files

  consumer-part:
    after:
      - provider-stage-snap

Note

Stage snaps that also shipping their own stage-packages will likely cause file conflict due to shipping the same non-identical libraries with your consumer snap, use the stage key to filter conflicting files from the stage snap.

1 Like

It would be nice if the USN scanning tool that @jdstrand built also was aware of stage-snaps, such that in addition to sending notifications about USN’s affecting stage-packages for a snap, USNs affecting the stage-packages inside the stage-snaps (assuming they were also built with a manifest.yaml) for a snap also triggered an email.

1 Like