When building a snap and constructing a part, package dependencies are listed as either package names or snaps for the snap’s build environment. This is covered in Build and staging dependencies.
For a default Snapcraft installation running Multipass, the build environment is invariably Ubuntu 20.04 LTS (Focal Fossa) or Ubuntu 18.04 LTS (Bionic Beaver). Consequently, dependencies are listed using their apt package names and are retrieved from the set of repositories officially supported by the distribution.
However, it’s also possible to add your own apt repositories as sources for build-packages
and stage-packages
, including those hosted on a PPA, the Personal Package Archive, which serves personally hosted non-standard packages.
This feature is currently considered experimental and its implementation may change.
Package repositories are currently considered an experimental feature and require Snapcraft 4.4+ . To enable this feature, add the following flag to the snapcraft command:
--enable-experimental-package-repositories
Third-party apt repositories can be added to a snap’s snapcraft.yaml by using the top-level package-repositories
keyword with either a PPA-type repository, or a deb-type repository:
package-repositories:
- type: apt
ppa: snappy-dev/snapcraft-daily
package-repositories:
- type: apt
components: [main]
suites: [xenial]
key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
As shown above, PPA-type repositories and traditional deb-type each require a different set of properties:
Once configured, packages provided by these repositories will become available via stage-packages
and build-packages
.
The properties for both PPA-type and deb-type repositories are outlined below.
The following properties are supported for PPA-type repositories:
apt
type: apt
<ppa-owner>/<ppa-name>
ppa: snappy-devs/snapcraft-daily
ppa: mozillateam/firefox-next
The following properties are supported for Deb-type repositories:
main
, multiverse
, unstable
.deb
and/or deb-src
).bionic
, focal
.apt
is currently supported.architectures: [i386]
architectures: [i386, amd64]
main
, multiverse
, unstable
components: [main]
components: [main, multiverse, universe, restricted]
deb
, i.e. [deb]
formats: [deb]
formats: [deb, deb-src]
<project>/snap/keys/<key-id[0:8]>.asc
. To determine a key-id from a given key file with gpg, type the following: gpg --import-options show-only --import <file>
-
, and underscores _
permitted.key-id: 590CA3D8E4826565BE3200526A634116E00F4C82
Snapcraft will install a corresponding key at <project>/snap/keys/590CA3D8.key
<key-id>
fromgpg --keyserver
key-server: keyserver.ubuntu.com
key-server: hkp://keyserver.ubuntu.com:80
url
). Cannot be used with suites
and components
/
path: /
path: /my-repo
path
suites: [xenial]
suites: [xenial, xenial-updates]
apt
type: apt
url: http://archive.canonical.com/ubuntu
url: https://apt-repo.com/stuff
package-repositories:
- type: apt
ppa: snappy-dev/snapcraft-daily
package-repositories:
- type: apt
components: [main]
suites: [xenial]
key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
package-repositories:
- type: apt
formats: [deb, deb-src]
components: [main]
suites: [xenial]
key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
package-repositories:
- type: apt
key-id: AE09FE4BBD223A84B2CCFCE3F60F4B3D7FA2AF80
url: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64`
package-repositories:
- type: apt
formats: [deb]
path: /
key-id: AE09FE4BBD223A84B2CCFCE3F60F4B3D7FA2AF80
url: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64`
Last updated 3 months ago. Help improve this document in the forum.