From cae22691dcd3784d9a936a7900603c2d3c5e5bd7 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Thu, 15 Mar 2012 14:17:26 +0100 Subject: [PATCH] first tag, then upload. replace ~ in version with _ for tagging. fail if version contains a colon, as its an illegal charater in tags --- debian_build.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/debian_build.py b/debian_build.py index 4a23adf..d2ac110 100755 --- a/debian_build.py +++ b/debian_build.py @@ -432,7 +432,28 @@ if __name__ == '__main__': else: logger.debug('git-buildpackage executed successfully') build_log=os.path.join('../build-area/result/', '%s_%s_amd64.build' % (pkg_name, version)) + # build was succesful, now let's tag it + if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix/'): + # replace ~ with _ for tags + version_tag = version.replace('~','_') + if version_tag.find(":"): + logger_error('Illegal character ":" in version %s detected. Please use a different version.' % version_tag) + exit_error() + cmd = ['/usr/bin/git', 'tag', version_tag] + try: + subprocess.check_call(cmd) + except: + logger_error('Could not tag repository with %s.' % version_tag) + exit_error() + cmd = ['/usr/bin/git', 'push', 'origin', version_tag] + try: + subprocess.check_call(cmd) + except: + logger_error('Could not push tag %s to repository.' % version_tag) + exit_error() + logger.info('Tagged as %s' % version_tag) try: + # now upload create_dput_cfg() # strip epoch if ":" in version: @@ -463,21 +484,6 @@ if __name__ == '__main__': logger.exception(error) exit_error() - # build was succesful, now let's tag it - if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix/'): - cmd = ['/usr/bin/git', 'tag', version] - try: - subprocess.check_call(cmd) - except: - logger_error('Could not tag repository.') - exit_error() - cmd = ['/usr/bin/git', 'push', 'origin', version] - try: - subprocess.check_call(cmd) - except: - logger_error('Could not push tag.') - exit_error() - # finally exit_ok() -- 2.39.5