Swiftpack.co - Package - snapcore/snapcraft

Build Status Coverage Status

Snapcraft

Snapcraft is a delightful packaging tool

Snapcraft helps you assemble a whole project in a single tree out of many pieces. It can drive a very wide range of build and packaging systems, so that you can simply list all the upstream projects you want and have them built and installed together as a single tree.

For example, say you want to make a product that includes PyPI packages, Node.js packages from NPM, Java, and a bunch of daemons written in C and C++ that are built with autotools, snapcraft would make assembling the final tree very easy.

Snapcraft allows easy crafting of snap packages for the snappy Ubuntu Core transactional update system.

More Information

  • Introduction to all the details about the concepts behind snapcraft.
  • Hacking guide to contribute if you're interested in developing Snapcraft.
  • Launchpad to submit bugs or issues.

Get in touch

We're friendly! Talk to us on IRC or on our forums.

Get news and stay up to date on Twitter, Google+ or Facebook.

Github

link
Stars: 489
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

2.37 - Dec 22, 2017

Hello snapcrafters! The snapcraft team is pleased to announce that version 2.37 has been released.

Contributions

This release saw some excellent contributions from outside the snapcraft core team, and we want to give a shout out to those folks. A team thank you to:

The last three contributors have done so as part of Google's CodeIn initiative.

New in this release

CLI

help command

As a user experience improvement, the snapcraft help command now produces the same output as when running snapcraft --help. Viewing help information related to plugins and other topics previously supported by snapcraft help is still supported.

export-login command

Until now, the only support Snapcraft had baked in for CI systems was the enable-ci command, which only supported Travis, and only supported pushing a given snap to edge. This release sees the addition of a new export-login command that exports a login with the exact capabilities requested, which opens the door to many more possibilities in CI. Want to create a login that can only push a specific snap to edge? No problem. Want to create a login that can only migrate a specific snap from edge to beta? No problem. Here's how it works:

asciicast

Error messages

Another improvement that was developed together with the design team is that now most (if not all) errors have a very well defined semantic explaining first what went wrong followed by a suggestion on how to fix it.

Store

The API to synchronize changes made to the metadata in the snap related to the presentation layer of the store has been extended to support binary assets. So far, icons are the only entry supported. Once a definition is made on other potential assets such as screenshots are made, support for them will be added as well.

To synchronize the data to the store, you need to run the command that was introduced in version 2.34 of snapcraft:

snapcraft push-metadata

Plugins

catkin-tools

This release sees the addition of the catkin-tools plugin. This plugin works similarly to the Catkin plugin, but instead of using Catkin, uses the newer (and faster) Catkin Tools. Catkin Tools is still under beta, as is this plugin, but please give it some mileage!

Final notes

To get the source for this release, check it out on github.

A great place to collaborate and discuss features, bugs and ideas on snapcraft are the forums. Please also feel free to file a bug.

Happy snapcrafting! -- Sergio and the team

2.38 - Dec 22, 2017

Hello snapcrafters! The snapcraft team is pleased to announce that version 2.38 has been released.

Contributions

This release saw some excellent contributions from outside the snapcraft core team, and we want to give a shout out to those folks. A team thank you to:

The last three contributors have done so as part of Google's CodeIn initiative.

New in this release

Core

Improved support for classic snaps

snapcraft now has a better architecture overall to handle classic snaps, not only for those coming from parts that are built, but also for the case where prebuilt binaries are dumped into the snap. Prior to this version of snapcraft, true isolation for a dynamically linked executable from the host was not possible.

The work here makes sure that the correct interpreter is set and also sets up valid rpaths for the binary. Determining these rpaths is done by crawling the prime directory and the selected base (currently only what today is known as the core snap). For the base, absolute rpaths are set, while paths found inside the primed directory make use of $ORIGIN.

Sunsetting host crawling

A feature which was useful at the time of its introduction in the past, where libraries from the host are fetched to satisfy a dependency for a binary that was primed, is going to be removed in a future release of snapcraft given that it was deemed confusing and counter intuitive. A warning will be shown to users when this feature comes into action and how to solve it and move forward.

Advanced grammar for strings

Snapcraft has long-supported a more advanced grammar when it came to build- and stage-packages that allowed one to select a different set of packages depending on build architecture. This release sees the addition of the grammar to the source keyword, allowing one to specify a different source depending on build architecture. Here's a quick demo:

asciicast

Information extraction: Appstream support

This release sees the addition of the capability to extract appstream metadata (currently only summary and description) from individual parts, and use that data to help fill in the snapcraft.yaml. Here's a quick demo of that in action:

asciicast

Final notes

To get the source for this release, check it out on github.

