From 58ebee8abfbba25a886f0b2f0ea88592c4d3c7f5 Mon Sep 17 00:00:00 2001 From: Robin Wittler Date: Tue, 2 Aug 2011 16:21:20 +0200 Subject: [PATCH] modify --- testgit_build.py | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/testgit_build.py b/testgit_build.py index 22f4731..df92a41 100755 --- a/testgit_build.py +++ b/testgit_build.py @@ -37,8 +37,9 @@ GIT_REPO_PATH = os.environ.get('GIT_REPO_PATH') GIT_REPO_NAME = os.path.basename(GIT_REPO_PATH) GIT_OLD_ID = os.environ.get('GIT_OLD_ID') GIT_NEW_ID = os.environ.get('GIT_NEW_ID') -GIT_BRANCH_NAME = os.environ.get('GIT_UPSTREAM_BRANCH') -GIT_REMOTE_BRANCH_NAME = os.path.join('origin', '%s' %(GIT_BRANCH_NAME)) +GIT_UPSTREAM_BRANCH = os.environ.get('GIT_UPSTREAM_BRANCH') +GIT_DEBIAN_BRANCH = os.environ.get('GIT_DEBIAN_BRANCH') +GIT_DEBIAN_REMOTE_BRANCH = os.path.join('origin', '%s' %(GIT_DEBIAN_BRANCH)) GIT_TARGET_WORKSPACE = os.path.join( CWD, '%s-build%s' %(BUILD_ID, BUILD_NUMBER) @@ -73,9 +74,9 @@ def send_email(result): msg = ( 'From: %s\n' %(SMTP_FROM) + 'To: %s\n' %(GIT_COMMITTER_EMAIL) + - 'Subject: %s\n' %(SMTP_SUBJECT %(GIT_BRANCH_NAME, BUILD_NUMBER, + 'Subject: %s\n' %(SMTP_SUBJECT %(GIT_UPSTREAM_BRANCH, BUILD_NUMBER, result)) + - '%s\n' %(SMTP_TEXT %(GIT_BRANCH_NAME, BUILD_NUMBER, result)) + '%s\n' %(SMTP_TEXT %(GIT_UPSTREAM_BRANCH, BUILD_NUMBER, result)) ) smtp.sendmail(SMTP_FROM, GIT_COMMITTER_EMAIL, msg) smtp.quit() @@ -113,13 +114,9 @@ def git_clone_remote_repository(url, destination): logger.debug('repository %s checked out into %s' %(url, destination)) return True -def git_checkout_branch(): - cmd = [GIT, 'checkout', '-b', GIT_BRANCH_NAME, GIT_REMOTE_BRANCH_NAME] - - logger.debug('This is GIT_TARGET_DIR: %s' %(GIT_TARGET_DIR)) - logger.debug('This is GIT_BRANCH_NAME: %s' %(GIT_BRANCH_NAME)) - logger.debug('This is GIT_REMOTE_BRANCH_NAME: %s' - %(GIT_REMOTE_BRANCH_NAME)) +def git_checkout_debian_branch(): + cmd = [GIT, 'checkout', '-b', GIT_DEBIAN_BRANCH, GIT_DEBIAN_REMOTE_BRANCH] + cmdobj = subprocess.Popen( cmd, shell=False, @@ -136,7 +133,7 @@ def git_checkout_branch(): ) logger.debug( - 'calling »%s« for checkout' %(' '.join(cmd)) + 'calling "%s" for checkout' %(' '.join(cmd)) ) ret = cmdobj.wait() @@ -145,7 +142,7 @@ def git_checkout_branch(): logger.error('Error was: %s' %(cmdobj.stderr.readlines())) return False logger.info( - 'local branch %s successfully checked out.' %(GIT_BRANCH_NAME) + 'local branch %s successfully checked out.' %(GIT_DEBIAN_BRANCH) ) return True @@ -184,10 +181,8 @@ if __name__ == '__main__': logger.info('git clone was not successfull') exit_error() atexit.register(remove_git_target_workspace) - if not git_checkout_branch(): - sys.exit(1) - logger.debug('changing dir to %s' %(GIT_TARGET_DIR)) os.chdir(GIT_TARGET_DIR) + logger.info('Directory Listing: %s' %(os.listdir(GIT_TARGET_DIR))) #ftp = FTP( # 'alexandria.profitbricks.localdomain', -- 2.39.5