Introduction
snapcraft performs caching of it’s steps to not repeat them over and over again, so in the case of running
$ snapcraft pull
The tool would run the pull
step for all parts. If this is followed by
$ snapcraft build
Which is a step
in the lifecycle that follows the pull
step, the tool will not run the pull
step again and just execute the build
step for every part defined.
Problems and solutions
Local sources
For local sources, changing the source code does not mark the pull
step of that part as dirty and rerun through the step. The tool should detect the change and re-run appropriately.
Changing definitions
Some definitions, such as after
, stage-packages
or build-packages
need to mark the pull
step as dirty and rerun through the cycle.
Changing a source
entry or any of its related attributes (source-
ones) also need to mark the pull
step as dirty.
Others, like plugin specific ones, need to mark the relevant step they affect as dirty.
If a step is marked dirty, the step needs to automatically do the right thing when re-running the tool, which is to rerun the step.
Rerunning a step
When running
$ snapcraft pull
Followed by a subsequent
$ snapcraft pull
The tool should force the command and run it as the user requested.
To expand on the concept, if a user runs
$ snapcraft prime
This will go through these steps in the lifecycle: pull
, build
, stage
and prime
If a user runs
$ snapcraft prime
This will rerun only the prime
step, keeping the cached results for pull
, build
and stage
.
However, if the user runs
$ snapcraft pull
The pull
step will be rerun, invalidating what was run for build
, stage
and prime