sbuild
sbuild is the official Debian package builder.
Debian packages are currently built two different ways, neither of them using sbuild.
Current Debian packaging solutions in OpenXT
The first way, used for the guest tools, build a package file without any tool, by "manually" creating all the Debian files and compressing everything into a .deb. This is not right, and hardly maintainable.
See https://github.com/OpenXT/openxt/tree/master/pkg-xctools
The second way, implemented in xenclient-deb.bbclass, uses a Debian chroot and the low-level dpkg tools. This is an improvement over the first way, but still a lot of code and hard-coded metadata files.
See https://github.com/OpenXT/xenclient-oe/blob/master/classes/xenclient-deb.bbclass
First sbuild implementation
In OpenXT, there is a bbclass that implements rudimentary sbuild support. It is, or at least was, functional.
However, it relies on the sbuild binary and environment of the host build machine, which is something we really want to avoid in OpenEmbedded.
I think it also requires the user to setup the sbuild chroots beforehand...
Tentative of sbuild integration in OE
The previous solution would be ideal if we had an sbuild environment built inside of OpenEmbedded ("native").
I spent some time trying to get there, it did not go very well...
The bbclass relies on (at least) 3 tools: sbuild, schroot and reprepro. I managed to build sbuild and reprepro as native, but schroot depends on the Boost library, which has an awful build system and an incomplete OpenEmbedded recipe.
I wrote recipes for about a dozen dependencies before getting stuck on Boost and giving up. Who knows, maybe it was the last one, or maybe there's another dozen dependencies needed...
It would have been really nice to have full OE integration, but at this point, I don't think it it worth the amount of time and effort needed for that.
See https://github.com/jean-edouard/xenclient-oe/commits/sbuild
Other ideas
I think we need a full Debian environment to be able to install and use sbuild properly. There's 2 options, we either do a chroot or use a whole Debian system (or VM).
Using a Debian chroot
This would allow us to keep things controlled by OpenEmbedded, which I think would be great.
The trick is to find a way to build and run the chroot without root permissions. The solution may reside in fakeroot/fakechroot, which I don't know much about.
Using a Debian machine
We could have a completely separate build environment for the Debian tools, like we do for the synchronizer bits.
I think this option is inferior, as it requires more work and resources to setup. The whole thing is already complicated enough...