'production-proposed-updates'
)
STABLE_BRANCHES_RE = re.compile(
- '^(master|hotfix/.*)$')
+ '^(origin/)?(master|hotfix/.*)$')
DEVELOP_BRANCHES_RE = re.compile(
- '^(develop|pre-staging|release/.*)$')
+ '^(origin/)?(develop|pre-staging|release/.*)$')
EXPERIMENTAL_BRANCHES_RE = re.compile(
- '^(experimental|(feature|poc|bugfix)/.*)$')
+ '^(origin/)?(experimental|(feature|poc|bugfix)/.*)$')
def getopts():
usage = '%prog [options]'
# .. repository related
curr_commit = ENV['GIT_COMMIT']
gitrepo = git.Repo('.')
- local_branch = ENV['GIT_BRANCH']
- remote_branch = os.path.join('origin', ENV['GIT_BRANCH'])
+ local_branch = re.match('^(origin/)?(.*)',ENV['GIT_BRANCH']).groups()[1]
+ remote_branch = os.path.join('origin', local_branch)
reports_file = os.path.join(ENV['WORKSPACE'], '../build-area/result/reports.tgz',)
# .. dput related (some overrides happening below, though)
do_autoincrement = True
# .. fail if we already found the tag we would create upon a successfull build,
# except, the existing tag uses the same commit as we were triggered with
- remote_tag = [tag for tag in gitrepo.tags if tag.name == version_tag]
+ remote_tag = [tag for tag in gitrepo.tags if tag.name == new_tag]
if len(remote_tag) > 0:
if remote_tag[0].commit.id == curr_commit:
logger.info('Tag was already created for this commit.')
pb_suite = new_dist
- # ACT III: actually do something
+ # ACT III: do something actually
# .. do some housekeeping first
if not do_cleanup:
figlet('Cleanup skipped')
)]
if len(files) > 0:
- logger.info('Delete previous upstream tarball(s)')
+ logger.debug('Delete previous upstream tarball(s)')
cmd = [BIN_SUDO, BIN_RM, '-v']
cmd.extend(files)
ret = subprocess.Popen(
cmd = cmd,
exitcode = ret
))
+ figlet('Cleanup OK')
# .. update changelog if we trust the package
if do_autoincrement:
),
]
+ logger.debug('Executing "%s" ...' %(' '.join(cmd)))
dch = subprocess.Popen(
cmd,
shell=False,
gitrepo.git.commit('-a', '-m', 'add new changelog entry')
if ret:
- logger.debug('"{cmd}" returns {exitcode}.'.format(
- cmd = cmd,
- exitcode = ret
- ))
- raise Exception('Failed to update changelog.')
+ raise Exception(
+ '"%s" returned with exitcode: %s' %(' '.join(cmd), ret))
# let me see the first two changelog entries:
- # TODO: use changelog python libs instead of DCH calls, see above
- cl = changelog.Changelog()
- cl.parse_changelog(open('debian/changelog'))
- logger.info('New changelog:\n\n%s' %(
- ''.join([block.__str__() for block in cl._blocks[0:2]])))
-
+ line_counter = 0
+ for line in fileinput.input('debian/changelog'):
+ if line.startswith(' --'):
+ line_counter += 1
+ if line_counter <= 2:
+ print('debian/changelog: %s' %(line.rstrip('\n')))
+
+
# ACT IV: preparations are set, let's build
gbp = git_buildpackage.GitBuildPackage(
upstream_branch = ENV['GIT_BRANCH'],