]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
fix
authorMathias Klette <mathias.klette@profitbricks.com>
Wed, 16 May 2012 14:19:50 +0000 (16:19 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Wed, 16 May 2012 14:19:50 +0000 (16:19 +0200)
debian_build.py

index 0350554ffe1b9c1d42aa2c65275d83d9692da0f1..6a21c94db97354213f0bdeb3b165e5b990ed86d0 100755 (executable)
@@ -28,6 +28,7 @@ from ConfigParser import SafeConfigParser
 
 JOB_URL = 'http://jenkins:80/job/%(flavour)s/buildWithParameters?token=BuildIt&'
 JOB_DELAY = '0sec'
+JOB_NAME = os.environ.get('JOB_NAME')
 
 GIT = '/usr/bin/git'
 BIN_RM = '/bin/rm'
@@ -47,10 +48,12 @@ CWD = os.environ.get('WORKSPACE')
 BUILD_NUMBER = os.environ.get('BUILD_NUMBER')
 BUILD_ID = os.environ.get('BUILD_ID')
 BUILD_URL = os.environ.get('BUILD_URL')
+BUILD_AREA = os.path.abspath(os.path.join(os.curdir,'../build-area'))
 
 GIT_REPO_PATH = os.environ.get('GIT_REPO_PATH')
 GIT_REPO_NAME = os.path.basename(GIT_REPO_PATH)
 GIT_BRANCH_NAME = os.environ.get('GIT_BRANCH_NAME')
+GIT_COMMITTER_EMAIL = os.environ.get('GIT_COMMITTER_EMAIL')
 
 #unused: (except in in-active code)
 GIT_TARGET_WORKSPACE = os.path.join(
@@ -63,9 +66,6 @@ GIT_TARGET_DIR = os.path.join(
         os.path.basename(GIT_REPO_PATH)
 )
 
-JOB_NAME = os.environ.get('JOB_NAME')
-GIT_COMMITTER_EMAIL = os.environ.get('GIT_COMMITTER_EMAIL')
-
 DPUT_OPTIONS_DEFAULT = {
         'fqdn': 'alexandria.profitbricks.localdomain',
         'method': 'scp',
@@ -427,16 +427,16 @@ if __name__ == '__main__':
          raise Exception('unhandled branch, failing.')
 
     # cleanup existing *orig.tar.gz
-    if os.path.isdir('../build-area/'):
-        files = [os.path.join('../build-area/',file) for file in fnmatch.filter(os.listdir('../build-area/'),'*.orig.tar.gz')]
+    if os.path.isdir(BUILD_AREA):
+        files = [os.path.join(BUILD_AREA,file) for file in fnmatch.filter(os.listdir(BUILD_AREA),'*.orig.tar.gz')]
         logger.debug('Previous upstream tarball(s) found: %s' %( files ))
-        cmd = [BIN_SUDO, BIN_RM, '-vf', " ".join(files)]
+        cmd = [BIN_SUDO, BIN_RM, '-v', " ".join(files)]
         cmdobj = subprocess.Popen(
                 cmd,
                 shell=False,
                 cwd='/',
                 close_fds=True,
-                stdout=sys.stdout,
+                stdout=subprocess.PIPE,
                 stderr=subprocess.STDOUT,
                 env={'':''}
         )
@@ -454,7 +454,7 @@ if __name__ == '__main__':
             logger.debug(_str)
             raise Exception(_str)
 
-        files = [os.path.join('../build-area/',file) for file in fnmatch.filter(os.listdir('../build-area/'),'*.orig.tar.gz')]
+        files = [os.path.join(BUILD_AREA,file) for file in fnmatch.filter(os.listdir(BUILD_AREA),'*.orig.tar.gz')]
         logger.debug('Previous upstream tarball(s) found: %s' %( files ))