def _check_maintainer_review_needed(self, req, a): author = req.get_creator() if a.type == 'maintenance_incident': # 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 self._is_patchinfo(a.src_package): return None project = a.tgt_releaseproject else: pkgname = a.tgt_package project = a.tgt_project if project.startswith('openSUSE:Leap:') and hasattr(a, 'src_project'): mapping = MaintenanceChecker._get_lookup_yml(self.apiurl, project) if mapping is None: self.logger.error( "error loading mapping for {}".format(project)) elif not pkgname in mapping: self.logger.debug("{} not tracked".format(pkgname)) else: origin = mapping[pkgname] self.logger.debug("{} comes from {}, submitted from {}".format( pkgname, origin, a.src_project)) if origin.startswith('SUSE:SLE-12') and a.src_project.startswith('SUSE:SLE-12') \ or origin.startswith('SUSE:SLE-15') and a.src_project.startswith('SUSE:SLE-15') \ or origin.startswith('openSUSE:Leap') and a.src_project.startswith('openSUSE:Leap'): self.logger.info( "{} submitted from {}, no maintainer review needed". format(pkgname, a.src_project)) return maintainers = set(maintainers_get(self.apiurl, project, pkgname)) if maintainers: known_maintainer = False for m in maintainers: if author == m: self.logger.debug("%s is maintainer" % author) known_maintainer = True if not known_maintainer: for r in req.reviews: if r.by_user in maintainers: self.logger.debug("found %s as reviewer" % r.by_user) known_maintainer = True if not known_maintainer: self.logger.debug( "author: %s, maintainers: %s => need review" % (author, ','.join(maintainers))) self.needs_maintainer_review.add(pkgname) else: self.logger.warning("%s doesn't have maintainers" % pkgname) self.needs_maintainer_review.add(pkgname)
def devel_project_review_needed(self, request, project, package): author = request.get_creator() maintainers = set(maintainers_get(self.apiurl, project, package)) if author in maintainers: return False # Carried over from maintbot, but seems haphazard. for review in request.reviews: if review.by_user in maintainers: return False return True
def devel_project_review_needed(self, request, project, package): author = request.get_creator() maintainers = set(maintainers_get(self.apiurl, project, package)) if author in maintainers: return False # Carried over from maintbot, but seems haphazard. for review in request.reviews: if review.by_user in maintainers: return False return True
def _check_maintainer_review_needed(self, req, a): author = req.get_creator() if a.type == 'maintenance_incident': # 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 self._is_patchinfo(a.src_package): return None project = a.tgt_releaseproject else: pkgname = a.tgt_package project = a.tgt_project if project.startswith('openSUSE:Leap:') and hasattr(a, 'src_project'): mapping = MaintenanceChecker._get_lookup_yml(self.apiurl, project) if mapping is None: self.logger.error("error loading mapping for {}".format(project)) elif not pkgname in mapping: self.logger.debug("{} not tracked".format(pkgname)) else: origin = mapping[pkgname] self.logger.debug("{} comes from {}, submitted from {}".format(pkgname, origin, a.src_project)) if origin.startswith('SUSE:SLE-12') and a.src_project.startswith('SUSE:SLE-12') \ or origin.startswith('SUSE:SLE-15') and a.src_project.startswith('SUSE:SLE-15') \ or origin.startswith('openSUSE:Leap') and a.src_project.startswith('openSUSE:Leap'): self.logger.info("{} submitted from {}, no maintainer review needed".format(pkgname, a.src_project)) return maintainers = set(maintainers_get(self.apiurl, project, pkgname)) if maintainers: known_maintainer = False for m in maintainers: if author == m: self.logger.debug("%s is maintainer"%author) known_maintainer = True if not known_maintainer: for r in req.reviews: if r.by_user in maintainers: self.logger.debug("found %s as reviewer"%r.by_user) known_maintainer = True if not known_maintainer: self.logger.debug("author: %s, maintainers: %s => need review"%(author, ','.join(maintainers))) self.needs_maintainer_review.add(pkgname) else: self.logger.warning("%s doesn't have maintainers"%pkgname) self.needs_maintainer_review.add(pkgname)