implement checking submit requests

This commit is contained in:
Ludwig Nussel 2015-09-29 08:44:22 +02:00
parent efbcd75064
commit a334773cab

View File

@ -78,21 +78,12 @@ class MaintenanceChecker(ReviewBot.ReviewBot):
self.add_review(req, by_project = prj, by_package = pkg, self.add_review(req, by_project = prj, by_package = pkg,
msg = "Submission by someone who is not maintainer in the devel project. Please review") msg = "Submission by someone who is not maintainer in the devel project. Please review")
def check_action_maintenance_incident(self, req, a): # check if pkgname was submitted by the correct maintainer. If not, set
known_maintainer = False # self.needs_maintainer_review
author = req.get_creator() def _check_maintainer_review_needed(self, req, pkgname, author):
# check if there is a link and use that or the real package
# name as src_packge may end with something like
# .openSUSE_XX.Y_Update
pkgname = a.src_package
(linkprj, linkpkg) = self._get_linktarget(a.src_project, pkgname)
if linkpkg is not None:
pkgname = linkpkg
if pkgname == 'patchinfo':
return None
maintainers = set(self._maintainers(pkgname)) maintainers = set(self._maintainers(pkgname))
if maintainers: if maintainers:
known_maintainer = False
for m in maintainers: for m in maintainers:
if author == m: if author == m:
self.logger.debug("%s is maintainer"%author) self.logger.debug("%s is maintainer"%author)
@ -109,11 +100,35 @@ class MaintenanceChecker(ReviewBot.ReviewBot):
self.logger.warning("%s doesn't have maintainers"%pkgname) self.logger.warning("%s doesn't have maintainers"%pkgname)
self.needs_maintainer_review.add(pkgname) self.needs_maintainer_review.add(pkgname)
def check_action_maintenance_incident(self, req, a):
author = req.get_creator()
# check if there is a link and use that or the real package
# name as src_packge may end with something like
# .openSUSE_XX.Y_Update
pkgname = a.src_package
(linkprj, linkpkg) = self._get_linktarget(a.src_project, pkgname)
if linkpkg is not None:
pkgname = linkpkg
if pkgname == 'patchinfo':
return None
self._check_maintainer_review_needed(req, pkgname, author)
if a.tgt_releaseproject == "openSUSE:Backports:SLE-12": if a.tgt_releaseproject == "openSUSE:Backports:SLE-12":
self.add_factory_source = True self.add_factory_source = True
return True return True
def check_action_submit(self, req, a):
known_maintainer = False
author = req.get_creator()
pkgname = a.tgt_package
self._check_maintainer_review_needed(req, pkgname, author)
return True
def check_one_request(self, req): def check_one_request(self, req):
self.add_factory_source = False self.add_factory_source = False
self.needs_maintainer_review = set() self.needs_maintainer_review = set()