]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
correctly trigger build and sleep 60sec before doing so
authorHolger Levsen <holger@layer-acht.org>
Tue, 25 Oct 2011 18:12:48 +0000 (20:12 +0200)
committerHolger Levsen <holger@layer-acht.org>
Tue, 25 Oct 2011 18:12:48 +0000 (20:12 +0200)
debian_build.py

index c6160ad4826ad7163c4775e348e8b3e4af56ee4b..0ea5fdac1ee6875c2788d9feab4140cdafc5bf9b 100755 (executable)
@@ -15,6 +15,7 @@ import optparse
 import datetime
 import platform
 import subprocess
+import time
 from glob import glob
 from ftplib import FTP
 from lib import git_helper
@@ -480,6 +481,8 @@ if __name__ == '__main__':
             # upload
             dput_package_upload(changes_file)
             # build oot binary modules for all defined flavours
+            logger.info('Sleeping for 60 sec. so reprepro can process upload....')
+            time.sleep(60) # give reprepro time to process
             FLAVOURS_FILE=os.path.join(GIT_TARGET_WORKSPACE, GIT_REPO_NAME, "debian/pb_flavours")
             fh = open(FLAVOURS_FILE, 'r')
             for flavour in fh.read():
@@ -488,8 +491,23 @@ if __name__ == '__main__':
                        '%s' % flavour,
                        '%s' % options.distribution,
                        '%s' % pb_suite ]
-                logger.info('calling %s' % cmd)
-                subprocess.check_call(cmd)
+            cmdobj = subprocess.Popen(
+                cmd,
+                shell=False,
+                close_fds=True,
+                stdout=subprocess.PIPE,
+                stderr=subprocess.PIPE,
+                env=os.environ
+            )
+            logger.info('calling "%s" ...', ' '.join(cmd))
+            ret = os.system('%s' %(' '.join(cmd)))
+            if ret:
+                logger.error(
+                    '"%s" returned non-zero (exitcode was: %s).',
+                    ' '.join(cmd),
+                    ret,
+                )
+                return False
             fh.close()
             exit_ok()
         except Exception, error: