1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-12 16:56:15 +01:00

Add 'repository' and 'dest_repository' args to format_msg_project_package_options()

This commit is contained in:
Daniel Mach 2022-11-10 10:22:16 +01:00
parent 37a34e58d4
commit 56bb193b4e

View File

@ -15,7 +15,16 @@ def print_msg(msg, print_to="debug"):
raise ValueError(f"Invalid value of the 'output' option: {output}")
def format_msg_project_package_options(msg, project=None, package=None, dest_project=None, dest_package=None, **options):
def format_msg_project_package_options(
msg,
project=None,
package=None,
dest_project=None,
dest_package=None,
repository=None,
dest_repository=None,
**options,
):
"""
Format msg, project, package, dest_project, dest_package and options into a meaningful message
that can be printed out directly or as a debug message.
@ -25,10 +34,19 @@ def format_msg_project_package_options(msg, project=None, package=None, dest_pro
else:
msg += f" package '{project}/{package}'"
if repository:
msg += f" repository '{repository}'"
if any([dest_project, dest_package, dest_repository]):
msg += " to"
if dest_project and not dest_package:
msg += f" to project '{dest_project}'"
msg += f" project '{dest_project}'"
elif dest_project and dest_package:
msg += f" to package '{dest_project}/{dest_package}'"
msg += f" package '{dest_project}/{dest_package}'"
if dest_repository:
msg += f" repository '{dest_repository}'"
msg_options = [key.replace("_", "-") for key, value in options.items() if value]
if msg_options: