1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02: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:
Dr. Peter Poeml 2008-06-03 15:01:01 +00:00
parent 7641ed0c8c
commit 5438e4023a
2 changed files with 19 additions and 0 deletions

View File

@ -402,6 +402,9 @@ class Osc(cmdln.Cmdln):
help='specify message TEXT')
@cmdln.option('-r', '--revision', metavar='REV',
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):
"""${cmd_name}: Handle requests to submit a package into another project
@ -462,6 +465,14 @@ class Osc(cmdln.Cmdln):
dst_package = args[3]
else:
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':
project = args[0]

View File

@ -1544,6 +1544,14 @@ def show_package_meta(apiurl, prj, pac):
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):
url = makeurl(apiurl, ['source', prj, '_pattern'])
try: