diff --git a/osc/commandline.py b/osc/commandline.py index 68d4db5e..fe8f7e66 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -3107,18 +3107,30 @@ Please submit there instead, or use --nodevelproject to force direct submission. @cmdln.option('-m', '--message', metavar='TEXT', - help='specify message TEXT') + help='specify message TEXT') + @cmdln.option('-p', '--package', metavar='PKG', action='append', + help='specify packages to release') def do_releaserequest(self, subcmd, opts, *args): - """${cmd_name}: Create a request for releasing a maintenance update. + """${cmd_name}: Create a release request - [See http://openbuildservice.org/help/manuals/obs-reference-guide/cha.obs.maintenance_setup.html - for information on this topic.] + For maintenance incident projects: This command is used by the maintenance team to start the release process of a maintenance update. This includes usually testing based on the defined reviewers of the update project. + [See https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.maintenance_setup.html + for information on this topic.] + + For normal projects: + + This command is used to transfer sources and binaries without rebuilding them. + It requires defined release targets set to trigger="manual". + + [See https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.request_and_review_system.html + for information on this topic.] + usage: - osc releaserequest [ SOURCEPROJECT ] + osc releaserequest [-p package] [ SOURCEPROJECT ] ${cmd_option_list} """ @@ -3140,12 +3152,25 @@ Please submit there instead, or use --nodevelproject to force direct submission. if len(args) > 0: source_project = args[0] + f = show_project_meta(apiurl, source_project) + root = ET.fromstring(b''.join(f)) + if not opts.message: opts.message = edit_message() else: opts.message = str(opts.message.encode().decode('unicode_escape')) - r = create_release_request(apiurl, source_project, opts.message) + if 'kind' in root.attrib and root.attrib['kind'] == 'maintenance_incident': + r = create_release_request(apiurl, source_project, opts.message) + else: + r = Request() + if opts.package: + for pac in opts.package: + r.add_action('release', src_project=source_project, src_package=pac) + else: + r.add_action('release', src_project=source_project) + r.description = _html_escape(opts.message) + r.create(apiurl) print(r.reqid) diff --git a/osc/core.py b/osc/core.py index 6613eed0..e4738fd2 100644 --- a/osc/core.py +++ b/osc/core.py @@ -2676,6 +2676,9 @@ class Action: 'maintenance_release': ('src_project', 'src_package', 'src_rev', 'tgt_project', 'tgt_package', 'person_name', 'acceptinfo_rev', 'acceptinfo_srcmd5', 'acceptinfo_xsrcmd5', 'acceptinfo_osrcmd5', 'acceptinfo_oxsrcmd5', 'acceptinfo_oproject', 'acceptinfo_opackage'), + 'release': ('src_project', 'src_package', 'src_rev', 'tgt_project', 'tgt_package', 'person_name', + 'acceptinfo_rev', 'acceptinfo_srcmd5', 'acceptinfo_xsrcmd5', 'acceptinfo_osrcmd5', + 'acceptinfo_oxsrcmd5', 'acceptinfo_oproject', 'acceptinfo_opackage', 'tgt_repository'), 'maintenance_incident': ('src_project', 'src_package', 'src_rev', 'tgt_project', 'tgt_package', 'tgt_releaseproject', 'person_name', 'opt_sourceupdate', 'opt_makeoriginolder', 'acceptinfo_rev', 'acceptinfo_srcmd5', 'acceptinfo_xsrcmd5', 'acceptinfo_osrcmd5', 'acceptinfo_oxsrcmd5'), @@ -2935,7 +2938,7 @@ class Request: srcupdate = ' ' if action.opt_sourceupdate and show_srcupdate: srcupdate = '(%s)' % action.opt_sourceupdate - elif action.type == 'maintenance_release': + elif action.type in ('maintenance_release', 'release'): d['source'] = '%s' % prj_pkg_join(action.src_project, action.src_package) if action.src_rev: d['source'] = d['source'] + '@%s' % action.src_rev