]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
dont use atexit as we cannot unregister it (only in python 3.1...), better error...
authorHolger Levsen <holger@layer-acht.org>
Tue, 6 Sep 2011 09:09:19 +0000 (11:09 +0200)
committerHolger Levsen <holger@layer-acht.org>
Tue, 6 Sep 2011 09:09:19 +0000 (11:09 +0200)
build.py

index d12688acbc9a30f549aa4f30feb7db1b528a6607..834ec3365ff692f2224da3ac58ef9695f379d1b2 100755 (executable)
--- a/build.py
+++ b/build.py
@@ -210,6 +210,7 @@ def remove_git_target_workspace():
         return cmdobj
 
 def exit_ok():
+    remove_git_target_workspace()
     send_email(SMTP_BUILD_SUCCESS)
     sys.exit(0)
 
@@ -250,7 +251,7 @@ if __name__ == '__main__':
         logger.info('git clone was not successfull')
         exit_error()
 
-    atexit.register(remove_git_target_workspace)
+    #atexit.register(remove_git_target_workspace)
     os.chdir(GIT_TARGET_DIR)
 
     if GIT_UPSTREAM_BRANCH != GIT_DEBIAN_BRANCH:
@@ -355,11 +356,16 @@ if __name__ == '__main__':
                 cmd,
                 shell=False,
                 close_fds=True,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE,
+                stdout=sys.stdout,
+                stderr=sys.stderr,
                 cwd='./'
         )
        ret = parse_changelog.wait()
+        if ret:
+            raise Exception(
+                    '%s was not successfull, return code was %s ' % (' '.join(cmd), ret) 
+                   exit_error()
+            )
 
        cmd = ['grep-dctrl', '-n', '-s', 'Version', '']
        grep_dctrl =  subprocess.Popen(
@@ -367,17 +373,23 @@ if __name__ == '__main__':
                 shell=False,
                 close_fds=True,
                stdin=parse_changelog.stdout,
-                stdout=subprocess.PIPE,
-                stderr=subprocess.PIPE,
+                stdout=sys.stdout,
+                stderr=sys.stderr,
                 cwd=os.getcwd()
         )
        ret = grep_dctrl.wait()
+        if ret:
+            raise Exception(
+                    '%s was not successfull, return code was %s ' % (' '.join(cmd), ret) 
+                   exit_error()
+            )
+   
         version = grep_dctrl.stdout.read()
        version = version.strip()
        logger.info('version is %s' % (version))
 
-        stdout_msg = parse_changelog.stdout.read()
-        logger.info(stdout_msg)
+        #stdout_msg = parse_changelog.stdout.read()
+        #logger.info(stdout_msg)
 
 
     if not GIT_COMMITTER_EMAIL:
@@ -412,7 +424,6 @@ if __name__ == '__main__':
           fh.close()
        except:
          pass
-        atexit.unregister(remove_git_target_workspace)
         exit_error()
     else:
         create_dput_cfg()