Vcstool and rosinstall file
snapcraft.yaml, writing multiple parts in order to cover multiple git repositories might not be necessary. Instead, a
rosinstall file could be used.
Snapcraft support various source-type but
rosinstall is not part of the default implementation. Fortunately, we can still leverage the features of
Vcstool within snapcraft by the means of the overrides part steps feature.
Overrides part steps
Snapcraft provides plugins that ease the build steps of our parts. It automatises everything based on the most common way to use a tool.
Obviously, sometimes we might need to do things slightly differently. And that is why snapcraft has an overrides part steps feature. This feature allows overriding and customising steps of a part’s lifecycle (pull, build, stage, and prime). Also, we can still call the default step action within our script. As an example, we display a message at the end of our build with:
echo “Everything built!”
That is exactly what we need for our
rosinstall file call
my_robot.rosinstall placed at the root of our repository, we could simply call
Vcstool manually. Also, we should make sure that
python3-vcstool is listed in our
build-packages as we will need it at build-time.
plugin: colcon # or catkin
source: . # import our rosinstall file
build-packages: [python3-vcstool, git]
craftctl default # or snapcraftctl pull
# Here we are going to use the local .rosinstall file
vcs import --input my_robot.rosinstall
As we can see apart from the
rosinstall specificity, building a whole robot stack inside a robot is actually as simple as building a basic