From: Holger Levsen Date: Wed, 9 Nov 2011 14:42:30 +0000 (+0100) Subject: trim of unless/wrong functionality, for now just comment it out X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=e9929831de1924fbf0aac0f9fce0bdb9296e719d;p=profitbricks%2Fjenkins-build-scripts.git trim of unless/wrong functionality, for now just comment it out --- diff --git a/debian_build.py b/debian_build.py index e1e595a..b45f41a 100755 --- a/debian_build.py +++ b/debian_build.py @@ -47,23 +47,18 @@ BUILD_NUMBER = os.environ.get('BUILD_NUMBER') BUILD_ID = os.environ.get('BUILD_ID') BUILD_URL = os.environ.get('BUILD_URL') -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_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_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_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)) ) -#if GIT_UPSTREAM_BRANCH == 'NONE': -# raise Exception('You must give a GIT_UPSTREAM_BRANCH') -# -#if GIT_DEBIAN_BRANCH == 'NONE': -# GIT_DEBIAN_BRANCH = GIT_UPSTREAM_BRANCH GIT_TARGET_DIR = os.path.join( GIT_TARGET_WORKSPACE, @@ -234,69 +229,69 @@ if __name__ == '__main__': ) logging.getLogger('lib.git_helper').setLevel(logging.DEBUG) options, args = getopts() - if git_helper.git_clone_remote_repository(GIT_REPO_PATH, GIT_TARGET_DIR): - logger.info('git clone was successfull') - else: - logger_loud_error('git clone was not successfull') - exit_error() + #if git_helper.git_clone_remote_repository(GIT_REPO_PATH, GIT_TARGET_DIR): + # logger.info('git clone was successfull') + #else: + # logger_loud_error('git clone was not successfull') + # exit_error() - atexit.register(remove_git_target_workspace) + #atexit.register(remove_git_target_workspace) os.chdir(GIT_TARGET_DIR) - if not GIT_DEBIAN_BRANCH: - if GIT_UPSTREAM_BRANCH: - GIT_DEBIAN_BRANCH = GIT_UPSTREAM_BRANCH - logging.debug( - 'setting GIT_DEBIAN_BRANCH to %s', - GIT_UPSTREAM_BRANCH - ) - else: - logger_loud_error('Could not determine GIT_DEBIAN_BRANCH') - exit_error() - elif not GIT_UPSTREAM_BRANCH: - if GIT_DEBIAN_BRANCH: - GIT_UPSTREAM_BRANCH = GIT_DEBIAN_BRANCH - logging.debug( - 'setting GIT_UPSTREAM_BRANCH to %s', - GIT_UPSTREAM_BRANCH - ) - else: - logger_loud_error('Could not determine GIT_UPSTREAM_BRANCH') - exit_error() - - repo = git.repo.Repo() - - if GIT_DEBIAN_BRANCH != 'master': - git_helper.git_new_branch_from( - GIT_DEBIAN_BRANCH, - os.path.join('origin', GIT_DEBIAN_BRANCH) - ) + #if not GIT_DEBIAN_BRANCH: + # if GIT_UPSTREAM_BRANCH: + # GIT_DEBIAN_BRANCH = GIT_UPSTREAM_BRANCH + # logging.debug( + # 'setting GIT_DEBIAN_BRANCH to %s', + # GIT_UPSTREAM_BRANCH + # ) + # else: + # logger_loud_error('Could not determine GIT_DEBIAN_BRANCH') + # exit_error() + #elif not GIT_UPSTREAM_BRANCH: + # if GIT_DEBIAN_BRANCH: + # GIT_UPSTREAM_BRANCH = GIT_DEBIAN_BRANCH + # logging.debug( + # 'setting GIT_UPSTREAM_BRANCH to %s', + # GIT_UPSTREAM_BRANCH + # ) + # else: + # logger_loud_error('Could not determine GIT_UPSTREAM_BRANCH') + # exit_error() + ## + #repo = git.repo.Repo() + # + #if GIT_DEBIAN_BRANCH != 'master': + # git_helper.git_new_branch_from( + # GIT_DEBIAN_BRANCH, + # os.path.join('origin', GIT_DEBIAN_BRANCH) + # ) # git-buildpackage uses only treeish object in v0.5.10, so let's fetch the # treeish refspec when a name was given (i.e. tag names, branch names, # etc.) # TODO: upgrade git-buildpackage - GIT_UPSTREAM_BRANCH = git_helper.git_get_treeish( - os.path.join('origin', GIT_UPSTREAM_BRANCH) - ) + #GIT_UPSTREAM_BRANCH = git_helper.git_get_treeish( + # os.path.join('origin', GIT_UPSTREAM_BRANCH) + #) # now checkout the requested branch - if git_helper.git_checkout_branch(GIT_UPSTREAM_BRANCH): - logger.info('git checkout %s was successfull' % GIT_UPSTREAM_BRANCH) - else: - logger_loud_error('git checkout %s was not successfull' % GIT_UPSTREAM_BRANCH) - exit_error() + #if git_helper.git_checkout_branch(GIT_UPSTREAM_BRANCH): + # logger.info('git checkout %s was successfull' % GIT_UPSTREAM_BRANCH) + #else: + # logger_loud_error('git checkout %s was not successfull' % GIT_UPSTREAM_BRANCH) + # exit_error() # 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() - if len(commit_files) > 0: - git_helper.git_commit( - "Cleanup branch for correct builds.", - commit_files - ) + #cleanup_files = ('.gbp.conf', 'debian/gbp.conf', '.git/gbp.conf') + #result = git_helper.git_cleanup_branch(cleanup_files) + #commit_files = result["goods"].keys() + #if len(commit_files) > 0: + # git_helper.git_commit( + # "Cleanup branch for correct builds.", + # commit_files + # ) cmd = ['dpkg-parsechangelog'] parse_changelog = subprocess.Popen( @@ -362,6 +357,7 @@ if __name__ == '__main__': else: version = '%s~develop%s' %(version, daily_date) + # FIXME: check this is still correct new_log = 'Generated by jenkins build of %s' % git_helper.git_get_commit_id() cmd = [ @@ -406,21 +402,21 @@ if __name__ == '__main__': # we need to commit here else git-buildpackage will use the existing debian/changelog... # TODO: Later we should investigate why the "--ignore-new" trick # did not work! - cmd = ['/usr/bin/git', 'add', '-A'] - subprocess.check_call(cmd) - cmd = ['/usr/bin/git', 'commit', '-a', '-m', 'add new changelog entry'] - subprocess.check_call(cmd) + #cmd = ['/usr/bin/git', 'add', '-A'] + #subprocess.check_call(cmd) + #cmd = ['/usr/bin/git', 'commit', '-a', '-m', 'add new changelog entry'] + #subprocess.check_call(cmd) if not GIT_COMMITTER_EMAIL: - for commit in repo.commits(): - if commit.id == GIT_NEW_ID: - GIT_COMMITTER_EMAIL = commit.committer.email - logger.debug( - 'Found "%s" in commit-id "%s" at "%s"' - %(GIT_COMMITTER_EMAIL, commit.id, repo.active_branch) - ) - else: - raise Exception('No git_committer_email found') + #for commit in repo.commits(): + # if commit.id == GIT_NEW_ID: + # GIT_COMMITTER_EMAIL = commit.committer.email + # logger.debug( + # 'Found "%s" in commit-id "%s" at "%s"' + # %(GIT_COMMITTER_EMAIL, commit.id, repo.active_branch) + # ) + #else: + raise Exception('No git_committer_email found') if options.distribution in ('unstable' , 'experimental', 'pre-staging'): pb_suite='pre-staging' @@ -429,16 +425,17 @@ if __name__ == '__main__': elif options.distribution in ('stable', 'stable-proposed-updates', 'production', 'production-proposed-updates'): pb_suite='production-proposed-updates' - gbp = git_buildpackage.GitBuildPackage( - upstream_branch=GIT_UPSTREAM_BRANCH, - debian_branch=GIT_DEBIAN_BRANCH, - dist='squeeze', - arch='amd64', - pb_suite=pb_suite - ) - - logger.info('starting git-buildpackage') - ret = gbp.build() + #gbp = git_buildpackage.GitBuildPackage( + # upstream_branch=GIT_UPSTREAM_BRANCH, + # debian_branch=GIT_DEBIAN_BRANCH, + # dist='squeeze', + # arch='amd64', + # pb_suite=pb_suite + #) + + logger.info('used to start git-buildpackage here...') + #ret = gbp.build() + ret = 0 if ret: logger_loud_error( 'git-buildpackage returned non-zero. exitcode was: %s' % ret