]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
less braindead formatting/logic
authorHolger Levsen <holger@layer-acht.org>
Wed, 11 Apr 2012 16:03:52 +0000 (18:03 +0200)
committerHolger Levsen <holger@layer-acht.org>
Wed, 11 Apr 2012 16:03:52 +0000 (18:03 +0200)
debian_build.py

index 1bd19a57364bba7949b24a85b918f1d457e22aa5..f9c0e31bf94b4b3c948b870a42406691bee2baa1 100755 (executable)
@@ -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()