I had a similar issue. I found out that the catkin plugin is using the PLUGIN_STAGE_SOURCES property. The stage phase will then use the sources provided by this property instead of the sources from the system.
What I did for the moment, until I find a better solution, is to fork the catkin.py plugin (I put it inside snap/plugins/custom_catkin.py).
Then add my custom repository around line 255:
Then change “plugin: catkin” in snapcraft.yaml by “plugin: custom-catkin”.
Btw, I add the key of the repo with a “nil” plugin and a prepare script.
parts:
prepare-apt:
plugin: nil
prepare: |
sudo apt-key ...
sudo apt-get update
my-part:
plugin: custom-catkin
rosdistro: kinetic
...
after: [prepare-apt]
An extra property to add custom repositories in the catkin plugin would probably be a good idea.
When and if I have some time, I could try to create a PR for that.