From: Benjamin Drung Date: Tue, 26 Aug 2014 09:19:38 +0000 (+0200) Subject: debian_build.py: Add support for rebuilds via REBUILD_DIST. X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=319522114c65aa8213d61733b92324162bae11ae;p=profitbricks%2Fjenkins-build-scripts.git debian_build.py: Add support for rebuilds via REBUILD_DIST. --- diff --git a/debian_build.py b/debian_build.py index 7e26cdd..f1828e5 100755 --- a/debian_build.py +++ b/debian_build.py @@ -35,6 +35,7 @@ logger = logger_init(re.match('^(.*/jenkins_build_script/)(.*)', __file__).group ENV.setdefault('NO_UPLOAD', '') ENV.setdefault('BUILD_TRIGGERS', '') ENV.setdefault('VERSION_SUFFIX', '') +ENV.setdefault('REBUILD_DIST', '') ENV.setdefault('GIT_BRANCH_NAME', ENV['GIT_BRANCH']) if ENV['GIT_BRANCH'] != ENV['GIT_BRANCH_NAME']: ENV['GIT_BRANCH'] = ENV['GIT_BRANCH_NAME'] @@ -44,6 +45,14 @@ if ENV['GIT_BRANCH'] != ENV['GIT_BRANCH_NAME']: # local constants BUILD_START = datetime.datetime.now() +SUPPORTED_DISTRIBUTIONS = ('squeeze', 'wheezy', 'jessie') + +DISTRO_SUFFIX = { + 'squeeze': '~deb6', + 'wheezy': '~deb7', + 'jessie': '~deb8', +} + AUTO_CHANGELOG_REPONAMES = ( 'so-docs', 'infrastructure-docs', @@ -271,8 +280,21 @@ if __name__ == '__main__': break # Act II: make decissions + # change the distribution if REBUILD_DIST is set in the environment + rebuild_suffix = '' + if ENV['REBUILD_DIST'] in SUPPORTED_DISTRIBUTIONS: + logger.info('REBUILD_DIST is set. Change distribution {old} => {new}.' + .format(old=curr_dist, new=ENV['REBUILD_DIST'])) + curr_dist = ENV['REBUILD_DIST'] + rebuild_suffix = DISTRO_SUFFIX[ENV['REBUILD_DIST']] + elif ENV['REBUILD_DIST']: + logger.warn('REBUILD_DIST {dist} not supported. Please select from: {supported}'.format( + dist=ENV['REBUILD_DIST'], + supported=", ".join(SUPPORTED_DISTRIBUTIONS) + )) + # compatibility until call_jenkins was replaced - if curr_dist not in ('squeeze', 'wheezy', 'jessie'): + if curr_dist not in SUPPORTED_DISTRIBUTIONS: logger.warn('Compatibility Mode: Change distribution {old} => {new}.'.format( old=curr_dist, new='squeeze' @@ -287,7 +309,7 @@ if __name__ == '__main__': exit_error() new_dist = curr_dist alexandria_dist = 'stable' - new_version = curr_version + options.version_suffix + new_version = curr_version + options.version_suffix + rebuild_suffix reprepro_base = '/srv/pb-{dist}'.format(dist=curr_dist) apt_target = "repo01-debian" additional_repos = []