A great place to collaborate and discuss features, bugs and ideas on snapcraft are the forums. Please also feel free to file a bug.

Happy snapcrafting! -- Sergio and the team

2.36 - Nov 29, 2017

Hello snapcrafters,

The team is pleased to announce release 2.36 of snapcraft

Contributions

This release saw some excellent contributions from outside the snapcraft core team, and we want to give a shout out to those folks. A team thank you to:

New in this release

Core

snapcraft.yaml

It was discovered that the snap of Snapcraft v2.35 (currently in stable) doesn't work on i386 due to an inability to find libsodium. That's fixed in this release; you should be able to use Snapcraft v2.36 on i386 with no issues.

Plugins

catkin

Prior to this release, in order to use the Catkin plugin, one needed to specify each package in the workspace that was to be built and installed into the snap. We received feedback that this was, of course, annoying for large workspaces, especially because the entire workspace was typically desired anyway. A new feature has been added to this release, where if you simply don't specify the catkin-packages property, the Catkin plugin will assume you want to build the entire workspace.

ament

ROS1 has been supported pretty much from the beginning via the Catkin plugin, but this release sees the addition of an Ament plugin for supporting ROS2 (which has reached beta3). It fetches the ROS2 underlay and bootstraps it before building the overlay, so it does take a while. Give it some exercise! Here's an example of building a simple talker/listener workspace:

asciicast

Final notes

To get the source for this release, check it out on github.

A great place to collaborate and discuss features, bugs and ideas on snapcraft is the forum. Please also feel free to file a bug.

Happy snapcrafting! -- Sergio and the team

Plugins

2.35 - Nov 16, 2017

Hello snapcrafters! The snapcraft team is pleased to announce that version 2.35 has been released.

Contributions

This release saw some excellent contributions from outside the snapcraft core team, and we want to give a shout out to those folks. A team thank you to:

New in this release

Core

Containers

Each build instance created now correctly works out isolated temporary folder locations for those users running many builds in parallel. There is also better detection of existing or missing lxd installations so first time users can better understand any problems with the host they are currently trying to use.

When running snapcraft from the snap, snapcraft now injects itself into the actual snap instead of apt installing the deb (for the case of today of only supporting one base), providing parity with the local environment at hand.

Work has been added to get rid of all the corner cases and provide useful feedback to users and making the experience feel more native. Additionally, support has been added for using remote lxd instances.

To enable the persistent build containers feature the SNAPCRAFT_CONTAINER_BUILDS environment variable needs to be set.

Here's an example of using a remote lxd instance:

asciicast

Recording

On this new version we added more information to the build manifest, like the contents of lock files, the debs and snaps installed in the machine, information from uname and the fingerprint of the container used for the build. To record the build manifest, set the environment variable SNAPCRAFT_BUILD_INFO. The manifest will be saved and distributed inside the snap. After the build, you can inspect it in the prime/snap/manifest.yaml.

asciicast

Command Line Interface

new command: pack

This new pack command replaces the now deprecated use of snap <snap-dir> with the goal of decoupling the concept of working on an actual snapcraft project and packing up a directory layout into a snap.

new command: refresh

This command is only available when persistent build containers are enabled and exists to make the environment feel as native as possible. Prior to the existence of this command, building continuously in a container triggered a refresh of the packaging archive every time, now this refresh only takes place on container creation or when called through snapcraft refresh.

new command: edit-collaborators

This command will eventually replace the use of the store invites mechanism to setup other people as collaborators to the project. It is currently hidden as the production snap store has it currently disabled. A future release once things have stabilized will expose the command to users. It is harmless to use today as a proper error will show up.

In the meantime, here is how it works when using the integration store: asciicast

OS Support

Solus

Initial support for running the snapcraft snap on solus has been added. It should work well enough for things like performing store operations, packing up snaps; or if lxd is installed and setup, most operations should work through use of persistent build containers or cleanbuild.

We look forward to knowing how this initial experience performs.

Ubuntu 14.04

Snapcraft currently only really runs well on Ubuntu 16.04, but we're working on adding support for other releases and Linux distributions. This is the first release where you can use the Snapcraft snap on Ubuntu 14.04 (Trusty). This is particularly important for snaps based on ROS (Robot Operating System) Indigo, which targets Trusty. Here's a demo of just that:

asciicast

Plugins

dotnet

This plugin developed by Rajesh, a .NET developer at Microsoft, allows you to create .NET 2.x based snaps, currently embedding the runtime with plans to enhance it to understand content snaps of .NET runtimes which could be leveraged by projects.

The syntax is pretty straightforward and builds on language understood by upstream so getting started for a current .NET developer should feel like a pleasant journey.

