From: Mathias Klette Date: Wed, 16 May 2012 16:22:33 +0000 (+0200) Subject: beautify X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=62e4820e1cf4cb5059f2fc11c1f9da0237ee1309;p=profitbricks%2Fjenkins-build-scripts.git beautify --- diff --git a/debian_build.py b/debian_build.py index b0acaab..1175995 100755 --- a/debian_build.py +++ b/debian_build.py @@ -258,15 +258,60 @@ if __name__ == '__main__': try: logger.debug('Reset and clean repository first:') gitcmd = git.Git('.') - logger.debug('%s' %(gitcmd.reset('--hard','HEAD'))) - logger.debug('%s' %(gitcmd.clean('-fdx'))) - logger.debug('%s' %(gitcmd.branch('-D','%s' %(localname)))) - logger.debug('%s' %(gitcmd.checkout('-b','%s' %(localname),'%s' %(remotename)))) + logger.debug( + 'git reset --hard HEAD:\n%s' + %(gitcmd.reset('--hard','HEAD')) + ) + logger.debug( + 'git clean -fdx:\n%s' + %(gitcmd.clean('-fdx')) + ) + logger.debug( + 'git branch -D %s\n%s' + %(localname,gitcmd.branch('-D','%s' %(localname))) + ) + logger.debug( + 'git checkout -b %s %s %s' + %( + localname, + remotename, + gitcmd.checkout('-b','%s' %(localname),'%s' %(remotename)) + ) + ) except Exception, exception: raise Exception('Failure while managing Git clone:\n%s' %(exception)) else: logger.debug('Status is now:\n%s' %( gitcmd.status() )) + # 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 len(files) > 0: + logger.debug('Previous upstream tarball(s) found: %s' %( files )) + cmd = [BIN_SUDO, BIN_RM, '-v', " ".join(files)] + cmdobj = subprocess.Popen( + cmd, + shell=False, + cwd='/', + close_fds=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env={'':''} + ) + + logger.debug('Calling "%s":' %(' '.join(cmd))) + ret = cmdobj.wait() + for line in cmdobj.stdout.readlines(): + logger.debug('%s' %(line)) + + if ret: + _str = ( + 'Cmd "%s" returned non-zero (exitcode: %s).' + %(' '.join(cmd), ret) + ) + logger.debug(_str) + raise Exception(_str) + ## #if GIT_BRANCH_NAME != 'master': ## if not git_helper.git_new_branch_from(localname,remotename): ## raise Exception('Checkout of %s was not successfull.' %( remotename )) @@ -439,35 +484,6 @@ if __name__ == '__main__': else: 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 len(files) > 0: - logger.debug('Previous upstream tarball(s) found: %s' %( files )) - cmd = [BIN_SUDO, BIN_RM, '-v', " ".join(files)] - cmdobj = subprocess.Popen( - cmd, - shell=False, - cwd='/', - close_fds=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - env={'':''} - ) - - logger.debug('Calling "%s" ..' %(' '.join(cmd))) - ret = cmdobj.wait() - for line in cmdobj.stdout.readlines(): - logger.debug('%s' %(line)) - - 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)]