There are three scenarios here where snapcraft can run from:
- VCS/source checkout
- debian package from the archive
- snap
For all of these, when doing a container build we apt install snapcraft
. This of course leads to version skew when running as a user and a hard to test system when working as a developer.
To solve this, we need to get the snapcraft on the host system being run onto the container. Let’s explore these scenarios.
From VCS
- Detect we are running from a
git
checkout. - Push the files under VCS control to the container.
-
apt install
the deb packages defined in ourHACKING.md
- Install python3/pip onto the container.
pip install --user -r requirements.txt
- run snapcraft using the vcs binary.
From snap
- Detect we are running from a snap.
- Install the squash fuse tools.
- Query snapd for the corresponding assertion for our revision.
- Push the snap and assertion onto the container.
- run snapcraft
/snap/bin/snapcraft
From the deb
This is the least important one as it generally provides minimal version skew.
- Detect we are running from a deb.
- Generate a file listing from information on
/var/lib/dpkg
- Retrieve
Depends
from thecontrol
file. - Install the
Depends
on the container. - Copy the snapcraft files that were generated.
- run snapcraft