add check for hotfix branch names (#43310)

This commit is contained in:
Frédéric Péters 2020-05-26 11:14:29 +02:00
parent e00aabb831
commit fbbeb6dfbd
1 changed files with 7 additions and 0 deletions

View File

@ -146,6 +146,8 @@ def prepare_build(dist, project, cmd_options, new):
package['repository'] = settings.HOTFIX_REPOSITORIES[dist]
os.chdir(project['git_path'])
build_branch = cmd_options.branch
if cmd_options.hotfix and not build_branch.startswith('hotfix/'):
return error("Invalid name for hotfix branch (must start with hotfix/)", exit_code=2)
debian_folder = cmd_options.debian_folder
if os.path.isdir('debian-' + dist) and debian_folder == 'debian':
debian_folder = 'debian-' + dist
@ -267,6 +269,11 @@ def prepare_build(dist, project, cmd_options, new):
debian_changelog))
good_changelog_contents = open(debian_changelog).read()
if cmd_options.hotfix:
version_part = build_branch.split('/', 1)[1].lstrip('v')
if not project['version'].startswith(version_part):
return error("Invalid name for hotfix branch (must start with version number)", exit_code=2)
build_file = os.path.join(project['lock_path'],
"%s_%s_%s_%s.build" % (project['name'],
package['version'],