1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-21 05:58:52 +02:00

Add 'dest_project' and 'dest_package' args to format_msg_project_package_options()

This commit is contained in:
2022-11-07 16:18:52 +01:00
parent 6394867952
commit c6b30e500f
9 changed files with 28 additions and 24 deletions

View File

@@ -12,7 +12,7 @@ Scenario: Run `osc addchannels`
When I execute osc with args "addchannels" When I execute osc with args "addchannels"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' package: 'test-pkgA' Adding channels to package 'test:factory/test-pkgA'
""" """
@@ -20,7 +20,7 @@ Scenario: Run `osc addchannels --enable-all`
When I execute osc with args "addchannels --enable-all" When I execute osc with args "addchannels --enable-all"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' package: 'test-pkgA' options: enable-all Adding channels to package 'test:factory/test-pkgA' options: enable-all
""" """
@@ -28,5 +28,5 @@ Scenario: Run `osc addchannels --skip-disabled`
When I execute osc with args "addchannels --skip-disabled" When I execute osc with args "addchannels --skip-disabled"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' package: 'test-pkgA' options: skip-disabled Adding channels to package 'test:factory/test-pkgA' options: skip-disabled
""" """

View File

@@ -12,7 +12,7 @@ Scenario: Run `osc addchannels`
When I execute osc with args "addchannels" When I execute osc with args "addchannels"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' Adding channels to project 'test:factory'
""" """
@@ -20,7 +20,7 @@ Scenario: Run `osc addchannels --enable-all`
When I execute osc with args "addchannels --enable-all" When I execute osc with args "addchannels --enable-all"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' options: enable-all Adding channels to project 'test:factory' options: enable-all
""" """
@@ -28,5 +28,5 @@ Scenario: Run `osc addchannels --skip-disabled`
When I execute osc with args "addchannels --skip-disabled" When I execute osc with args "addchannels --skip-disabled"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' options: skip-disabled Adding channels to project 'test:factory' options: skip-disabled
""" """

View File

@@ -10,7 +10,7 @@ Scenario: Run `osc addchannels <project> <package>`
When I execute osc with args "addchannels test:factory test-pkgA" When I execute osc with args "addchannels test:factory test-pkgA"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' package: 'test-pkgA' Adding channels to package 'test:factory/test-pkgA'
""" """
@@ -18,7 +18,7 @@ Scenario: Run `osc addchannels <project>/<package>`
When I execute osc with args "addchannels test:factory/test-pkgA" When I execute osc with args "addchannels test:factory/test-pkgA"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' package: 'test-pkgA' Adding channels to package 'test:factory/test-pkgA'
""" """
@@ -26,7 +26,7 @@ Scenario: Run `osc addchannels <project> <package> --enable-all`
When I execute osc with args "addchannels test:factory test-pkgA --enable-all" When I execute osc with args "addchannels test:factory test-pkgA --enable-all"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' package: 'test-pkgA' options: enable-all Adding channels to package 'test:factory/test-pkgA' options: enable-all
""" """
@@ -34,5 +34,5 @@ Scenario: Run `osc addchannels <project> <package> --skip-disabled`
When I execute osc with args "addchannels test:factory test-pkgA --skip-disabled" When I execute osc with args "addchannels test:factory test-pkgA --skip-disabled"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' package: 'test-pkgA' options: skip-disabled Adding channels to package 'test:factory/test-pkgA' options: skip-disabled
""" """

View File

@@ -10,7 +10,7 @@ Scenario: Run `osc addchannels <project>`
When I execute osc with args "addchannels test:factory" When I execute osc with args "addchannels test:factory"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' Adding channels to project 'test:factory'
""" """
@@ -18,7 +18,7 @@ Scenario: Run `osc addchannels <project> --enable-all`
When I execute osc with args "addchannels test:factory --enable-all" When I execute osc with args "addchannels test:factory --enable-all"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' options: enable-all Adding channels to project 'test:factory' options: enable-all
""" """
@@ -26,6 +26,6 @@ Scenario: Run `osc addchannels <project> --skip-disabled`
When I execute osc with args "addchannels test:factory --skip-disabled" When I execute osc with args "addchannels test:factory --skip-disabled"
Then stdout is Then stdout is
""" """
Adding channels to project: 'test:factory' options: skip-disabled Adding channels to project 'test:factory' options: skip-disabled
""" """

View File

@@ -12,5 +12,5 @@ Scenario: Run `osc enablechannels`
When I execute osc with args "enablechannels" When I execute osc with args "enablechannels"
Then stdout is Then stdout is
""" """
Enabling channels in project: 'test:factory' package: 'test-pkgA' Enabling channels in package 'test:factory/test-pkgA'
""" """

View File

@@ -12,5 +12,5 @@ Scenario: Run `osc enablechannels`
When I execute osc with args "enablechannels" When I execute osc with args "enablechannels"
Then stdout is Then stdout is
""" """
Enabling channels in project: 'test:factory' Enabling channels in project 'test:factory'
""" """

View File

@@ -10,7 +10,7 @@ Scenario: Run `osc enablechannels <project> <package>`
When I execute osc with args "enablechannels test:factory test-pkgA" When I execute osc with args "enablechannels test:factory test-pkgA"
Then stdout is Then stdout is
""" """
Enabling channels in project: 'test:factory' package: 'test-pkgA' Enabling channels in package 'test:factory/test-pkgA'
""" """
@@ -18,5 +18,5 @@ Scenario: Run `osc enablechannels <project>/<package>`
When I execute osc with args "enablechannels test:factory/test-pkgA" When I execute osc with args "enablechannels test:factory/test-pkgA"
Then stdout is Then stdout is
""" """
Enabling channels in project: 'test:factory' package: 'test-pkgA' Enabling channels in package 'test:factory/test-pkgA'
""" """

View File

@@ -10,5 +10,5 @@ Scenario: Run `osc enablechannels <project>`
When I execute osc with args "enablechannels test:factory" When I execute osc with args "enablechannels test:factory"
Then stdout is Then stdout is
""" """
Enabling channels in project: 'test:factory' Enabling channels in project 'test:factory'
""" """

View File

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