mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
- support link or branch from not-yet-existing-packages to pre-define the later submit target
This commit is contained in:
parent
2950d89be4
commit
2e2deb3ec8
1
NEWS
1
NEWS
@ -12,6 +12,7 @@
|
||||
- support updateing _patchinfo file with new issues just by calling "osc patchinfo" again
|
||||
- branch --add-repositories can be used to add repos from source project to target project
|
||||
- branch --extend-package-names can be used to do mbranch like branch of a single package
|
||||
- branch --new-package can be used to do branch from a not yet existing package (to define later submit target)
|
||||
|
||||
0.132
|
||||
- rdelete and undelete command requesting now a comment
|
||||
|
@ -2289,6 +2289,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='overwrite an existing link file if it is there.')
|
||||
@cmdln.option('-d', '--disable-publish', action='store_true',
|
||||
help='disable publishing of the linked package')
|
||||
@cmdln.option('-N', '--new-package', action='store_true',
|
||||
help='create a link to a not yet existing package')
|
||||
def do_linkpac(self, subcmd, opts, *args):
|
||||
"""${cmd_name}: "Link" a package to another package
|
||||
|
||||
@ -2339,14 +2341,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
# files from the same source
|
||||
opts.cicount = "copy"
|
||||
|
||||
if opts.current:
|
||||
if opts.current and not opts.new_package:
|
||||
rev = show_upstream_rev(apiurl, src_project, src_package)
|
||||
|
||||
if rev and not checkRevision(src_project, src_package, rev):
|
||||
print >>sys.stderr, 'Revision \'%s\' does not exist' % rev
|
||||
sys.exit(1)
|
||||
|
||||
link_pac(src_project, src_package, dst_project, dst_package, opts.force, rev, opts.cicount, opts.disable_publish)
|
||||
link_pac(src_project, src_package, dst_project, dst_package, opts.force, rev, opts.cicount, opts.disable_publish, opts.new_package)
|
||||
|
||||
@cmdln.option('--nosources', action='store_true',
|
||||
help='ignore source packages when copying build results to destination project')
|
||||
@ -2739,6 +2741,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
help='Create a hidden project')
|
||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||
help='specify message TEXT')
|
||||
@cmdln.option('-N', '--new-package', action='store_true',
|
||||
help='create a branch pointing to a not yet existing package')
|
||||
@cmdln.option('-r', '--revision', metavar='rev',
|
||||
help='branch against a specific revision')
|
||||
def do_branch(self, subcmd, opts, *args):
|
||||
@ -2800,7 +2804,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
return_existing=opts.checkout, msg=opts.message or '',
|
||||
force=opts.force, noaccess=opts.noaccess,
|
||||
add_repositories=opts.add_repositories,
|
||||
extend_package_names=opts.extend_package_names)
|
||||
extend_package_names=opts.extend_package_names, missingok=opts.new_package)
|
||||
if exists:
|
||||
print >>sys.stderr, 'Using existing branch project: %s' % targetprj
|
||||
|
||||
|
27
osc/core.py
27
osc/core.py
@ -4131,7 +4131,7 @@ def link_to_branch(apiurl, project, package):
|
||||
else:
|
||||
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):
|
||||
def link_pac(src_project, src_package, dst_project, dst_package, force, rev='', cicount='', disable_publish = False, missing_target = False):
|
||||
"""
|
||||
create a linked package
|
||||
- "src" is the original package
|
||||
@ -4153,8 +4153,11 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
meta_change = True
|
||||
|
||||
if meta_change:
|
||||
src_meta = show_package_meta(apiurl, src_project, src_package)
|
||||
dst_meta = replace_pkg_meta(src_meta, dst_package, dst_project)
|
||||
if missing_target:
|
||||
dst_meta = '<package name="%s"><title/><description/></package>' % dst_package
|
||||
else:
|
||||
src_meta = show_package_meta(apiurl, src_project, src_package)
|
||||
dst_meta = replace_pkg_meta(src_meta, dst_package, dst_project)
|
||||
|
||||
if disable_publish:
|
||||
meta_change = True
|
||||
@ -4180,15 +4183,17 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
print >>sys.stderr, '_link file already exists...! Aborting'
|
||||
sys.exit(1)
|
||||
|
||||
rev = ''
|
||||
if rev:
|
||||
rev = 'rev="%s"' % rev
|
||||
else:
|
||||
rev = ''
|
||||
|
||||
missingok = ''
|
||||
if missing_target:
|
||||
missingok = 'missingok="true"'
|
||||
|
||||
cicount = ''
|
||||
if cicount:
|
||||
cicount = 'cicount="%s"' % cicount
|
||||
else:
|
||||
cicount = ''
|
||||
|
||||
print 'Creating _link...',
|
||||
|
||||
@ -4197,7 +4202,7 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
project = 'project="%s"' % src_project
|
||||
|
||||
link_template = """\
|
||||
<link %s package="%s" %s %s>
|
||||
<link %s package="%s" %s %s %s>
|
||||
<patches>
|
||||
<!-- <apply name="patch" /> apply a patch on the source directory -->
|
||||
<!-- <topadd>%%define build_with_feature_x 1</topadd> add a line on the top (spec file only) -->
|
||||
@ -4205,7 +4210,7 @@ def link_pac(src_project, src_package, dst_project, dst_package, force, rev='',
|
||||
<!-- <delete>filename</delete> delete a file -->
|
||||
</patches>
|
||||
</link>
|
||||
""" % (project, src_package, rev, cicount)
|
||||
""" % (project, src_package, missingok, rev, cicount)
|
||||
|
||||
u = makeurl(apiurl, ['source', dst_project, dst_package, '_link'])
|
||||
http_PUT(u, data=link_template)
|
||||
@ -4323,7 +4328,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, target_project=None, target_package=None, return_existing=False, msg='', force=False, noaccess=False, add_repositories=False, extend_package_names=False):
|
||||
def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None, target_project=None, target_package=None, return_existing=False, msg='', force=False, noaccess=False, add_repositories=False, extend_package_names=False, missingok=False):
|
||||
"""
|
||||
Branch a package (via API call)
|
||||
"""
|
||||
@ -4336,6 +4341,8 @@ def branch_pkg(apiurl, src_project, src_package, nodevelproject=False, rev=None,
|
||||
query['noaccess'] = '1'
|
||||
if add_repositories:
|
||||
query['add_repositories'] = "1"
|
||||
if missingok:
|
||||
query['missingok'] = "1"
|
||||
if extend_package_names:
|
||||
query['extend_package_names'] = "1"
|
||||
if rev:
|
||||
|
Loading…
Reference in New Issue
Block a user