BIN_SUDO = '/usr/bin/sudo'
class GitBuildPackage(object):
- def __init__(self, upstream_branch=None,
- debian_branch=None, dist=None, arch=None, pb_suite=None, git_commit_id=None):
+ def __init__(self,
+ upstream_branch=None,
+ debian_branch=None,
+ dist=None,
+ arch=None,
+ pb_suite=None,
+ git_commit_id=None
+ ):
+ '''
+ TODO
+ '''
self.upstream_branch = upstream_branch
self.debian_branch = debian_branch
self.dist = dist
self.pb_suite = pb_suite
self.git_commit_id = git_commit_id
- def build(self):
- cmd = [
+ @property
+ def env(self):
+ '''
+ TODO
+ '''
+ result = os.environ
+ result['DIST'] = self.dist
+ result['PB_SUITE'] = self.pb_suite
+ result['GIT_COMMIT_ID'] = self.git_commit_id
+ return result
+
+ @property
+ def command(self):
+ '''
+ TODO
+ '''
+ result = [
BIN_SUDO,
BIN_GIT_BUILDPACKAGE,
'--git-upstream-branch=%s' %(self.upstream_branch),
'--git-ignore-new',
'--debbuildopts', '-b' # don't build source packages... see directly below
]
+ 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
# So in summary, it would be expensive and buys as nothing, as we
# can always generate the source from said git repos...
- env = os.environ
- env['DIST'] = self.dist
- env['PB_SUITE'] = self.pb_suite
- env['GIT_COMMIT_ID'] = self.git_commit_id
-
logger.debug(
'Trying to call "%s" with environment export %s'
%(
- ' '.join(cmd),
+ ' '.join(self.command),
' '.join(
map(
lambda x: '%s="%s"' %(x[0], x[1]),
- env.iteritems()
+ self.env.iteritems()
)
)
)
)
cmdobj = subprocess.Popen(
- cmd,
+ self.command,
shell=False,
close_fds=True,
#stdout=subprocess.PIPE,
#stderr=subprocess.PIPE,
stdout=sys.stdout,
stderr=sys.stderr,
- env=env,
+ env=self.env,
cwd=os.getcwd(),
)
if ret:
logger.error(
'"%s" returned non-zero. exitcode was: %s'
- %(' '.join(cmd), ret)
+ %(' '.join(self.command), ret)
)
-# error_str = cmdobj.stderr.read()
-# if not error_str:
-# error_str = cmdobj.stdout.read()
-# if not error_str:
-# error_str = 'No Error Msg found'
-# logger.error(
-# '%s returned with %s. Output was: %s'
-# %(' '.join(cmd), ret, error_str)
-# )
return ret