From: Mathias Klette Date: Tue, 15 May 2012 17:08:03 +0000 (+0200) Subject: DEVINF-84: pre-remove existing orig.tar.gz on every build X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=e98da812943c68bb766a41efa2e61090b3f3dfe4;p=profitbricks%2Fjenkins-build-scripts.git DEVINF-84: pre-remove existing orig.tar.gz on every build --- diff --git a/debian_build.py b/debian_build.py index 8979b8b..4798f24 100755 --- a/debian_build.py +++ b/debian_build.py @@ -9,6 +9,7 @@ import git import errno import atexit import shutil +import fnmatch import logging import optparse import datetime @@ -425,6 +426,33 @@ if __name__ == '__main__': else: raise Exception('unhandled branch, failing.') + # cleanup existing *orig.tar.gz + cmd = [BIN_SUDO, BIN_RM, '-f', fnmatch.filter(os.listdir('../build-area/'),'*.orig.tar.gz')] + cmdobj = subprocess.Popen( + cmd, + shell=False, + cwd='/', + close_fds=True, + stdout=sys.stdout, + stderr=sys.stderr, + env={'':''} + ) + + logger.debug( + 'Trying to call "%s" + %(' '.join(cmd)) + ) + + ret = cmdobj.wait() + if ret: + _str = ( + 'Cmd "%s" returned non-zero (exitcode: %s).' + %(' '.join(cmd), ret) + ) + logger.debug(_str) + raise Exception(_str) + + logger.info('dist: %s' %(pb_suite)) cmd = ['figlet-figlet', '-t', 'dist: %s' %(pb_suite)] subprocess.check_call(cmd)