daily_date = BUILD_START.strftime('%Y%m%d%H%M%S')
# .. repository related
+ gitrepo = git.Repo('.')
local_branch = re.match('^(origin/)?(.*)', ENV['GIT_BRANCH']).groups()[1]
remote_branch = os.path.join('origin', local_branch)
- reports_file = os.path.join(ENV['WORKSPACE'], '../build-area/result/reports.tgz',)
- gitrepo = git.Repo('.')
curr_commit = gitrepo.commit(ENV['GIT_COMMIT'])
# collect all 'trigger' expressions found in the commit message, i.e.
# <<< "[merge][no-test][provisioning] my commit message"
# id attribute used in python-git 0.1.6-1 found in squeeze
elif hasattr(curr_commit, 'id'):
curr_commit_id = curr_commit.id
+ # this should be part of 'git' lib, but it isn't right now
+ gitrepo.remotes = {}
+ for remote in gitrepo.git.remote('-v').split('\n'):
+ name, url, type = remote.split()
+ type = type.strip('()')
+ if not gitrepo.remotes.has_key(name):
+ gitrepo.remotes.update({name: {type: url}})
+ else:
+ gitrepo.remotes[name].update({type: url})
# Act II: make decissions
# compatibility until call_jenkins was replaced
if re.match(STABLE_BRANCHES_RE, ENV['GIT_BRANCH']):
if re.match('^(ps_|dev_).*$', ENV['JOB_NAME']):
logger.error('Use the appropriate job to build for branch "{branch}"!'.format(
- branch=ENV['GIT_BRANCH'],
+ branch=local_branch,
))
exit_error()
new_dist = 'stable'
# replace valid debian version chars that are invalid for git tagging
new_tag = curr_version.replace('~', '_').replace(':', ',')
# .. only take care of changelog automation if we want it to
- # FIXME: this must be reponame in ...
- if ENV['GIT_BRANCH'] in AUTO_CHANGELOG_REPONAMES:
+ if gitrepo.remotes['origin']['fetch'].split('/')[-1] in AUTO_CHANGELOG_REPONAMES:
do_autoincrement = True
# reset actions
if curr_dist == 'squeeze':
elif re.match(UNSTABLE_BRANCHES_RE, ENV['GIT_BRANCH']):
if not re.match('^ps_.*$', ENV['JOB_NAME']):
logger.error('Use the appropriate job to build for branch "{branch}"!'.format(
- branch=ENV['GIT_BRANCH'],
+ branch=local_branch,
))
exit_error()
new_dist = 'unstable'
elif re.match(EXPERIMENTAL_BRANCHES_RE, ENV['GIT_BRANCH']):
if not re.match('^dev_.*$', ENV['JOB_NAME']):
logger.error('Use the appropriate job to build for branch "{branch}"!'.format(
- branch=ENV['GIT_BRANCH'],
+ branch=local_branch,
))
exit_error()
else:
logger.error('Don\'t know how to handle branch "{branch}".'.format(
- branch=ENV['GIT_BRANCH'],
+ branch=local_branch,
))
exit_error()
figlet('Reports skipped')
else:
try:
+ reports_file = os.path.join(
+ ENV['WORKSPACE'],
+ '../build-area/result/reports.tgz',
+ )
if os.path.exists(reports_file):
for cmd in (['/bin/tar', 'xzvf', reports_file, '-C', ENV['WORKSPACE']],
['/usr/bin/sudo', '/bin/rm', '-v', reports_file]):