From: Holger Levsen Date: Wed, 11 Apr 2012 16:03:52 +0000 (+0200) Subject: less braindead formatting/logic X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=41617359d4c0252c251f4abc071198e75e09059b;p=profitbricks%2Fjenkins-build-scripts.git less braindead formatting/logic --- diff --git a/debian_build.py b/debian_build.py index 1bd19a5..f9c0e31 100755 --- a/debian_build.py +++ b/debian_build.py @@ -445,58 +445,59 @@ if __name__ == '__main__': # FIXME: if reports.tgz exists untar it to workspace and delete it. # tar xzvf ../build-area/result/reports.tgz 2>/dev/null|| true - # 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(":") != -1 : - 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) + # 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(":") != -1 : + 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: - # now upload - create_dput_cfg() - # strip epoch - if ":" in version: - version = version.split(":", 1)[1] - 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())) - fh.close() - # upload (if NO_UPLOAD is not set) - if NO_UPLOAD not in ('true', 'True'): - dput_package_upload(changes_file) - else: - logger.debug('value of NO_UPLOAD: %s' % NO_UPLOAD) - logger.info('dist: %s' %(pb_suite)) - cmd = ['figlet-figlet', '-t', 'dist: %s' %(pb_suite)] - subprocess.check_call(cmd) - logger.info('version: %s' %(version)) - cmd = ['figlet-figlet', '-t', 'version: %s' %(version)] subprocess.check_call(cmd) - logger.info('---------------------------------------------------------------------------------------------------------') - cmd = ['figlet-figlet', '-t', 'Success!!!'] - subprocess.check_call(cmd) - - except Exception, error: - cmd = ['figlet-figlet', '-t', 'upload to reprepro failed:'] + 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) - logger.exception(error) + except: + logger_error('Could not push tag "%s" to repository.' % version_tag) exit_error() + logger.info('Tagged as "%s".' % version_tag) + + # now upload (at least, try to...) + try: + create_dput_cfg() + # strip epoch + if ":" in version: + version = version.split(":", 1)[1] + 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())) + fh.close() + # upload (if NO_UPLOAD is not set) + if NO_UPLOAD not in ('true', 'True'): + dput_package_upload(changes_file) + else: + logger.debug('value of NO_UPLOAD: %s' % NO_UPLOAD) + logger.info('dist: %s' %(pb_suite)) + cmd = ['figlet-figlet', '-t', 'dist: %s' %(pb_suite)] + subprocess.check_call(cmd) + logger.info('version: %s' %(version)) + cmd = ['figlet-figlet', '-t', 'version: %s' %(version)] + subprocess.check_call(cmd) + logger.info('---------------------------------------------------------------------------------------------------------') + cmd = ['figlet-figlet', '-t', 'Success!!!'] + subprocess.check_call(cmd) + + except Exception, error: + cmd = ['figlet-figlet', '-t', 'upload to reprepro failed:'] + subprocess.check_call(cmd) + logger.exception(error) + exit_error() - # finally - exit_ok() + # finally + exit_ok()