From ba32ff57cb8f4a6e0eb4968918798b20c81d6bfb Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Tue, 20 Dec 2022 14:42:19 +0100 Subject: [PATCH] linkpac: Fix linking a locked package by not copying the lock to the target package --- behave/features/linkpac.feature | 13 +++++++++++++ osc/core.py | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 behave/features/linkpac.feature diff --git a/behave/features/linkpac.feature b/behave/features/linkpac.feature new file mode 100644 index 00000000..4a235a9a --- /dev/null +++ b/behave/features/linkpac.feature @@ -0,0 +1,13 @@ +Feature: `osc linkpac` command + + +# common steps for all scenarios +Background: + Given I set working directory to "{context.osc.temp}" + + +@destructive +Scenario: Run `osc linkpac on a locked package` + Given I execute osc with args "lock test:factory/test-pkgA" + When I execute osc with args "linkpac test:factory/test-pkgA home:Admin/test-pkgA" + Then the exit code is 0 diff --git a/osc/core.py b/osc/core.py index feef1515..0f054403 100644 --- a/osc/core.py +++ b/osc/core.py @@ -5451,7 +5451,8 @@ def checkout_package( def replace_pkg_meta( - pkgmeta, new_name: str, new_prj: str, keep_maintainers=False, dst_userid=None, keep_develproject=False + pkgmeta, new_name: str, new_prj: str, keep_maintainers=False, dst_userid=None, keep_develproject=False, + keep_lock: bool = False, ): """ update pkgmeta with new new_name and new_prj and set calling user as the @@ -5472,6 +5473,9 @@ def replace_pkg_meta( if not keep_develproject: for dp in root.findall('devel'): root.remove(dp) + if not keep_lock: + for node in root.findall("lock"): + root.remove(node) return ET.tostring(root, encoding=ET_ENCODING)