mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 22:56:15 +01:00
aggregatepac: Migrate to pop_project_package_targetproject_targetpackage_from_args()
This commit is contained in:
parent
d779eb936d
commit
fd851bbe83
23
behave/features/aggregatepac.feature
Normal file
23
behave/features/aggregatepac.feature
Normal file
@ -0,0 +1,23 @@
|
||||
Feature: `osc aggregatepac` command
|
||||
|
||||
|
||||
# common steps for all scenarios
|
||||
Background:
|
||||
Given I set working directory to "{context.osc.temp}"
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc aggregatepac <project>/<package> <target-project>`
|
||||
When I execute osc with args "aggregatepac test:factory/test-pkgA home:Admin"
|
||||
Then the exit code is 0
|
||||
|
||||
|
||||
@destructive
|
||||
Scenario: Run `osc aggregatepac <project>/<package> <target-project>/<target-package>`
|
||||
When I execute osc with args "aggregatepac test:factory/test-pkgA home:Admin/test-pkgAA"
|
||||
Then the exit code is 0
|
||||
|
||||
|
||||
Scenario: Run `osc aggregatepac` where the source and target are the same
|
||||
When I execute osc with args "aggregatepac test:factory/test-pkgA test:factory"
|
||||
Then the exit code is 1
|
@ -3100,21 +3100,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
osc aggregatepac SOURCEPRJ SOURCEPAC[:FLAVOR] DESTPRJ [DESTPAC]
|
||||
"""
|
||||
|
||||
args = slash_split(args)
|
||||
args = list(args)
|
||||
src_project, src_package, tgt_project, tgt_package = pop_project_package_targetproject_targetpackage_from_args(
|
||||
args, target_package_is_optional=True,
|
||||
)
|
||||
ensure_no_remaining_args(args)
|
||||
|
||||
if not args or len(args) < 3:
|
||||
self.argparse_error("Incorrect number of arguments.")
|
||||
|
||||
src_project = self._process_project_name(args[0])
|
||||
src_package = args[1]
|
||||
dst_project = self._process_project_name(args[2])
|
||||
if len(args) > 3:
|
||||
dst_package = args[3]
|
||||
else:
|
||||
dst_package = src_package
|
||||
|
||||
if src_project == dst_project and src_package == dst_package:
|
||||
raise oscerr.WrongArgs('Error: source and destination are the same.')
|
||||
if not tgt_package:
|
||||
tgt_package = src_package
|
||||
|
||||
repo_map = {}
|
||||
if opts.map_repo:
|
||||
@ -3124,7 +3117,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
raise oscerr.WrongOptions('map "%s" must be SRC=TARGET[,SRC=TARGET]' % opts.map_repo)
|
||||
repo_map[src_tgt[0]] = src_tgt[1]
|
||||
|
||||
aggregate_pac(src_project, src_package, dst_project, dst_package, repo_map, opts.disable_publish, opts.nosources)
|
||||
aggregate_pac(src_project, src_package, tgt_project, tgt_package, repo_map, opts.disable_publish, opts.nosources)
|
||||
|
||||
@cmdln.option('-c', '--client-side-copy', action='store_true',
|
||||
help='do a (slower) client-side copy')
|
||||
|
@ -5631,6 +5631,9 @@ def aggregate_pac(
|
||||
- "map" is a dictionary SRC => TARGET repository mappings
|
||||
- "repo_check" determines if presence of repos in the source and destination repos is checked
|
||||
"""
|
||||
if (src_project, src_package) == (dst_project, dst_package):
|
||||
raise oscerr.OscValueError("Cannot aggregate package. Source and target are the same.")
|
||||
|
||||
meta_change = False
|
||||
dst_meta = ''
|
||||
apiurl = conf.config['apiurl']
|
||||
|
Loading…
Reference in New Issue
Block a user