2014-02-19 11:48:16 +01:00
|
|
|
import osc
|
|
|
|
from osc import cmdln
|
|
|
|
from osc.core import *
|
|
|
|
|
|
|
|
class AcceptCommand:
|
|
|
|
def __init__(self, api):
|
|
|
|
self.api = api
|
|
|
|
|
|
|
|
def perform(self, project):
|
2014-02-26 14:51:01 +01:00
|
|
|
"""
|
|
|
|
Accept the staging LETTER for review and submit to factory
|
|
|
|
Then disable the build to disabled
|
|
|
|
:param project: staging project we are working with
|
|
|
|
"""
|
2014-02-19 11:48:16 +01:00
|
|
|
status = self.api.check_project_status(project)
|
|
|
|
|
|
|
|
if not status:
|
2014-02-26 14:51:01 +01:00
|
|
|
print('The project "{0}" is not yet acceptable.'.format(project))
|
2014-02-19 11:48:16 +01:00
|
|
|
return
|
|
|
|
|
|
|
|
meta = self.api.get_prj_pseudometa(project)
|
|
|
|
requests = []
|
|
|
|
for req in meta['requests']:
|
|
|
|
self.api.rm_from_prj(project, request_id=req['id'], msg='ready to accept')
|
2014-02-26 14:51:01 +01:00
|
|
|
print('Accepting staging review for {0}'.format(req['package']))
|
2014-02-19 11:48:16 +01:00
|
|
|
requests.append(req['id'])
|
|
|
|
|
|
|
|
for req in requests:
|
|
|
|
change_request_state(self.api.apiurl, str(req), 'accepted', message='Accept to factory')
|
|
|
|
|
|
|
|
self.api.build_switch_prj(project, 'disable')
|