Components

Components are parts of a snap that can be built and uploaded in conjunction with a snap and later optionally installed beside it. Components are defined with a top-level components keyword in a snapcraft.yaml.

Components employ a Craft Parts feature called partitions. See component and partitions for an explanation on how they are related.

Partition-specific output directory environment variables

If partitions are enabled, partition-specific environment variables will be created for use during step processing and execution of user-defined scriptlets.

These variable names will contain the (optional) namespace, partition name, and lifecycle step, formatted as CRAFT_[<namespace>_]<partition>_{STAGE|PRIME}. The values of these variables will be the directory that corresponds to that partition and step. For instance, if the defined partitions are default, kernel, and component/bar-baz, the following environment variables will be created:

$CRAFT_STAGE                   -> stage
$CRAFT_DEFAULT_STAGE           -> stage
$CRAFT_KERNEL_STAGE            -> partitions/kernel/stage
$CRAFT_COMPONENT_BAR_BAZ_STAGE -> partitions/component/bar-baz/stage

$CRAFT_PRIME                   -> prime
$CRAFT_DEFAULT_PRIME           -> prime
$CRAFT_KERNEL_PRIME            -> partitions/kernel/prime
$CRAFT_COMPONENT_BAR_BAZ_PRIME -> partitions/component/bar-baz/prime

(Note that the hyphen in the partition component/bar-baz is converted to an underscore in the corresponding variable names.)