Here is the plugin in action: asciicast

ruby

This release sees the addition of a Ruby plugin, written by James Beedy. It supports a number of different Ruby versions by building them from source, which takes a little while but makes it pretty versatile. It could definitely use some exercise! Here's an example of building a snap of the Travis gem:

asciicast

catkin

The Catkin plugin has long supported rosdep to resolve and fetch system dependencies (i.e. Debian packages). However, rosdep also supports resolving pip dependencies. This release adds support for those, so they don't need to specified elsewhere in the snapcraft.yaml.

Final notes

To get the source for this release, check it out on github.

A great place to collaborate and discuss features, bugs and ideas on snapcraft are the forums. Please also feel free to file a bug.

Happy snapcrafting! -- Sergio and the team

2.34 - Sep 19, 2017

Hello snapcrafters!

We are pleased to announce the release of snapcraft 2.34:

  • Available on all supported Ubuntu releases (Ubuntu 16.04 LTS and 17.04), and the development release (Artful Aardvark).
  • A windows MSI preview installer for snapcraft on Windows.
  • brew installabled on OS X by running brew install snapcraft (store interaction and cleanbuild are supported).
  • pip installable from PyPI (with caveats when setting up apt bindings) by running pip install snapcraft.
  • View the full list of merged PRs.
  • Specific bug fixes can be seen on the Launchpad milestone.

Contributions

This release saw some excellent contributions from outside the snapcraft core team, and we want to give a shout out to those folks. A team thank you to:

New in this release

Core

types

A new snap type was added: base, this opens the door to start producing base snaps.

Containers

Each build instance created now correctly works out isolated temporary folder locations for those users running many builds in parallel. There is also better detection of existing or missing lxd installations so first time users can better understand any problems with the host they are currently trying to use.

When running snapcraft from the snap, snapcraft now injects itself into the actual snap instead of apt installing the deb (for the case of today of only supporting one base), providing parity with the local environment at hand.

Additionally, when cleaning projects making use of persistent project containers, snapcraft destroys the container that was assigned for this work as well.

To enable the persistent build containers feature the SNAPCRAFT_CONTAINER_BUILDS environment variable needs to be set.

build-snaps

They work in a similar fashion to build-packages, build-snaps takes leverage of snaps in the store to create your snaps. This release exposes the feature through

build-packages

While build-packages have been around for a while, it is only now that they have gained the support for advanced grammar, just as what is provided for stage-packages. Support for grammar-powered build-packages, both at the part-level and global are here to stay.

source caching

Logic has been added to cache source entries that provide a source-checksum entry for parts, this would behave like:

Cleanup

Release detection

Snapcraft used the deprecated linux_distribution method from the platform module, it now correctly handles the host it is running on through parsing of /etc/os-release.

Tour removal

The tour has been sunset in favour of the tutorial which can be currently found here.

Errors

Many new exceptions have been created to handle the many potential errors that can occur when running snapcraft. In addition to that, proper snapcraft generated and understood errors will produce a nice user friendly error message while situations that were not thought of in the code base will provide proper tracebacks. This will provide a faster turnaround time for fixes and a more apparent situation of wrongness to the users of snapcraft. The errors codes for these two situations are also different, being1for the former and2` for the latter.

Plugins

nodejs

Catching up to yarn's latest developments, the snapcraft plugin now supports the latest release of yarn.

This plugin has also gained recording capabilities by means of running snapcraft with the environment variable SNAPCRAFT_BUILD_INFO set.

jhbuild

This is a new plugin which uses jhbuild to build mostly gnome projects

python

The python plugin now records the assets it used to build, to get a glimpse of this feature you need to run snapcraft with the environment variable SNAPCRAFT_BUILD_INFO set.

catkin

Support for multiple dependency types was added. The catkin plugin now supports a new API which raises an exception if the dependency type is anything other than apt. This is paving the way for support of pip dependencies coming from rosdep.

The plugin now properly defaults to creating a release build, to enable a debug build, edit the part as follows:

kbuild

This plugin has gained the crosscompiling logic that existed for the kernel plugin, unifying the code bases more with the side effect of having cross compilation support for kbuild

Support for Makefiles without install targets is now also of declarative nature, to set it as such here is an example:

ant & gradle

Support for authenticated proxies has been added, this should be transparent to the snapcraft author through means of consumption of the already existing environment variables for proxy management (http_proxy, https_proxy, ...).

Here's an example recording:

Final notes

To get the source for this release, check it out on github.

A great place to collaborate and discuss features, bugs and ideas on snapcraft are the forums. Please also feel free to file a bug.

Happy snapcrafting! -- Sergio and the team