Snapcraft 4.0
The team behind Snapcraft is pleased to announce the release of
Snapcraft 4.0. Among the many updates, fixes and additions it
includes, the following are what we consider its highlights:
- the
core20
base is now supported --use-lxd
can now be used with all snap supported architectures- improved plugins for
core20
- support for adding external repositories
To try this release, switch to the candidate channel for Snapcraft.
Plugins V2
New plugin infrastructure has been developed to support core20
.
This new infrastructure greatly simplifies plugins and delivers another great advantage: “quick rebuilds".
Thanks to core20
plugins being much simpler, so to is the environment
setup process, removing most of the perceived magic during Snapcraft
builds for parts.
Plugins are now applicable only to Snapcraft’s build step. The pull
step, for instance, has become completely owned by Snapcraft and
dedicated to managing the source
related entries for parts.
The following plugins have been updated to work with core20
:
While the list of plugins is not as broad as for core
or core18
,
they offer a strong foundation for the majority of snaps, and the list
will grow after this initial release.
The command line related to plugins has gained some additional parameters to specifically reach base relevant information:
snapcraft help <plugin-name> [--base <base>]
- ~snapcraft list-plugins [–base ]
These commands will default to using the base
defined in the current
Snapcraft project or to the latest supported base (i.e., core20
).
Also, plugins now have their properties scoped (i.e.; prefixed with the plugin-name).
autotools
The autotools plugin for core20
works mostly in the same way, with
the following exceptions:
- the plugin checks for the existence of
configure
in the source. If not found,autoconf --install
is executed instead configflags
has been renamed toautotools~configure-parameters
install-via
has been removed
cmake
This plugin works mostly the same, except for the fact that
configflags
has been renamed to cmake-parameters
.
dump
This behaves in the same way for core20
as for core18
or core
.
go
The plugin has been revamped for core20
. It now only supports projects
using go.mod
, which means it only supports version of go
that
support this.
The following are the only configuration parameters available to the plugin
when using core20
:
go-channel
go-buildtags
These options are no longer available when using core20
:
go-importpath
go-packages
make
The following parameters will be accepted by the plugin when setting
core20
as the base:
make-parameters
The following are no longer accepted but should instead be easily managed
with override-build
:
makefile
artifacts
make-install-var
meson
This plugin works the same in core20
although it has been enhanced
for easier rebuilds.
nil
This plugin behaves in the same way for core20
as for core18
or core
.
npm
This is a new plugin for core20
. It is intended to replace
the nodejs
plugin, which is only available for core
and core18
.
The only parameter the plugin now accepts is npm-node-version
.
python
The python plugin has been simplified the most for core20
and yet
provides the most new functionality. It essentially behaves like a
virtual environment, preferring the python interpreter shipped in
the core20
base.
By behaving this way, the plugin operates more like how a Python developer would expect, allowing for easier snap customization whilst still using the plugin.
The plugin can use an interpreter if it is added through a
comprehensive list of stage-packages
(an extension shall be
evaluated in the future to provide alternative complete python
stacks).
When used with core20
, the plugin accepts the following parameters,
with the same semantics as the V1 plugin used in core
and core18
:
python-packages
requirements
python-packages
rust
This is another plugin that has been simplified to reduce the number
of parameters when targeting core20
as a base:
rust-features
same behaviour as forcore
andcore18
rust-path
, defaulting to the current working directory, but can be set to the relative path of the crate to build when using workspaces
Package Management
This feature adds high-level package-management to snapcraft.yaml, enabling users to configure additional repositories & components.
Specifically, the scope of package-management is for anything affecting the behavior and availability of:
- build-packages
- stage-packages
- build-snaps
- stage-snaps
- python-packages
The scope of this spec will focus on the configuration of apt
repositories,
affecting the availability of build-packages
and stage-packages
.
To use, simply configure package-repositories
in snapcraft.yaml.
Note: snapcraft will log an ‘experimental feature’ warning until the schema is considered stable.
Here are some example configurations:
name: apt-example
base: core18
<snip>
package-repositories:
- type: apt
ppa: snappy-dev/snapcraft-daily
- type: apt
deb-types: [deb, deb-src]
components: [main]
suites: [$SNAPCRAFT_APT_RELEASE]
key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
- type: apt
deb-types: [deb, deb-src]
name: default
components: [main, multiverse, restricted, universe]
suites: [$SNAPCRAFT_APT_RELEASE, $SNAPCRAFT_APT_RELEASE-updates]
key-id: test-key
url: http://archive.ubuntu.com/ubuntu
Build Environments
The --use-lxd
flag has been released from its experimental phase and
now supports the same build roots as build.snapcraft.io (or Launchpad),
bringing the two environments closer together. With these new images,
there is now support for all the snap enabled architectures too.
Progressive Releases
Initial experimental support for progressive releases has landed in
Snapcraft. To view any existing progressive release use the status
command, as an example:
$ snapcraft status candycane
Track Arch Channel Version Revision Progress
latest all stable - - -
candidate - - -
beta 0.6 8 → 20%
10 13 → 80%
edge ↑ ↑ -
To perform a progressive release, use the release
command with the
with the --progressive
option. After releasing, the status of the
release will be shown.