From 2da6358b6b8a150bb09a6b1a3ff41d0bca12ace9 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 | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/debian_build.py b/debian_build.py index 4a23adf..29af4a6 100755 --- a/debian_build.py +++ b/debian_build.py @@ -432,7 +432,29 @@ 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) + pass: + logger.info('Tagged as %s' % version_tag) + except: + logger_error('Could not push tag %s to repository.' % version_tag) + exit_error() try: + # now upload create_dput_cfg() # strip epoch if ":" in version: @@ -463,21 +485,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