1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-12 23:56:13 +01:00

- add support for updating the link in target package in submit action

This is also changing the request format to post OBS 1.0, but
that was also the case before when a source update option was used.
This commit is contained in:
Adrian Schröter 2015-03-09 08:44:12 +01:00
parent 00c7b9dbfc
commit ecd76148b8
3 changed files with 21 additions and 9 deletions

1
NEWS
View File

@ -1,5 +1,6 @@
0.151
- fix times when data comes from OBS backend
- support updateing the link in target package for submit requests
0.150
- support local builds using builenv (for same build environment as a former build)

View File

@ -948,6 +948,8 @@ class Osc(cmdln.Cmdln):
help='never remove source package on accept, but update its content')
@cmdln.option('--no-update', action='store_true',
help='never touch source package on accept (will break source links)')
@cmdln.option('--update-link', action='store_true',
help='This transfers the source including the _link file.')
@cmdln.option('-d', '--diff', action='store_true',
help='show diff only instead of creating the actual request')
@cmdln.option('--yes', action='store_true',
@ -1026,9 +1028,12 @@ class Osc(cmdln.Cmdln):
sr_ids = []
# for single request
actionxml = ""
options_block = ""
options_block = "<options>"
if src_update:
options_block = """<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
options_block += """<sourceupdate>%s</sourceupdate>""" % (src_update)
if opts.update_link:
options_block + """<updatelink>true</updatelink></options> """
options_block += "</options>"
# loop via all packages for checking their state
for p in meta_get_packagelist(apiurl, project):
@ -1242,7 +1247,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
result = create_submit_request(apiurl,
src_project, src_package,
dst_project, dst_package,
opts.message, orev=rev, src_update=src_update)
opts.message, orev=rev,
src_update=src_update, dst_updatelink=opts.update_link)
if supersede_existing:
for req in reqs:
change_request_state(apiurl, req.reqid, 'superseded',

View File

@ -3908,19 +3908,24 @@ def create_maintenance_request(apiurl, src_project, src_packages, tgt_project, t
r.create(apiurl, addrevision=True)
return r
# This creates an old style submit request for server api 1.0
def create_submit_request(apiurl,
src_project, src_package=None,
dst_project=None, dst_package=None,
message="", orev=None, src_update=None):
message="", orev=None, src_update=None, dst_updatelink=None):
import cgi
options_block = ""
package = ""
if src_package:
package = """package="%s" """ % (src_package)
options_block = "<options>"
print("ASD", dst_updatelink)
if src_update:
options_block = """<options><sourceupdate>%s</sourceupdate></options> """ % (src_update)
options_block += """<sourceupdate>%s</sourceupdate>""" % (src_update)
if dst_updatelink:
options_block += """<updatelink>true</updatelink></options>"""
options_block += "</options>"
# Yes, this kind of xml construction is horrible
targetxml = ""
@ -3931,12 +3936,12 @@ def create_submit_request(apiurl,
targetxml = """<target project="%s" %s /> """ % ( dst_project, packagexml )
# XXX: keep the old template for now in order to work with old obs instances
xml = """\
<request type="submit">
<submit>
<request>
<action type="submit">
<source project="%s" %s rev="%s"/>
%s
%s
</submit>
</action>
<state name="new"/>
<description>%s</description>
</request>