Merge pull request #121 from scarabeusiv/master
Few bug fixes on the staging plugin
This commit is contained in:
commit
f1950c2637
@ -111,10 +111,7 @@ def do_staging(self, subcmd, opts, *args):
|
||||
elif cmd == 'accept':
|
||||
return AcceptCommand(api).perform(api. prj_from_letter(args[1]))
|
||||
elif cmd == 'unselect':
|
||||
for rq, rq_prj in RequestFinder.find_staged_sr(args[1:], opts.apiurl, api).items():
|
||||
print('Unselecting "{}" from "{}"'.format(rq, rq_prj['staging']))
|
||||
api.rm_from_prj(rq_prj['staging'], request_id=rq)
|
||||
api.add_review(rq, by_group='factory-staging', msg='Please recheck')
|
||||
return UnselectCommand(api).perform(args[1:])
|
||||
elif cmd == 'select':
|
||||
tprj = api.prj_from_letter(args[1])
|
||||
return SelectCommand(api).perform(tprj, args[2:], opts.move, opts.from_)
|
||||
|
@ -18,7 +18,7 @@ class CheckCommand(object):
|
||||
|
||||
# If the project is empty just skip it
|
||||
if not state:
|
||||
return
|
||||
return None
|
||||
|
||||
print('Checking staging project: {}'.format(project))
|
||||
if type(state) is list:
|
||||
@ -28,6 +28,8 @@ class CheckCommand(object):
|
||||
else:
|
||||
print(' ++ Acceptable staging project')
|
||||
|
||||
return True
|
||||
|
||||
def perform(self, project):
|
||||
"""
|
||||
Check one staging project verbosibly or all of them at once
|
||||
@ -37,8 +39,8 @@ class CheckCommand(object):
|
||||
self._check_one_project(project, True)
|
||||
else:
|
||||
for project in self.api.get_staging_projects():
|
||||
self._check_one_project(project, False)
|
||||
# newline to split multiple prjs at once
|
||||
print('')
|
||||
if self._check_one_project(project, False):
|
||||
# newline to split multiple prjs at once
|
||||
print('')
|
||||
|
||||
return True
|
||||
|
@ -100,7 +100,7 @@ class RequestFinder(object):
|
||||
"""
|
||||
|
||||
query = 'states=new,review,declined&project=openSUSE:Factory&view=collection&package={}'
|
||||
query = query.format(package)
|
||||
query = query.format(urllib2.quote(package))
|
||||
url = makeurl(self.apiurl, ['request'], query)
|
||||
f = http_GET(url)
|
||||
|
||||
|
@ -594,7 +594,7 @@ class StagingAPI(object):
|
||||
filename = binary.get('filename', '')
|
||||
if filename.endswith('.iso'):
|
||||
break
|
||||
|
||||
|
||||
if not filename:
|
||||
return None
|
||||
|
||||
@ -613,7 +613,7 @@ class StagingAPI(object):
|
||||
bn = int(result.group(2)) * 100 + int(result.group(3))
|
||||
jobname += '.{}'.format(bn)
|
||||
jobname += "-minimalx"
|
||||
|
||||
|
||||
bestjob = None
|
||||
for job in jobs:
|
||||
if job['name'] == jobname and job['result'] != 'incomplete':
|
||||
@ -843,6 +843,10 @@ class StagingAPI(object):
|
||||
if by_group and i.by_group == by_group and i.state == 'new':
|
||||
return
|
||||
|
||||
# don't try to change reviews if the request is dead
|
||||
if not req.state.name in ['new', 'review']:
|
||||
return
|
||||
|
||||
query = {}
|
||||
if by_project:
|
||||
query['by_project'] = by_project
|
||||
|
21
osclib/unselect_command.py
Normal file
21
osclib/unselect_command.py
Normal file
@ -0,0 +1,21 @@
|
||||
from osc import oscerr
|
||||
from osc.core import http_GET
|
||||
|
||||
from osclib.request_finder import RequestFinder
|
||||
|
||||
|
||||
class UnselectCommand(object):
|
||||
|
||||
def __init__(self, api):
|
||||
self.api = api
|
||||
|
||||
def perform(self, packages):
|
||||
"""
|
||||
Remove request from staging project
|
||||
:param packages: packages/requests to delete from staging projects
|
||||
"""
|
||||
for request, request_project in RequestFinder.find_staged_sr(packages, opts.apiurl, api).items():
|
||||
staging_project = request_project['staging']
|
||||
print('Unselecting "{}" from "{}"'.format(request, staging_project))
|
||||
self.api.rm_from_prj(staging_project, request_id=request)
|
||||
self.api.add_review(request, by_group='factory-staging', msg='Please recheck')
|
Loading…
x
Reference in New Issue
Block a user