return is_valid
-def version_substitution(logger, pattern, git_commit=None):
+def version_substitution(logger, pattern, git_commit=None, time=None):
"""Return a version string with the pattern substituted.
Following substitution variables are supported:
subst = dict()
if git_commit:
subst['git-commit'] = git_commit.hexsha[0:7]
- subst['time'] = datetime.datetime.utcnow()
+ if time is None:
+ subst['time'] = datetime.datetime.utcnow()
+ else:
+ subst['time'] = time
if os.path.isfile('debian/changelog'):
changelog_file = open('debian/changelog')
changelog = debian.changelog.Changelog(changelog_file, max_blocks=1)
# Act I: prepare variables
# .. command line arguments
# FIXME: not used right now, shall it be used?
- options, args = getopts()
+ options = getopts()[0]
# .. actions, define defaults
do_autoincrement = False
else:
gitrepo.remotes[name].update({git_type: url})
# this would also be helpful, but is not yet included in git lib
- repo_name = re.sub('\.git$', '', gitrepo.remotes['origin']['fetch'].split('/')[-1])
+ repo_name = re.sub(r'\.git$', '', gitrepo.remotes['origin']['fetch'].split('/')[-1])
else:
- repo_name = re.sub('\.git$', '', gitrepo.remotes['origin'].url.split('/')[-1])
+ repo_name = re.sub(r'\.git$', '', gitrepo.remotes['origin'].url.split('/')[-1])
logger.info('Remotes: %s' % gitrepo.remotes)
logger.info('Repository Name: %s' % repo_name)
# .. some local variables
- daily_date = build_start.strftime('%Y%m%d%H%M%S')
local_branch = re.match('^(origin/)?(.*)', ENV['GIT_BRANCH']).groups()[1]
remote_branch = os.path.join('origin', local_branch)
# .. content related
changelog = debian.changelog.Changelog()
changelog.parse_changelog(open('debian/changelog'))
- curr_name = changelog.package
curr_version = changelog.full_version
curr_dist = changelog.distributions
else:
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)
+ 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 = [
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)
+ 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 = [
failed_message = 'package build has failed'
do_cidb = False
no_cidb_cause = failed_message
- do_liveboot = False
+ #do_liveboot = False
no_liveboot_cause = failed_message
do_uploads = False
no_uploads_cause = failed_message
try:
add_liveboot_request(package_instances)
figlet('Liveboot OK')
- except:
+ except Exception:
logger.debug("liveboot request failed")
figlet('Liveboot failed')
exit_error()