---
title: The smart dump plugin
description: As you probably already know, snapcraft supports a range of plugins,
  designed to aid developers in making their snaps in an easier, faster, more transparent
  fashion. Plugins work with different programming languages and build tools, like
  Python, Java, Rust, Cmake, and others. By making complex things simpler, they can
  accelerate your proj […]
url: https://canonical.com/blog/the-smart-dump-plugin?format=md
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Igor Ljubuncic](https://canonical.com/blog/author/igorljubuncic "More about Igor Ljubuncic")

4 October 2019

# The smart dump plugin

[dump](https://canonical.com/blog/tag/dump)
[plugins](https://canonical.com/blog/tag/plugins)
[sc:snap:snapcraft](https://canonical.com/blog/tag/scsnapsnapcraft)
[snapcraft](https://canonical.com/blog/tag/snapcraft)
[snapcraft.io](https://canonical.com/blog/tag/snapcraft-io)

---

Share the article

As you probably already know, snapcraft supports a [range of plugins](https://snapcraft.io/docs/snapcraft-plugins), designed to aid developers in making their snaps in an easier, faster, more transparent fashion. Plugins work with different programming languages and build tools, like Python, Java, Rust, Cmake, and others. By making complex things simpler, they can accelerate your projects.

One of the available plugins is the *dump* plugin, which “just dumps” contents from a specified source into your snap. Sounds quite simple, but this plugin can be extremely useful when you want to quickly package and test your application. Let’s see.

# The dump plugin supports numerous formats

A typical use case where the dump plugin brings value is for developers who already have created and packaged code in the past. For instance, if you have already built your application as a Debian package, you may be dismayed by the notion of having to start all over again when building snaps. But this does not have to be so.

You can specify existing files available for different distributions as the source in the plugin declaration in the snapcraft.yaml file, and the contents will be automatically unpacked for the particular part. You may want to do this if you require a particular library that is *not available* in the distribution repository archives, or you need an old library that is *no longer supported* – a practical requirement for legacy applications.

Moreover, you may have a standalone application that bundles all its dependencies inside a single archive, and you just want to see whether it will work when packaged as a snap. Here, the dump plugin can be quite useful, as it lets you create and test a snap within minutes. It’s not only Debian packages, though. The dump plugin works with a range of sources, including rpms as well as zip and tar archives!

# Practical example

A good test case would be the old WYSIWYG HTML/CSS editor called KompoZer. Active development of this application has ceased in around 2008, and it was available in Ubuntu archives until Pangolin (Ubuntu 12.04). Users who want to install this tool still will have to manually satisfy multiple dependencies and then install several Debian packages from Launchpad. These packages could conflict with the libraries on their systems.

The alternative is to package KompoZer as a snap. Without going into full details on how to package KompoZer, the dump plugin lets us quickly grab and extract the archives. In the snapcraft.yaml:

* Define a part (e.g. kompozer-data).
* Specify source for this particular part.
* Specify any stage packages that this part will require – the runtime libraries that the application depends upon (typically the long list of dependencies that you would have to manually satisfy).
* Provide any pull or build overrides – in some cases, applications may be built with hardcoded paths that would require breaking out of the snap confinement. You can manually modify these, as we will see in a moment.

Here’s a code sample:

```
parts:
 kompozer-main:
    plugin: dump
    source: https://launchpad.net/ubuntu/+archive/primary/+files/kompozer_0.8~b3.dfsg.1-0.1ubuntu2_amd64.deb
    stage-packages:
      - libatk1.0-0
      - libc6
      - libcairo2
      - libfontconfig1
…
  kompozer-data:
    plugin: dump
    source: https://launchpad.net/ubuntu/+archive/primary/+files/kompozer-data_0.8~b3.dfsg.1-0.1ubuntu2_all.deb
    override-pull: |
      snapcraftctl pull
      ln -sf ../../../../etc/kompozer/profile usr/share/kompozer/defaults/profile
      ln -sf ../../../../etc/kompozer/pref usr/share/kompozer/defaults/syspref
```

## What do we have here?

First, we have the *kompozer-main* part. We extract the contents with the dump plugin, and then list all the different stage packages. If the application depends on libraries that are not available in the distribution archives, you can specify them too as separate parts, and grab them using the dump plugin.

For the second part – *kompozer-data*, we have a slightly different declaration. Namely, originally, this package comes with two hardcoded symbolic links pointing to /etc, which is not possible with a strictly confined snap.

```
Failed to copy '/root/parts/kompozer-data/build/usr/share/kompozer/defaults/syspref': it's a symlink pointing outside the snap.
```

So we override the pull process and manually re-link these – the override declaration is just a list of shell commands.

```
    source: https://launchpad.net/ubuntu/+archive/primary/+files/kompozer-data_0.8~b3.dfsg.1-0.1ubuntu2_all.deb
    override-pull: |
      snapcraftctl pull
      ln -sf ../../../../etc/kompozer/profile usr/share/kompozer/defaults/profile
      ln -sf ../../../../etc/kompozer/pref usr/share/kompozer/defaults/syspref
```

There could be some trial and error during the snap build process, and if you need help with how to go through these more quickly, please consult our tutorial on [making development faster](https://snapcraft.io/blog/make-your-snap-development-faster) and then the follow-up guide with [additional tips and tricks](https://snapcraft.io/blog/faster-snap-development-additional-tips-and-tricks) on this topic.

# Architectures

Furthermore, you can also specify different sources to match the system architecture, like amd64 and i386, which means a single snap will work for users on these different platforms. This is quite handy, especially for legacy software.

```
    source:
      - on amd64: https://link/library_amd64.deb
      - on i386: https://link/library_i386.deb
```

# Conclusion

The dump plugin may look like a simple helper tool, but it gives developers quite a bit of flexibility in how they package and test their software. If you already have compiled code, you can use it for quick & dirty tests, to assess compatibility, to retrieve libraries and legacy components that are not available in standard software channels, or even build custom applications that may contain data samples, tutorials or similar.

As always, we value feedback and comments, so we can make snapcraft even more extensible and useful to developers. If you’d like to share your ideas or suggestions, please join [our forum](https://forum.snapcraft.io/) for a discussion.

Photo by [Christopher Burns](https://unsplash.com/@christopher__burns?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/factory?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText).

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

By submitting this form, I confirm that I have read and agree to [Canonical's Privacy Policy](https://canonical.com/legal/dataprivacy).

Sign up

## Share on

---

## Related posts

[### Snapcraft 8.0 and the respectable end of core18](https://canonical.com/blog/snapcraft-8-0-and-the-respectable-end-of-core18)

‘E’s not pinin’! ‘E’s passed on! This base is no more! He has ceased to be! ‘E’s expired and gone to meet ‘is maker! ‘E’s a stiff! Bereft of life, ‘e rests in peace! If you...

[Igor Ljubuncic](https://canonical.com/blog/author/igorljubuncic)

16 June 2023

[### TurtleBot3 OpenCR firmware update from a snap](https://canonical.com/blog/turtlebot3-opencr-firmware-update-from-a-snap)

The TurtleBot3 robot is a standard platform robot in the ROS community, and it’s a reference that Canonical knows well, since we’ve used it in our tutorials. As a matter of...

[gbeuzeboc](https://canonical.com/blog/author/gbeuzeboc)

25 September 2024

[### Creating Snaps on Ubuntu Touch](https://canonical.com/blog/creating-snaps-on-ubuntu-touch)

This article was written in collaboration with Alfred E. Neumayer of the UBports Project. Tablets, phones and current technology’s capabilities are phenomenal. Who would have...

[Aaron Prisk](https://canonical.com/blog/author/aaronprisk)

3 April 2024

[### Managing software in complex network environments: the Snap Store Proxy](https://canonical.com/blog/managing-software-snap-store-proxy)

As enterprises grapple with the evolving landscape of security threats, the need to safeguard internal networks from the broader internet is increasingly important. In...

[Holly Hall](https://canonical.com/blog/author/hollyhall)

15 January 2024
