mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-12 16:56:15 +01:00
Merge pull request #1191 from dmach/disable-build
Add --disable-build option to linkpac and branch commands
This commit is contained in:
commit
16a508beaf
@ -2867,6 +2867,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='link the specified revision.')
|
||||
@cmdln.option('-f', '--force', action='store_true',
|
||||
help='overwrite an existing link file if it is there.')
|
||||
@cmdln.option('--disable-build', action='store_true',
|
||||
help='disable building of the linked package')
|
||||
@cmdln.option('-d', '--disable-publish', action='store_true',
|
||||
help='disable publishing of the linked package')
|
||||
@cmdln.option('-N', '--new-package', action='store_true',
|
||||
@ -2931,7 +2933,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
print('Revision \'%s\' does not exist' % rev, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
link_pac(src_project, src_package, dst_project, dst_package, opts.force, rev, opts.cicount, opts.disable_publish, opts.new_package, vrev)
|
||||
link_pac(
|
||||
src_project, src_package, dst_project, dst_package, opts.force, rev, opts.cicount,
|
||||
opts.disable_publish, opts.new_package, vrev,
|
||||
disable_build=opts.disable_build,
|
||||
)
|
||||
|
||||
@cmdln.option('--nosources', action='store_true',
|
||||
help='ignore source packages when copying build results to destination project')
|
||||
@ -3533,6 +3539,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='specify the used block strategy for new repositories')
|
||||
@cmdln.option('--add-repositories-rebuild', metavar='add_repositories_rebuild',
|
||||
help='specify the used rebuild strategy for new repositories')
|
||||
@cmdln.option('--disable-build', action='store_true',
|
||||
help='disable building of the branched package')
|
||||
def do_branch(self, subcmd, opts, *args):
|
||||
"""
|
||||
Branch a package
|
||||
@ -3602,7 +3610,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
add_repositories_rebuild=opts.add_repositories_rebuild,
|
||||
extend_package_names=opts.extend_package_names,
|
||||
missingok=opts.new_package,
|
||||
maintenance=opts.maintenance)
|
||||
maintenance=opts.maintenance,
|
||||
disable_build=opts.disable_build)
|
||||
except oscerr.NotMissing as e:
|
||||
print('NOTE: Package target exists already via project links, link will point to given project.')
|
||||
print(' A submission will initialize a new instance.')
|
||||
@ -3619,7 +3628,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
extend_package_names=opts.extend_package_names,
|
||||
missingok=False,
|
||||
maintenance=opts.maintenance,
|
||||
newinstance=opts.new_package)
|
||||
newinstance=opts.new_package,
|
||||
disable_build=opts.disable_build)
|
||||
|
||||
if exists:
|
||||
print('Using existing branch project: %s' % targetprj, file=sys.stderr)
|
||||
|
40
osc/core.py
40
osc/core.py
@ -5303,7 +5303,7 @@ def link_to_branch(apiurl, project, package):
|
||||
raise oscerr.OscIOError(None, 'no _link file inside project \'%s\' package \'%s\'' % (project, package))
|
||||
|
||||
|
||||
def link_pac(src_project, src_package, dst_project, dst_package, force, rev='', cicount='', disable_publish=False, missing_target=False, vrev=''):
|
||||
def link_pac(src_project, src_package, dst_project, dst_package, force, rev='', cicount='', disable_publish=False, missing_target=False, vrev='', disable_build=False):
|
||||
"""
|
||||
create a linked package
|
||||
- "src" is the original package
|
||||
@ -5332,14 +5332,24 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
src_meta = show_package_meta(apiurl, src_project, src_package)
|
||||
dst_meta = replace_pkg_meta(src_meta, dst_package, dst_project)
|
||||
|
||||
if disable_publish:
|
||||
if disable_build or disable_publish:
|
||||
meta_change = True
|
||||
root = ET.fromstring(''.join(dst_meta))
|
||||
elm = root.find('publish')
|
||||
if not elm:
|
||||
elm = ET.SubElement(root, 'publish')
|
||||
elm.clear()
|
||||
ET.SubElement(elm, 'disable')
|
||||
|
||||
if disable_build:
|
||||
elm = root.find('build')
|
||||
if not elm:
|
||||
elm = ET.SubElement(root, 'build')
|
||||
elm.clear()
|
||||
ET.SubElement(elm, 'disable')
|
||||
|
||||
if disable_publish:
|
||||
elm = root.find('publish')
|
||||
if not elm:
|
||||
elm = ET.SubElement(root, 'publish')
|
||||
elm.clear()
|
||||
ET.SubElement(elm, 'disable')
|
||||
|
||||
dst_meta = ET.tostring(root, encoding=ET_ENCODING)
|
||||
|
||||
if meta_change:
|
||||
@ -5566,7 +5576,7 @@ def attribute_branch_pkg(apiurl, attribute, maintained_update_project_attribute,
|
||||
return r
|
||||
|
||||
|
||||
def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, linkrev=None, target_project=None, target_package=None, return_existing=False, msg='', force=False, noaccess=False, add_repositories=False, add_repositories_block=None, add_repositories_rebuild=None, extend_package_names=False, missingok=False, maintenance=False, newinstance=False):
|
||||
def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, linkrev=None, target_project=None, target_package=None, return_existing=False, msg='', force=False, noaccess=False, add_repositories=False, add_repositories_block=None, add_repositories_rebuild=None, extend_package_names=False, missingok=False, maintenance=False, newinstance=False, disable_build=False):
|
||||
"""
|
||||
Branch a package (via API call)
|
||||
"""
|
||||
@ -5626,6 +5636,20 @@ def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None,
|
||||
data = {}
|
||||
for i in root.findall('data'):
|
||||
data[i.get('name')] = i.text
|
||||
|
||||
if disable_build:
|
||||
target_meta = show_package_meta(apiurl, data["targetproject"], data["targetpackage"])
|
||||
root = ET.fromstring(b''.join(target_meta))
|
||||
|
||||
elm = root.find('build')
|
||||
if not elm:
|
||||
elm = ET.SubElement(root, 'build')
|
||||
elm.clear()
|
||||
ET.SubElement(elm, 'disable')
|
||||
|
||||
target_meta = ET.tostring(root, encoding=ET_ENCODING)
|
||||
edit_meta('pkg', path_args=(data["targetproject"], data["targetpackage"]), data=target_meta)
|
||||
|
||||
return (False, data.get('targetproject', None), data.get('targetpackage', None),
|
||||
data.get('sourceproject', None), data.get('sourcepackage', None))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user