From: Benjamin Drung Date: Wed, 8 Oct 2014 13:05:17 +0000 (+0200) Subject: debian_build.py: Drop legacy upload to alexandria.pb.local X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=fee168d5d35045233afc60e166c659d09fe36ccb;p=profitbricks%2Fjenkins-build-scripts.git debian_build.py: Drop legacy upload to alexandria.pb.local --- diff --git a/debian_build.py b/debian_build.py index b33b2b3..16101c7 100755 --- a/debian_build.py +++ b/debian_build.py @@ -23,7 +23,6 @@ from add_liveboot_request import add_liveboot_request from common_code import (figlet, logger_init, exit_ok, exit_error, ENV, BIN_SUDO, BUILD_AREA, BIN_RM, BIN_DCH, BIN_GIT_DCH) from db_add import add_package_instances -from lib import dput from lib import gitpkg from lib import sbuild @@ -304,9 +303,7 @@ def main(): )) exit_error() new_dist = curr_dist - alexandria_dist = 'stable' new_version = curr_version + options.version_suffix + rebuild_suffix - reprepro_base = '/srv/pb-{dist}'.format(dist=curr_dist) apt_target = "repo01-debian" additional_repos = [] @@ -354,7 +351,6 @@ def main(): branch=local_branch, )) exit_error() - alexandria_dist = 'unstable' new_dist = curr_dist + '-dev' if changelog.distributions == "UNRELEASED": pattern = "{debversion}~develop{time:%Y%m%d+%H%M}+{build}+{git-commit}" @@ -362,7 +358,6 @@ def main(): pattern = "{debversion}+develop{time:%Y%m%d+%H%M}+{build}+{git-commit}" pattern = re.sub('{build}', ENV['BUILD_NUMBER'], pattern) + options.version_suffix new_version = version_substitution(logger, pattern, curr_commit, build_start) - reprepro_base = '/srv/pb-{dist}'.format(dist=curr_dist) apt_target = "repo01-debian-dev" additional_repos = [ "deb http://repo.pb.local/pb-debian-dev {dist} main non-free contrib".format( @@ -382,17 +377,12 @@ def main(): exit_error() new_dist = curr_dist + "-" + local_branch.replace("/", "-") - if curr_dist == "wheezy": - alexandria_dist = "wheezy-dev-{0}".format(local_branch.replace("/", "-")) - else: - alexandria_dist = 'dev-{0}'.format(local_branch.replace("/", "-")) if changelog.distributions == "UNRELEASED": pattern = "{debversion}~experimental{time:%Y%m%d+%H%M}+{build}+{git-commit}" else: pattern = "{debversion}+experimental{time:%Y%m%d+%H%M}+{build}+{git-commit}" pattern = re.sub('{build}', ENV['BUILD_NUMBER'], pattern) + options.version_suffix new_version = version_substitution(logger, pattern, curr_commit, build_start) - reprepro_base = '/srv/dev-{dist}'.format(dist=curr_dist) apt_target = "repo01-debian-dev" additional_repos = [ "deb http://repo.pb.local/pb-debian-dev {dist} main non-free contrib".format( @@ -434,21 +424,6 @@ def main(): # curr_commit_hexsha[0:7]) # changelog_distro = 'unstable' - # create dput object with data gathered from reprepro_base defined above - dput_obj = dput.Dput( - config=os.path.join(ENV['WORKSPACE'], '..', 'dput.cf'), - section='profitbricks', - contents={ - 'fqdn': 'alexandria.pb.local', - 'method': 'scp', - 'login': 'reprepro', - 'incoming': reprepro_base + '/incoming/profitbricks', - 'allow_unsigned_uploads': 1, - 'post_upload_command': 'ssh reprepro@alexandria.pb.local ' + reprepro_base + - '/bin/pb_processincoming', - } - ) - # show what we got so far logger.info('Changelog distribution: "{old_dist}" => "{new_dist}"'.format( old_dist=curr_dist, @@ -462,9 +437,6 @@ def main(): logger.info('Tag to create: {tag}'.format( tag=new_tag, )) - logger.info('Upload configuration (for reprepro):\n\n{config}\n'.format( - config=pformat(dput_obj.contents) - )) # # ACT III: do something actually @@ -794,47 +766,17 @@ schroot -e -c session: cause=no_uploads_cause )) else: - try: - # strip epoch - dpkg_build_version = new_version - if ":" in dpkg_build_version: - dpkg_build_version = dpkg_build_version.split(":", 1)[1] - - # construct path for changes file - changes_file = builder.changes_file - - # upload to Debian archive - if not upload_to_apt_repository(apt_target, changes_file, logger): - exit_error() + # strip epoch + dpkg_build_version = new_version + if ":" in dpkg_build_version: + dpkg_build_version = dpkg_build_version.split(":", 1)[1] - # upload changes file - if curr_dist == 'squeeze': - # Legacy support: Upload to alexandria.pb.local - # Change distribution for new apt repository in changes file - cmd = ['sed', r's/^\(Distribution: \).*$/\1' + alexandria_dist + '/', changes_file] - command = ' '.join(cmd) - logger.debug('Executing "{command}" ...'.format(command=command)) - process = subprocess.Popen(cmd, stdout=subprocess.PIPE) - changes = process.communicate()[0] - if process.returncode == 0: - logger.debug('%s succeeded.', command) - - (head, tail) = os.path.splitext(changes_file) - legacy_changes_file = os.path.abspath(head) + '_alexandria' + tail - filehandle = open(legacy_changes_file, 'w') - filehandle.write(changes) - filehandle.close() - - dput_obj.configure() - dput_obj.upload(legacy_changes_file) + # construct path for changes file + changes_file = builder.changes_file - figlet('Legacy upload OK') - else: - logger.warn('%s failed.', command) - figlet('Legacy upload failed') - except Exception as error: - logger.error('Legacy upload failed. See above for details.', exc_info=error) - figlet('Legacy upload failed') + # upload to Debian archive + if not upload_to_apt_repository(apt_target, changes_file, logger): + exit_error() # .. define the time of completion build_end = datetime.datetime.now()