-def sbuild(package, ref, arch, workdir, arch_all=False):
- """Build a package for a particular architecture."""
- args = ['sbuild', '-v', '-d', DISTRIBUTION, '--arch', arch]
+def sbuild(package, ref, distro, arch, workdir, arch_all=False):
+ """Build a package for a particular architecture and distro."""
+ # We append a suffix like ~ubuntu8.04 to differentiate the same
+ # version built for multiple distros
+ nmutag = b.distroToSuffix(distro)
+ env = os.environ.copy()
+ env['NMUTAG'] = nmutag
+
+ # Run sbuild with a hack in place to append arbitrary versions
+ args = ['perl', '-I/usr/share/invirt-dev',
+ '/usr/bin/sbuild',
+ '--binNMU=171717', '--make-binNMU=Build with sbuild',
+ '-v', '-d', distro, '--arch', arch]