After building a (large) snap, I want to run a quick modification, without fully rebuilding.
After running a multipass shell on the VM, I see that the /root/parts/xxx/ directories have these subdirectories in them:
build/
install/
run/
src/
state/
What are the functions of these subdirectories?
I see that the source tree ends up in both build and src subdirs. Are those the patched and non-patched versions perhaps? Or something else?
Which of these source trees can I modify on-the-fly in a shell, and then redo the snapcraft build without snapcraft doing a full recompile of everything? (The snap takes 2 hrs to build, so would like to use a short cut for quick modifications.)
During the pull step, the part source specified in source: is downloaded (and extracted, if necessary) to part/<part-name>/src. During the build step the actual build happens in part/<part-name>/build, and the results are installed to part/<part-name>/install. Only files found under the install subdir are migrated to stage and prime during the subsequent steps. The run subdir is used to store the script used to build the part (in core20 and core22), and the state subdir is used to store state information used by the parts processor, such as the steps that have been completed and parameters that could trigger a rebuild if changed.
If you’re using a local source (source: .) changing a file in the project dir is enough to rebuild without cleaning the build directory first, but other source types may not support this. Depending on the type of change you’re doing, the best approach could be to adjust the source code and test the build outside the snap creation context, and generate a patch file – otherwise you may be trying to develop and package at the same time.