'allow_unsigned_uploads': 1,
'post_upload_command': 'ssh reprepro@alexandria.profitbricks.localdomain /srv/dev-repository/bin/pb_processincoming',
}
-DPUT_CF = os.path.join(GIT_TARGET_WORKSPACE, 'dput.cf')
+DPUT_CF = os.path.join(CWD, '..', 'dput.cf')
NO_UPLOAD = os.environ.get('NO_UPLOAD')
)
)
)
- logging.getLogger('lib.git_helper').setLevel(logging.DEBUG)
+ #logging.getLogger('lib.git_helper').setLevel(logging.DEBUG)
options, args = getopts()
- if git_helper.git_clone_remote_repository(GIT_REPO_PATH, GIT_TARGET_DIR):
- logger.info('git clone was successfull')
- else:
- logger_loud_error('git clone was not successfull')
- exit_error()
+ #if git_helper.git_clone_remote_repository(GIT_REPO_PATH, GIT_TARGET_DIR):
+ # logger.info('git clone was successfull')
+ #else:
+ # logger_loud_error('git clone was not successfull')
+ # exit_error()
- atexit.register(remove_git_target_workspace)
- os.chdir(GIT_TARGET_DIR)
+ #atexit.register(remove_git_target_workspace)
+ #os.chdir(GIT_TARGET_DIR)
# FIXME: this is just needed for gbp and can go away eventually
if GIT_BRANCH_NAME:
repo = git.repo.Repo()
- if GIT_BRANCH_NAME != 'master':
- git_helper.git_new_branch_from(
+ #if GIT_BRANCH_NAME != 'master':
+ git_helper.git_new_branch_from(
GIT_BRANCH_NAME,
os.path.join('origin', GIT_BRANCH_NAME)
)
# treeish refspec when a name was given (i.e. tag names, branch names,
# etc.)
# TODO: upgrade git-buildpackage
- GIT_UPSTREAM_BRANCH = git_helper.git_get_treeish(
- os.path.join('origin', GIT_UPSTREAM_BRANCH)
- )
+ #GIT_UPSTREAM_BRANCH = git_helper.git_get_treeish(
+ # os.path.join('origin', GIT_UPSTREAM_BRANCH)
+ #)
# now checkout the requested branch
- if git_helper.git_checkout_branch(GIT_UPSTREAM_BRANCH):
- logger.info('git checkout %s was successfull' % GIT_UPSTREAM_BRANCH)
- else:
- logger_loud_error('git checkout %s was not successfull' % GIT_UPSTREAM_BRANCH)
- exit_error()
+ #if git_helper.git_checkout_branch(GIT_UPSTREAM_BRANCH):
+ # logger.info('git checkout %s was successfull' % GIT_UPSTREAM_BRANCH)
+ #else:
+ # logger_loud_error('git checkout %s was not successfull' % GIT_UPSTREAM_BRANCH)
+ # exit_error()
# we need to make sure our jenkins config is used, so let's delete any
# other config available in repository that might be prefered
logger.info('used to start git-buildpackage here...')
ret = gbp.build()
+ # remove last commit (the one where we added the changelog entry)
+ cmd = ['/usr/bin/git', 'reset', '--soft', 'HEAD~1']
+ subprocess.check_call(cmd)
+ # now handle gpb result
if ret:
logger_loud_error(
'git-buildpackage returned non-zero. exitcode was: %s' % ret
logger.debug('git-buildpackage executed successfully')
# if not ret:
build_log=os.path.join('../build-area/result/', '%s_%s_amd64.build' % (pkg_name, version))
- try:
- fh = open(build_log, 'r')
- logger.debug('Output of the deb build: %s' % (fh.read()))
- fh.close()
- except:
- pass
+# try:
+# fh = open(build_log, 'r')
+# logger.debug('Output of the deb build: %s' % (fh.read()))
+# fh.close()
+# except:
+# pass
# exit_error()
# else:
try:
# strip epoch
if ":" in version:
version = version.split(":", 1)[1]
- changes_file = os.path.join(GIT_TARGET_WORKSPACE, 'build-area/result/', '%s_%s_amd64.changes' % (pkg_name, version))
+ changes_file = os.path.join(CWD, '../build-area/result/', '%s_%s_amd64.changes' % (pkg_name, version))
# display changes file
fh = open(changes_file, 'r')
logger.info('%s' % (fh.read()))
return True
def git_new_branch_from(branch_name, from_branch):
+ if git_repo_has_branch(branch_name):
+ cmd = [GIT, 'branch', '-D', branch_name]
+
+ cmdobj = subprocess.Popen(
+ cmd,
+ shell=False,
+ close_fds=True,
+ stderr=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ env={'':''},
+ cwd=os.getcwd()
+ )
+
+ # this should not happen, we just deleted it
if git_repo_has_branch(branch_name):
raise BranchExistError(branch_name)
-# if not git_repo_has_branch(from_branch):
-# raise BranchNotExistError(from_branch)
+
+ #if not git_repo_has_branch(from_branch):
+ # raise BranchNotExistError(from_branch)
+
cmd = [GIT, 'checkout', '-b', branch_name, from_branch]
cmdobj = subprocess.Popen(
# and there is proper error handling below anyway...
#if not git_repo_has_branch(branch_name):
#raise BranchNotExistError(branch_name)
-
cmd = [GIT, 'checkout', branch_name]
+
cmdobj = subprocess.Popen(
cmd,
shell=False,