From: Mathias Klette Date: Wed, 16 May 2012 15:33:10 +0000 (+0200) Subject: add git clean X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=f0c45a18f5426413a43d64adbdb3d7ffd40cf11f;p=profitbricks%2Fjenkins-build-scripts.git add git clean --- diff --git a/debian_build.py b/debian_build.py index d204a6a..7abf12c 100755 --- a/debian_build.py +++ b/debian_build.py @@ -253,17 +253,21 @@ if __name__ == '__main__': repo = git.repo.Repo() # reset local repository first + logger.debug('Reset and clean repository to HEAD first.') gitcmd = git.Git('.') - gitcmd.reset('HEAD') + logger.debug('%s' %(gitcmd.reset('--hard','HEAD'))) + logger.debug('%s' %(gitcmd.clean('-fdx'))) #if GIT_BRANCH_NAME != 'master': localname = GIT_BRANCH_NAME - remotename = os.path.join('origin', GIT_BRANCH_NAME) + remotename = os.path.join('origin', GIT_BRANCH_NAME) if not git_helper.git_new_branch_from(localname,remotename): raise Exception('Checkout of %s was not successfull.' %( remotename )) + else: + logger.debug('Status is now:\n%s' %( gitcmd.status() )) - # we need to make sure our jenkins config is used, so let's delete any - # other config available in repository that might be prefered + # we need to make sure our jenkins config is used, so let's delete any + # other config available in repository that might be prefered #cleanup_files = ('.gbp.conf', 'debian/gbp.conf', '.git/gbp.conf') #result = git_helper.git_cleanup_branch(cleanup_files) #commit_files = result["goods"].keys() @@ -335,7 +339,7 @@ if __name__ == '__main__': if (GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix/')) and not distribution in allowed_production_distros: logger_error('Distribution %s in debian/changelog not listed in %s' % allowed_production_distros ) raise Exception( - 'Distribution %s in debian/changelog not listed in %s' % allowed_production_distros + 'Distribution %s in debian/changelog not listed in %s' % allowed_production_distros ) exit_error() @@ -445,7 +449,7 @@ if __name__ == '__main__': stderr=subprocess.STDOUT, env={'':''} ) - + logger.debug('Calling "%s" ..' %(' '.join(cmd))) ret = cmdobj.wait() for line in cmdobj.stdout.readlines():