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
))
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 = []
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}"
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(
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(
# 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,
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
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()