Redefining the source directory for building snaps with the base keyword


I have a repository that I want to build multiple snaps with. Each directory with the different packages has its own snapcraft.yaml; however, some of these directories require the other packages in order to build. The problem is that when building these packages with the “base” keyword, it only mounts the directory that the snapcraft.yaml is in and not the parent directory. Is there any way to redefine what directory gets mounted in the VM?


See for a pragmatic approach that copies the parent tree into one of its own subdirectories. It wraps the snapcraft command, so no functionality is lost.