diff --git a/osc/babysitter.py b/osc/babysitter.py index 4129aea2..54668f08 100644 --- a/osc/babysitter.py +++ b/osc/babysitter.py @@ -172,7 +172,7 @@ def run(prg, argv=None): print(e.msg, file=sys.stderr) traceback.print_exc(file=sys.stderr) except oscerr.PackageError as e: - print(e.msg, file=sys.stderr) + print(str(e), file=sys.stderr) except PackageError as e: print(f'{e.fname}:', e.msg, file=sys.stderr) except RPMError as e: diff --git a/osc/core.py b/osc/core.py index a23ff215..5194ce0c 100644 --- a/osc/core.py +++ b/osc/core.py @@ -6133,6 +6133,34 @@ def branch_pkg( """ Branch a package (via API call) """ + + # BEGIN: Error out on branching scmsync packages; this should be properly handled in the API + + # read src_package meta + m = b"".join(show_package_meta(apiurl, src_project, src_package)) + root = ET.fromstring(m) + + devel_project = None + devel_package = None + if not nodevelproject: + devel_node = root.find("devel") + if devel_node is not None: + devel_project = devel_node.get("project") + devel_package = devel_node.get("package", src_package) + if devel_project: + # replace src_package meta with devel_package meta because we're about branch from devel + m = b"".join(show_package_meta(apiurl, devel_project, devel_package)) + root = ET.fromstring(m) + + # error out if we're branching a scmsync package (we'd end up with garbage anyway) + if root.find("scmsync") is not None: + msg = "Cannot branch a package with set." + if devel_project: + raise oscerr.PackageError(devel_project, devel_package, msg) + raise oscerr.PackageError(src_project, src_package, msg) + + # END: Error out on branching scmsync packages; this should be properly handled in the API + query = {'cmd': 'branch'} if nodevelproject: query['ignoredevel'] = '1'