return parser.parse_args()
-def upload_to_apt_repository(apt_target, apt_dist, changes_file, logger):
+def upload_to_apt_repository(apt_target, changes_file, logger):
try:
- # Change distribution for new apt repository in changes file
- cmd = ['sed', r's/^\(Distribution: \).*$/\1' + apt_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)
- else:
- logger.warn('%s failed.' % command)
- figlet('repo01 upload failed')
- return False
- (head, tail) = os.path.splitext(changes_file)
- new_changes_file = head + '_repo01' + tail
- filehandle = open(new_changes_file, 'w')
- filehandle.write(changes)
- filehandle.close()
-
- cmd = ['dput', apt_target, new_changes_file]
+ cmd = ['dput', apt_target, changes_file]
command = ' '.join(cmd)
logger.debug('Executing "{command}" ...'.format(command=command))
success = subprocess.call(cmd) == 0
if success:
logger.debug('%s succeeded.' % command)
- figlet('repo01 upload OK')
+ figlet('Upload OK')
else:
logger.warn('%s failed.' % command)
- figlet('repo01 upload failed')
+ figlet('Upload failed')
except Exception as error:
logger.warning("Upload to http://repo.pb.local failed. "
"See above for details.", exc_info=error)
- figlet('repo01 upload failed')
+ figlet('Upload failed')
success = False
return success
# Act II: make decissions
# compatibility until call_jenkins was replaced
- if curr_dist not in ('squeeze', 'wheezy'):
+ if curr_dist not in ('squeeze', 'wheezy', 'jessie'):
logger.warn('Compatibility Mode: Change distribution {old} => {new}.'.format(
old=curr_dist,
new='squeeze'
branch=local_branch,
))
exit_error()
- new_dist = 'stable'
+ new_dist = curr_dist
+ alexandria_dist = 'stable'
new_version = curr_version + options.version_suffix
pb_suite = 'master-{dist}'.format(dist=curr_dist)
reprepro_base = '/srv/pb-{dist}'.format(dist=curr_dist)
- apt_dist = curr_dist
apt_target = "repo01-debian"
# replace valid debian version chars that are invalid for git tagging
branch=local_branch,
))
exit_error()
- new_dist = 'unstable'
+ alexandria_dist = 'unstable'
+ new_dist = curr_dist + '-dev'
if cl.distributions == "UNRELEASED":
pattern = "{debversion}~develop{time:%Y%m%d+%H%M}+{build}+{git-commit}"
else:
new_version = version_substitution(logger, pattern, curr_commit)
pb_suite = 'develop-{dist}'.format(dist=curr_dist)
reprepro_base = '/srv/pb-{dist}'.format(dist=curr_dist)
- apt_dist = curr_dist + '-dev'
apt_target = "repo01-debian-dev"
# reset actions
# .. always include successful build packages into CIDB
))
exit_error()
+ new_dist = curr_dist + "-" + local_branch.replace("/", "-")
if curr_dist == "wheezy":
- new_dist = "wheezy-dev-{0}".format(local_branch.replace("/", "-"))
- pb_suite = new_dist
+ alexandria_dist = "wheezy-dev-{0}".format(local_branch.replace("/", "-"))
+ pb_suite = alexandria_dist
else:
- new_dist = 'dev-{0}'.format(local_branch.replace("/", "-"))
- pb_suite = new_dist
+ alexandria_dist = 'dev-{0}'.format(local_branch.replace("/", "-"))
+ pb_suite = alexandria_dist
if cl.distributions == "UNRELEASED":
pattern = "{debversion}~experimental{time:%Y%m%d+%H%M}+{build}+{git-commit}"
else:
pattern = re.sub('{build}', ENV['BUILD_NUMBER'], pattern) + options.version_suffix
new_version = version_substitution(logger, pattern, curr_commit)
reprepro_base = '/srv/dev-{dist}'.format(dist=curr_dist)
- apt_dist = curr_dist + "-" + local_branch.replace("/", "-")
apt_target = "repo01-debian-dev"
else:
))
fh.close()
- # upload to new repo01 archive
- if not upload_to_apt_repository(apt_target, apt_dist, changes_file, logger):
+ # upload to Debian archive
+ if not upload_to_apt_repository(apt_target, changes_file, logger):
exit_error()
# upload changes file
- dput_obj.configure()
- dput_obj.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)
+ else:
+ logger.warn('%s failed.' % command)
+ figlet('Legacy upload failed')
+ exit_error()
+ (head, tail) = os.path.splitext(changes_file)
+ legacy_changes_file = head + '_alexandria' + tail
+ filehandle = open(legacy_changes_file, 'w')
+ filehandle.write(changes)
+ filehandle.close()
- figlet('Upload OK')
+ dput_obj.configure()
+ dput_obj.upload(legacy_changes_file)
+
+ figlet('Legacy upload OK')
except Exception as error:
logger.error('Upload failed. See above for details.', exc_info=error)