from db_add import add_package_instances
from lib import dput
from lib import gitpkg
-from lib import pbuilder
+from lib import sbuild
# from common_code
ret = source_builder.build()
#
- # ACT V: build the binary with pbuilder from the created source tarball
+ # ACT V: build the binary with sbuild from the created source tarball
#
- builder = pbuilder.Pbuilder(
+ builder = sbuild.Sbuild(
dsc_file=source_builder.dsc_file,
- dist=curr_dist,
- arch='amd64',
- git_commit_id=curr_commit_hexsha[0:7],
+ dist=new_dist,
+ chroot='pb-'+curr_dist,
+ arch='amd64'
)
if ret == 0:
logger.info('Current environment:\n\n{env}\n'.format(env=builder.env))
- logger.info('Start building the binary package with pbuilder...\n')
+ logger.info('Start building the binary package with sbuild...\n')
ret = builder.build()
# .. remove last commit (the one where we added the changelog entry)
# .. and finally handle the result
if ret:
build_failed = True
- logger.error('git-buildpackage failed with exitcode {code}'.format(code=ret))
+ logger.error('sbuild failed with exitcode {code}'.format(code=ret))
figlet('Build failed')
failed_message = 'package build has failed'
do_cidb = False
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+@author: Benjamin Drung <benjamin.drung@profitbricks.com>
+"""
+
+import os
+import sys
+import subprocess
+
+SBUILD = 'sbuild'
+
+
+class Sbuild(object):
+ def __init__(self, dsc_file=None, dist=None, chroot=None, arch=None):
+ '''
+ TODO
+ '''
+ self.dsc_file = dsc_file
+ self.arch = arch
+ self.chroot = chroot
+ self.dist = dist
+
+ @property
+ def env(self):
+ '''
+ TODO
+ '''
+ result = os.environ
+ return result
+
+ @property
+ def command(self):
+ '''
+ TODO
+ '''
+ result = [
+ SBUILD,
+ '-d', self.dist,
+ '-c', self.chroot,
+ '--arch=' + self.arch,
+ self.dsc_file,
+ ]
+ return result
+
+ def build(self):
+ '''
+ TODO
+ '''
+ # if we would build orig.tar.gz we would need to be able to access
+ # them later, which we probably could achieve with using pristine-tar
+ # and storing that in the git repo - but this has the downside that
+ # the jenkins build job would need to push this back into the git repo
+ # (so this makes things complicated) and then still, we could not
+ # gurantee that this orig.tar.gz actually reflects the git repo at
+ # that point.
+ # So in summary, it would be expensive and buys as nothing, as we
+ # can always generate the source from said git repos...
+
+ cmdobj = subprocess.Popen(
+ self.command,
+ shell=False,
+ close_fds=True,
+ #stdout=subprocess.PIPE,
+ #stderr=subprocess.PIPE,
+ stdout=sys.stdout,
+ stderr=sys.stderr,
+ env=self.env,
+ cwd=os.getcwd(),
+ )
+
+ ret = cmdobj.wait()
+ return ret