mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-09 20:45:47 +01:00
osc submitreq: look up the develproject of the target, and if there is one,
don't create the request, unless forced with --nodevelproject.
This commit is contained in:
parent
7641ed0c8c
commit
5438e4023a
@ -402,6 +402,9 @@ class Osc(cmdln.Cmdln):
|
|||||||
help='specify message TEXT')
|
help='specify message TEXT')
|
||||||
@cmdln.option('-r', '--revision', metavar='REV',
|
@cmdln.option('-r', '--revision', metavar='REV',
|
||||||
help='for "create", specify a certain source revision ID (the md5 sum)')
|
help='for "create", specify a certain source revision ID (the md5 sum)')
|
||||||
|
@cmdln.option('--nodevelproject', action='store_true',
|
||||||
|
help='do not follow a defined devel project ' \
|
||||||
|
'(primary project where a package is developed)')
|
||||||
def do_submitreq(self, subcmd, opts, *args):
|
def do_submitreq(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Handle requests to submit a package into another project
|
"""${cmd_name}: Handle requests to submit a package into another project
|
||||||
|
|
||||||
@ -462,6 +465,14 @@ class Osc(cmdln.Cmdln):
|
|||||||
dst_package = args[3]
|
dst_package = args[3]
|
||||||
else:
|
else:
|
||||||
dst_package = src_package
|
dst_package = src_package
|
||||||
|
devloc = show_develproject(conf.config['apiurl'], dst_project, dst_package)
|
||||||
|
if devloc and dst_project != devloc and not opts.nodevelproject:
|
||||||
|
print """\
|
||||||
|
Sorry, but a different project, %s, is defined as the place where development
|
||||||
|
of the package %s primarily takes place.
|
||||||
|
Please submit there instead, or use --nodevelproject to force direct submission.""" \
|
||||||
|
% (devloc, dst_package)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
elif cmd == 'list':
|
elif cmd == 'list':
|
||||||
project = args[0]
|
project = args[0]
|
||||||
|
@ -1544,6 +1544,14 @@ def show_package_meta(apiurl, prj, pac):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def show_develproject(apiurl, prj, pac):
|
||||||
|
m = show_package_meta(apiurl, prj, pac)
|
||||||
|
try:
|
||||||
|
return ET.parse(StringIO(''.join(m))).getroot().find('devel').get('project')
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def show_pattern_metalist(apiurl, prj):
|
def show_pattern_metalist(apiurl, prj):
|
||||||
url = makeurl(apiurl, ['source', prj, '_pattern'])
|
url = makeurl(apiurl, ['source', prj, '_pattern'])
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user