The dump plugin makes all files from a specified source available to a part. By default, it’s equivalent to running the following command in a source’s directory:
cp --archive --link --no-dereference . "${CRAFT_PART_INSTALL}"
The source
and other source-*
properties are key to this plugin. They specify the location from where to retrieve the files, or if the source is a git repository, which branch, tag, or commit to clone.
For an artificial example:
parts:
my-part:
source: local-source/
plugin: dump
organize:
'*.png' : images/
launch.wrapper: usr/bin/launcher
prime:
- -README*
remote-part:
plugin: dump
source: https://remote-resource.org/cool-package.deb
source-type: deb
Combining the dump plugin with the part keys allows extending the behavior to create new files, modify existing files, or filter files for the final package. For example, you could use override-build
to convert file formats.
The plugin can also be used with the organize
key to reorganize the files in the final payload. For example, you could use it to keep libraries but exclude binaries and headers from SDKs.
If you aren’t using the source files directly in the package, but want to run some custom commands to generate them, then you should instead use the nil plugin so no files are copied unnecessarily.
Further reading
For more examples of the dump plugin, search GitHub for snaps that use it.