Merge pull request #252 from aplanas/master

Some fix after json changes
This commit is contained in:
Stephan Kulow 2014-09-29 12:12:22 +02:00
commit eafe1b51f8
6 changed files with 804 additions and 814 deletions

View File

@ -70,13 +70,15 @@ class OpenQAReport(object):
def get_broken_package_status(self, info): def get_broken_package_status(self, info):
status = info['broken_packages'] status = info['broken_packages']
for subproject in info['subprojects']: subproject = info['subproject']
if subproject:
status.extend(subproject['broken_packages']) status.extend(subproject['broken_packages'])
return status return status
def get_openQA_status(self, info): def get_openQA_status(self, info):
status = info['openqa_jobs'] status = info['openqa_jobs']
for subproject in info['subprojects']: subproject = info['subproject']
if subproject:
status.extend(subproject['openqa_jobs']) status.extend(subproject['openqa_jobs'])
return status return status
@ -166,6 +168,10 @@ class OpenQAReport(object):
report = '\n\n'.join((report_broken_packages, report_openQA)) report = '\n\n'.join((report_broken_packages, report_openQA))
report = report.strip() report = report.strip()
if report: if report:
if osc.conf.config['debug']:
print project
print '-' * len(project)
print report
self.update_status_comment(project, report) self.update_status_comment(project, report)

View File

@ -32,10 +32,12 @@ class AcceptCommand(object):
return rqs return rqs
def perform(self, project): def perform(self, project):
""" """Accept the staging LETTER for review and submit to Factory /
Accept the staging LETTER for review and submit to factory openSUSE 13.2 ...
Then disable the build to disabled Then disable the build to disabled
:param project: staging project we are working with :param project: staging project we are working with
""" """
status = self.api.check_project_status(project) status = self.api.check_project_status(project)
@ -55,12 +57,13 @@ class AcceptCommand(object):
print(msg) print(msg)
for req in requests: for req in requests:
change_request_state(self.api.apiurl, str(req), 'accepted', message='Accept to factory') change_request_state(self.api.apiurl, str(req), 'accepted', message='Accept to %s' % self.api.opensuse)
# A single comment should be enough to notify everybody, since they are # A single comment should be enough to notify everybody, since
# already mentioned in the comments created by select/unselect # they are already mentioned in the comments created by
# select/unselect
pkg_list = ", ".join(packages) pkg_list = ", ".join(packages)
cmmt = 'Project "{}" accepted. The following packages have been submitted to factory: {}.'.format(project, pkg_list) cmmt = 'Project "{}" accepted. The following packages have been submitted to {}: {}.'.format(project, self.api.opensuse, pkg_list)
self.comment.add_comment(project_name=project, comment=cmmt) self.comment.add_comment(project_name=project, comment=cmmt)
# XXX CAUTION - AFAIK the 'accept' command is expected to clean the messages here. # XXX CAUTION - AFAIK the 'accept' command is expected to clean the messages here.
@ -76,7 +79,7 @@ class AcceptCommand(object):
changed = False changed = False
for req in self.find_new_requests('openSUSE:{}'.format(self.api.opensuse)): for req in self.find_new_requests('openSUSE:{}'.format(self.api.opensuse)):
print 'Accepting request %d: %s' % (req['id'], ','.join(req['packages'])) print 'Accepting request %d: %s' % (req['id'], ','.join(req['packages']))
change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to factory') change_request_state(self.api.apiurl, str(req['id']), 'accepted', message='Accept to %s' % self.api.opensuse)
changed = True changed = True
return changed return changed

View File

@ -83,7 +83,8 @@ class CheckCommand(object):
report.extend(' %s: fail' % module['name'] for module in job['modules'] if module['result'] == 'fail') report.extend(' %s: fail' % module['name'] for module in job['modules'] if module['result'] == 'fail')
break break
for subproject in project['subprojects']: subproject = project['subproject']
if subproject:
subreport = self._report(subproject, verbose, is_subproject=True) subreport = self._report(subproject, verbose, is_subproject=True)
if subreport: if subreport:
report.append('') report.append('')

View File

