parser.add_option(
'--distribution',
dest='distribution',
- default='unstable',
+ choices = [
+ 'squeeze',
+ 'wheezy',
+ ],
+ default='squeeze',
help='The pkg distribution. Default: %default'
)
parser.add_option(
# id attribute used in python-git 0.1.6-1 found in squeeze
elif hasattr(curr_commit, 'id'):
curr_commit_id = curr_commit.id
-
-
- # .. dput related (some overrides happening below, though)
- dput_obj = dput.Dput(
- config = os.path.join(ENV['WORKSPACE'], '..', 'dput.cf'),
- section = 'profitbricks',
- contents = {
- 'fqdn': 'alexandria.pb.local',
- 'method': 'scp',
- 'login': 'reprepro',
- 'incoming': '/srv/profitbricks-repository/incoming/profitbricks',
- 'allow_unsigned_uploads': 1,
- 'post_upload_command': 'ssh reprepro@alexandria.pb.local /srv/profitbricks-repository/bin/pb_processincoming',
- }
- )
# Act II: make decissions
+ # compatibility until call_jenkins was replaced
+ if ENV['DISTRIBUTION'] not in ('squeeze','wheezy'):
+ logger.warn('Compatbility Mode: Change distribution {old} => {new}.'.format(
+ old = ENV['DISTRIBUTION'],
+ new = 'squeeze'
+ ))
+ ENV['DISTRIBUTION'] = 'squeeze'
+
if re.match(COMMIT_TRIGGER_BRANCHES_RE, ENV['GIT_BRANCH']):
do_triggers = True
exit_error()
new_dist = 'stable'
new_version = '{version}'.format(version = curr_version)
- pb_suite = 'master-' + ENV['DISTRIBUTION']
+ pb_suite = 'master-' + curr_dist
+ reprepro_base = '/srv/pb-' + curr_dist
+
# replace valid debian version chars that are invalid for git tagging
new_tag = curr_version.replace('~','_')
new_tag = new_tag.replace(':',',')
if ENV['GIT_BRANCH'] in AUTO_CHANGELOG_REPONAMES:
do_autoincrement = True
# reset actions
- if ENV['DISTRIBUTION'] == 'squeeze':
+ if curr_dist == 'squeeze':
# .. always include successful build packages into CIDB
do_cidb = True
do_liveboot_request = True
exit_error()
else:
do_tagging = True
- else:
- # FIXME: tagging, cidb and liveboot makes no sense yet for other dists
- # FIXME: align reprepro to also use naming scheme for squeeze
- dput_obj.contents.update({
- 'incoming': '/srv/profitbricks-repository/incoming/profitbricks-wheezy',
- })
elif re.match(UNSTABLE_BRANCHES_RE, ENV['GIT_BRANCH']):
if not re.match('^ps_.*$', ENV['JOB_NAME']):
build = ENV['BUILD_NUMBER'],
commit = curr_commit_id[0:7],
)
- pb_suite = 'develop-' + ENV['DISTRIBUTION']
+ pb_suite = 'develop-' + curr_dist
+ reprepro_base = '/srv/pb-' + curr_dist
# reset actions
# .. always include successful build packages into CIDB
if ENV['DISTRIBUTION'] == 'squeeze':
do_cidb = True
- else:
- dput_obj.contents.update({
- 'incoming': '/srv/profitbricks-repository/incoming/profitbricks-wheezy',
- })
elif re.match(EXPERIMENTAL_BRANCHES_RE, ENV['GIT_BRANCH']):
if not re.match('^dev_.*$', ENV['JOB_NAME']):
ENV['GIT_BRANCH']
))
exit_error()
+
new_dist = 'dev-' + ENV['GIT_BRANCH'].replace("/","-")
new_version = '{version}~experimental{date}+{build}+{commit}'.format(
version = curr_version,
build = ENV['BUILD_NUMBER'],
commit = curr_commit_id[0:7],
)
- pb_suite = 'experimental-' + ENV['DISTRIBUTION']
- dput_obj.contents.update({
- 'post_upload_command': 'ssh reprepro@alexandria.pb.local /srv/dev-repository/bin/pb_processincoming',
- })
-
- if ENV['DISTRIBUTION'] == 'squeeze':
- dput_obj.contents.update({
- 'incoming': '/srv/dev-repository/incoming/',
- })
- else:
- # reprepro uses dynamic distributions based on the distribution
- # value given in the package. to not interferre with experimental
- # squeeze package, we need to include the distribution here.
- new_dist = 'dev-{branch}-{dist}'.format(
- branch = ENV['GIT_BRANCH'].replace("/","-"),
- dist = ENV['DISTRIBUTION'],
- )
- dput_obj.contents.update({
- 'incoming': '/srv/dev-repository/incoming/wheezy',
- })
+ pb_suite = 'experimental-' + curr_dist
+ reprepro_base = '/srv/dev-' + curr_dist
else:
logger.error('Don\'t know how to handle branch "{branch}".'.format(
# version = '%s~alpha%s+%s+%s' %(version, daily_date, BUILD_NUMBER, curr_commit_id[0:7])
# changelog_distro = 'unstable'
- logger.debug('Distribution: "%s" => "%s"' %(curr_dist,new_dist))
- logger.debug('Version: "%s" => "%s"' %(curr_version,new_version))
+ # 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.debug('Distribution: "%s" => "%s"' %(curr_dist, new_dist))
+ logger.debug('Version: "%s" => "%s"' %(curr_version, new_version))
logger.debug('PB_SUITE: ' + pb_suite)
if do_triggers:
logger.debug('Triggers found: ' + commit_triggers)
logger.info('Delete previous upstream tarball(s)')
cmd = [BIN_SUDO, BIN_RM, '-v'] + files
if subprocess.check_call(cmd):
- logger.info(cmd + ' succeeded.')
+ logger.info('%s succeeded.' % cmd)
else:
- logger.warn(cmd + ' failed.')
+ logger.warn('%s failed.' % cmd)
figlet('Cleanup OK')
# FIXME: ensure this environment variable is available in chroot
# (i.e. sudo)
ENV.update({'DEB_NOTEST':'TRUE'})
-
+
# .. NOW we can verify debian/control contents
for line in fileinput.input('debian/control'):
ret = gbp.build()
# .. remove last commit (the one where we added the changelog entry)
- # FIXME: when 'merge': reset only on original branch?
+ # FIXME: when 'merge': reset only on original branch?
# change checkout back to original branch?
gitrepo.git.reset('--soft', 'HEAD~1')
figlet('Upload skipped')
else:
try:
- dput_obj.configure()
-
# strip epoch
if ":" in new_version:
new_version = new_version.split(":", 1)[1]
fh.close()
# upload changes file
+ dput_obj.configure()
dput_obj.upload(changes_file)
figlet('Upload OK')