--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import logging
+import subprocess
+logger = logging.getLogger(__file__)
+
+
+BIN_GIT_BUILDPACKAGE = '/usr/bin/git-buildpackage'
+BIN_SUDO = '/usr/bin/sudo'
+
+# sudo DIST=squeeze git-buildpackage --git-upstream-branch=master
+# --git-debian-branch=debian --git-tag
+class GitBuildPackage(object):
+ def __init__(self, upstream_branch=None,
+ debian_branch=None, dist=None, arch=None):
+ self.upstream_branch = upstream_branch
+ self.debian_branch = debian_branch
+ self.dist = dist
+ self.arch = arch
+
+
+ def build(self):
+ cmd = [
+ BIN_SUDO,
+ GIT_BUILDPACKAGE,
+ '--git-upstream-branch=%s' %(self.upstream_branch),
+ '--git-debian-branch=%s' %(self.debian_branch)
+ ]
+
+ env = os.environ
+ env['DIST'] = self.dist
+
+ cmd_obj = subprocess.Popen(
+ cmd,
+ shell=False,
+ close_fds=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ env=env,
+ cwd=os.getcwd(),
+ )
+
+ ret = cmdobj.wait()
+ if 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 False
+ return cmdobj.stdout.read() or True
+
+
+# vim: autoindent smartindent tabstop=4 expandtab shiftwidth=4 softtabstop=4 nu enc=utf-8 cinwords=if,elif,else,for,while,try,except,finally,def,class
'%s-build%s' %(BUILD_ID, BUILD_NUMBER)
)
+if GIT_UPSTREAM_BRANCH = 'NONE':
+ raise Exception('You must give a GIT_UPSTREAM_BRANCH')
+
if GIT_DEBIAN_BRANCH == 'NONE':
- GIT_DEBIAN_BRANCH = 'debian'
+ GIT_DEBIAN_BRANCH = GIT_UPSTREAM_BRANCH
GIT_TARGET_DIR = os.path.join(
GIT_TARGET_WORKSPACE,