@ -38,6 +38,6 @@ class TestAccept(unittest.TestCase):
# But the comment was written at some point # But the comment was written at some point
self.assertEqual(len(self.obs.comment_bodies), 1) self.assertEqual(len(self.obs.comment_bodies), 1)
comment = self.obs.comment_bodies[0] comment = self.obs.comment_bodies[0]
self.assertTrue('The following packages have been submitted to factory' in comment) self.assertTrue('The following packages have been submitted to Factory' in comment)
self.assertTrue('apparmor' in comment) self.assertTrue('apparmor' in comment)
self.assertTrue('mariadb' in comment) self.assertTrue('mariadb' in comment)

File diff suppressed because it is too large Load Diff

View File

@ -103,99 +103,97 @@
] ]
} }
], ],
"subprojects": [ "subproject": {
{ "overall_state": "empty",
"overall_state": "empty", "broken_packages": [],
"broken_packages": [], "building_repositories": [
"building_repositories": [ {
{ "arch": "x86_64",
"arch": "x86_64", "code": "blocked",
"code": "blocked", "repository": "standard",
"repository": "standard", "state": "blocked"
"state": "blocked" },
}, {
{ "arch": "x86_64",
"arch": "x86_64", "code": "blocked",
"code": "blocked", "repository": "images",
"repository": "images", "state": "blocked"
"state": "blocked" }
} ],
], "description": "",
"description": "", "missing_reviews": [],
"missing_reviews": [], "name": "openSUSE:Factory:Staging:H:DVD",
"name": "openSUSE:Factory:Staging:H:DVD", "obsolete_requests": [],
"obsolete_requests": [], "openqa_jobs": [
"openqa_jobs": [ {
{ "clone_id": null,
"clone_id": null, "id": 10665,
"id": 10665, "iso": null,
"iso": null, "name": "opensuse-Staging:H-Staging2-DVD-x86_64-Build110.12-gnome",
"name": "opensuse-Staging:H-Staging2-DVD-x86_64-Build110.12-gnome", "result": "passed",
"result": "passed", "state": "done",
"state": "done", "modules": [
"modules": [ {
{ "name": "isosize",
"name": "isosize", "result": "ok"
"result": "ok" },
}, {
{ "name": "livecdreboot",
"name": "livecdreboot", "result": "ok"
"result": "ok" },
}, {
{ "name": "first_boot",
"name": "first_boot", "result": "ok"
"result": "ok" }
} ]
] },
}, {
{ "clone_id": null,
"clone_id": null, "id": 10664,
"id": 10664, "iso": null,
"iso": null, "name": "opensuse-Staging:H-Staging2-DVD-x86_64-Build110.12-miniuefi",
"name": "opensuse-Staging:H-Staging2-DVD-x86_64-Build110.12-miniuefi", "result": "passed",
"result": "passed", "state": "done",
"state": "done", "modules": [
"modules": [ {
{ "name": "isosize",
"name": "isosize", "result": "ok"
"result": "ok" },
}, {
{ "name": "livecdreboot",
"name": "livecdreboot", "result": "ok"
"result": "ok" },
}, {
{ "name": "first_boot",
"name": "first_boot", "result": "ok"
"result": "ok" }
} ]
] },
}, {
{ "clone_id": null,
"clone_id": null, "id": 10662,
"id": 10662, "iso": null,
"iso": null, "name": "opensuse-Staging:H-Staging2-DVD-x86_64-Build110.12-kde",
"name": "opensuse-Staging:H-Staging2-DVD-x86_64-Build110.12-kde", "result": "passed",
"result": "passed", "state": "done",
"state": "done", "modules": [
"modules": [ {
{ "name": "isosize",
"name": "isosize", "result": "ok"
"result": "ok" },
}, {
{ "name": "livecdreboot",
"name": "livecdreboot", "result": "ok"
"result": "ok" },
}, {
{ "name": "first_boot",
"name": "first_boot", "result": "ok"
"result": "ok" }
} ]
] }
} ],
], "subproject": null,
"subprojects": [], "untracked_requests": []
"untracked_requests": [] },
}
],
"untracked_requests": [] "untracked_requests": []
} }