Problem with build-snaps because pip builds in /tmp

Hello!

To test build-snaps I was making a snap for raiden. During the build this project needs to compile some smart contracts with solc, and we have a solc snap, which makes it a very good test subject.

The problem is that this is a python snap, and during the build we call pip wheel with something like --wheel-dir /tmp/<tempdir>. Then solc is called to compile a file in /tmp and because it is a confined snap, it will not be able to read the source file.

This can be fixed on the python plugin, just make sure that instead of using wheel-dir in /tmp/ we use the snapcraft xdg dir in home, or something like that. But it seems to me that the problem is bigger than that.

Maybe we should make sure that snapcraft never uses /tmp/, or maybe the snaps called by a classic snap should be executed as classic too. What do you think?

The same problem applies to snapcraft using LXD as a snap. /tmp won’t work. /run is too small. The current solution in this case is to use ~/snap/lxd/common which snapcraft can write to. It’s obviously not a generic solution.