Part properties

after

Type: array of unique strings with at least 1 item

Step: build

Specifies a list of parts that a given part will be built after.

build-attributes

Type: array of unique strings with at least 1 item from “core22-step-dependencies”, “enable-patchelf”, “no-patchelf”, “no-install”, “debug”, “keep-execstack”.

Step: build

The customisations to apply to the build.

build-environment

Type: build-environment-grammar

Step: build

The environment variables to be defined in the build environment specified as a list of key-value pairs.

Example:

build-environment:
  - MESSAGE: "Hello world"
  - NAME: "Craft Parts"

build-packages

Type: grammar-array

Step: build

The system packages to be installed in the build environment before the build is performed. These are installed using the host’s native package manager, such as apt or dnf, and they provide libraries and executables that the part needs during the build process.

build-snaps

Type: grammar-array

Step: build

The snaps to be installed in the build environment before the build is performed. These provide libraries and executables that the part needs during the build process. They take the form of <snap>/<version>/<channel>, <snap>/<channel> or just <snap>. For example, the node snap could be specified as node/18/stable, node/latest/stable or node/stable to select different versions.

organize

Type: ordered dictionary mapping strings to strings

Step: stage

Describes how files in the building area should be represented in the staging area.

In the following example, the hello.py file in the build area is copied to the bin directory in the staging area and renamed to hello:

organize:
  hello.py: bin/hello

If partitions are in use by the application, they may be referenced by prepending the partition name, surrounded by parentheses, to the destination path. Only the destination path may specify a partition; source paths always reference the default partition. Omitting the partition name in the destination path causes the file to be copied to the default partition.

The following example is exactly equivalent to the above example:

organize:
  hello.py: (default)/bin/hello

In this example, the file is instead copied to the application-defined boot partition:

organize:
  vmlinuz-6.2.0-39-generic: (boot)/vmlinuz

override-build

Type: string

Step: pull

A string containing commands to be run in a shell instead of performing those defined by the plugin for the build step.

override-prime

Type: string

Step: pull

A string containing commands to be run in a shell instead of performing the standard actions for the prime step.

override-pull

Type: string

Step: pull

A string containing commands to be run in a shell instead of performing the standard actions for the pull step.

override-stage

Type: string

Step: pull

A string containing commands to be run in a shell instead of performing the standard actions for the stage step.

parse-info

Type: string

Step: all

plugin

Type: string

Step: all steps

The plugin used to build the part. Available plugins include the following:

Name

Note

ant

Apache Ant

autotools

Autotools

cmake

CMake

dotnet

.Net

dump

Simple file unpacking

go

Go

make

Make

maven

Apache Maven

meson

Meson

nil

No default actions

npm

NPM

python

Python package

rust

Rust with Cargo

scons

SCons

prime

Type: array of unique strings with at least 1 item

Step: prime

The files to copy from the staging area to the priming area, see Specifying paths.

source

Type: grammar-string

Step: pull

The location of the source code and data.

source-branch

Type: string

Step: pull

The branch in the source repository to use when pulling the source code.

source-checksum

Type: string

Step: pull

For plugins that use files, this key contains a checksum value to be compared against the checksum of the downloaded file.

source-commit

Type: string

Step: pull

The commit to use to select a particular revision of the source code obtained from a repository.

source-depth

Type: integer

Step: pull

The number of commits in a repository’s history that should be fetched instead of the complete history.

source-subdir

Type: string

Step: pull

The subdirectory in the unpacked sources where builds will occur.

Note

This key restricts the build to the subdirectory specified, preventing access to files in the parent directory and elsewhere in the file system directory structure.

source-submodules

Type: array of unique strings with 0 or more items

Step: pull

The submodules to fetch in the source repository.

source-tag

Type: string

Step: pull

The tag to use to select a particular revision of the source code obtained from a repository.

source-type

Type: one of “deb”, “file”, “git”, “local”, “rpm”, “snap”, “tar”, “zip”

Step: pull

The type of container for the source code. If not specified, Craft Parts will attempt to auto-detect the source type. A list of supported formats can be found in the craft_parts.sources file.

stage

Type: array of unique strings with at least 1 item

Step: stage

The files to copy from the building area to the staging area, see Specifying paths.

stage-packages

Type: grammar-array

Step: stage

The packages to install in the staging area for deployment with the build products. These provide libraries and executables to support the deployed part.

This keyword also support supports Chisel slices.

To install a package slice instead of the whole package, simply follow the Chisel convention <packageName>_<sliceName>.

NOTE: at the moment, it is not possible to mix packages and slices in the same stage-packages field.

stage-snaps

Type: grammar-array

Step: stage

The snaps to install in the staging area for deployment with the build products. These provide libraries and executables to support the deployed part.

Summary of keys and steps

The following table shows the keys that are used in each build step. The plugin and parse-info keys apply to all steps.

Pull

Build

Stage

Prime

source

after

stage

prime

source-checksum

build-attributes

stage-snaps

source-branch

build-environment

stage-packages

source-commit

build-packages

source-depth

build-snaps

source-submodules

organize

source-subdir

source-tag

source-type

override-pull

override-build

override-stage

override-prime