Merge pull request #16 from coolo/retire_rqlink

retire rqlink - select is the better interface
This commit is contained in:
Tomáš Chvátal 2014-02-12 14:02:49 +01:00
commit 20f1149584
2 changed files with 2 additions and 82 deletions

View File

@ -1,75 +0,0 @@
#
# (C) 2011 coolo@suse.de, Novell Inc, openSUSE.org
# Distribute under GPLv2 or GPLv3
#
# Copy this script to ~/.osc-plugins/ or /var/lib/osc-plugins .
# Then try to run 'osc checker --help' to see the usage.
import socket
import os
import traceback
import subprocess
import urllib2
def do_rqlink(self, subcmd, opts, *args):
"""${cmd_name}: link request sources
Usage:
osc rqlink [OPT] [ID] [PRJ]
link the request's sources into prj
${cmd_option_list}
"""
if len(args) != 2:
raise oscerr.WrongArgs("Please give an id and a prj")
opts.verbose = False
from pprint import pprint
opts.apiurl = self.get_api_url()
rqid = args[0]
url = makeurl(opts.apiurl, ['request', rqid])
f = http_GET(url)
rq = ET.parse(f).getroot()
act = rq.findall('action')[0]
_type = act.get('type');
if (_type != "submit"):
raise "Can't handle %s" % _type
pkg = act.find('source').get('package')
prj = act.find('source').get('project')
rev = act.find('source').get('rev')
tpkg = act.find('target').get('package')
url = makeurl(opts.apiurl, ['source', prj, pkg], { 'rev': rev, 'expand': 1 })
f = http_GET(url)
root = ET.parse(f).getroot()
rev = root.attrib['srcmd5']
vrev = root.attrib['vrev']
print "osc linkpac -r %s %s/%s %s/%s" % (rev, prj, pkg, args[1], tpkg)
link_pac(prj, pkg, args[1], tpkg, force=True, rev=rev, vrev=vrev)
url = makeurl(opts.apiurl, ['source', args[1], '_meta'])
f = http_GET(url)
root = ET.parse(f).getroot()
title = root.find('title')
text = title.text
rqtext = "%s(%s)" % (pkg, rqid)
if text is None:
text = rqtext
else:
text = text + (", %s" % rqtext)
title.text = text
http_PUT(url, data=ET.tostring(root))
#print pkg, prj, rev
#Local Variables:
#mode: python
#py-indent-offset: 4
#tab-width: 8
#End:

View File

@ -411,7 +411,7 @@ def _staging_one_request(self, rq, opts):
delete_package(opts.apiurl, stprj, tpkg, msg='done') delete_package(opts.apiurl, stprj, tpkg, msg='done')
elif stage_info[1] != 0 and int(stage_info[1]) != id: elif stage_info[1] != 0 and int(stage_info[1]) != id:
print stage_info print stage_info
print "osc staging rqlink %s openSUSE:Factory:Staging:%s" % (id, stage_info[0]) print "osc staging select %s %s" % (stage_info[0], id)
return return
elif stage_info[1] != 0: # keep silent about those already asigned elif stage_info[1] != 0: # keep silent about those already asigned
return return
@ -572,7 +572,7 @@ def do_staging(self, subcmd, opts, *args):
"list" will pick the requests not in rings "list" will pick the requests not in rings
"rqlink" will add request to the project "select" will add requests to the project
Usage: Usage:
osc staging check [--everything] REPO osc staging check [--everything] REPO
@ -582,7 +582,6 @@ def do_staging(self, subcmd, opts, *args):
osc staging submit-devel [-m message] REPO osc staging submit-devel [-m message] REPO
osc staging freeze PROJECT osc staging freeze PROJECT
osc staging list osc staging list
osc staging rqlink REQUEST PROJECT
osc staging select LETTER REQUEST... osc staging select LETTER REQUEST...
osc staging accept LETTER osc staging accept LETTER
osc staging cleanup_rings osc staging cleanup_rings
@ -598,8 +597,6 @@ def do_staging(self, subcmd, opts, *args):
min_args, max_args = 1, 1 min_args, max_args = 1, 1
elif cmd in ['check']: elif cmd in ['check']:
min_args, max_args = 1, 2 min_args, max_args = 1, 2
elif cmd in ['rqlink']:
min_args, max_args = 2, 2
elif cmd in ['select']: elif cmd in ['select']:
min_args, max_args = 2, None min_args, max_args = 2, None
elif cmd in ['create', 'c']: elif cmd in ['create', 'c']:
@ -638,8 +635,6 @@ def do_staging(self, subcmd, opts, *args):
self._staging_submit_devel(project, opts) self._staging_submit_devel(project, opts)
elif cmd in ['freeze']: elif cmd in ['freeze']:
self._staging_freeze_prjlink(args[1], opts) self._staging_freeze_prjlink(args[1], opts)
elif cmd in ['rqlink']:
api.sr_to_prj(args[1], args[2])
elif cmd in ['select']: elif cmd in ['select']:
# TODO: have an api call for that # TODO: have an api call for that
stprj = 'openSUSE:Factory:Staging:%s' % args[1] stprj = 'openSUSE:Factory:Staging:%s' % args[1]