Currently when working with a large snap that has multiple parts in different directories of the source tree, and multiple folders change, and I go to run snapcraft, snapcraft will tell me that some parts are out of date (and they are), and so then I need to type or copy the parts that are dirty into another command and then run
snapcraft clean <list-of-parts> && snapcraft
It would be nice if there was a command that did both of these steps for me, first running snapcraft clean part on all the dirty parts, and then running snapcraft afterwards. Sort of like a cleanbuild, but not really. Strawman proposal:
Take a look at the ālifecycleā section under ābaseā in the release notes for 2.43, and youāll see a switch you can flip to get snapcraft doing that for you on its own when you run build again. Itās still a little beta, but it works pretty well (although some fixes have landed since the latest stable release, so you might consider using edge if you run into issues with it).
That sounds like exactly what Iām looking for, thanks!
On a side-note, other than the snapcraft code itself is there documentation for the ~/.config/snapcraft/cli.cfg file I keep hearing about? It seems like there are some useful features being added thereā¦
Not really, no. Itās mostly where we put feature flags, i.e. experimental things you can opt-in-to, which we spread by word-of-mouth (or fingers, as the case may be). This particular behavior will be the default for snapcraft 3.0.
Hi @kyrofa , I tried to use your guide, but I donāt seem able to clean just a single stage. Has the command changed?
...
Skipping pull quack (already ran)
Skipping build quack (already ran)
Skipping stage quack (already ran)
Skipping prime quack (already ran)
'grade' property not specified: defaulting to 'stable'.
Determining the version from the project repo (version: git).
The version has been set to '0+git.c67d033-dirty'
The requested action has already been taken. Consider
specifying parts, or clean the steps you want to run again.
$ snapcraft clean quack --use-lxd --step=build
Usage: snapcraft clean [OPTIONS] <part>...
Try 'snapcraft clean -h' for help.
Error: No such option: --step (Possible options: --help, --shell)
However the previous message implied it was possible in some way
Consider specifying parts, or clean the steps you want to run again.
Iām afraid that blog post is tremendously out of date with the move to build VMs/containers. That particular issue sounds like it might be this bug though, which is fixed by this PR:
Hi and thanks for your quick reply
Iām not sure itās the same bug, as I can specify the part, but I canāt specify the stage.
E.g. snapcraft clean quack --use-lxd works, but snapcraft clean quack --step=build --use-lxd doesnāt Iād like to keep the pull part, which takes time due to pulling and installing packages but redo the following stages
Weāre trying to improve Snapcraft on incremental rebuilding workflows. Core20 improved some things and weāve identified other areas for improvement to tackle.
Can you share a little bit about your workflow and what you are trying to accomplish?