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 action_is_patchinfo(a): 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 pkgname not 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 add_devel_project_review(self, req, package): """ add devel project/package as reviewer """ a = req.actions[0] if action_is_patchinfo(a): a = req.actions[1] project = a.tgt_releaseproject if a.type == 'maintenance_incident' else req.actions[0].tgt_project root = owner_fallback(self.apiurl, project, package) for p in root.findall('./owner'): prj = p.get("project") pkg = p.get("package") # packages dropped from Factory sometimes point to maintained distros if prj.startswith('openSUSE:Leap') or prj.startswith('openSUSE:1'): self.logger.debug("%s looks wrong as maintainer, skipped", prj) continue self.add_review(req, by_project = prj, by_package = pkg, msg = 'Submission for {} by someone who is not maintainer in the devel project ({}). Please review'.format(pkg, prj) )
def check_action_maintenance_release(self, req, a): pkgname = a.src_package if action_is_patchinfo(a): self.logger.debug('ignoring patchinfo action') return True linkpkg = self._get_linktarget_self(a.src_project, pkgname) if linkpkg is not None: pkgname = linkpkg # packages in maintenance have links to the target. Use that # to find the real package name (linkprj, linkpkg) = self._get_linktarget(a.src_project, pkgname) if linkpkg is None or linkprj is None or linkprj != a.tgt_project: self.logger.warning("%s/%s is not a link to %s" % (a.src_project, pkgname, a.tgt_project)) return self.check_source_submission(a.src_project, a.src_package, a.src_rev, a.tgt_project, a.tgt_package) else: pkgname = linkpkg return self.check_source_submission(a.src_project, a.src_package, None, a.tgt_project, pkgname)
def check_action_maintenance_incident(self, req, a): if action_is_patchinfo(a): self.logger.debug('ignoring patchinfo action') return True # Duplicate src_package as tgt_package since prior to assignment to a # specific incident project there is no target package (odd API). After # assignment it is still assumed the target will match the source. Since # the ultimate goal is the tgt_releaseproject the incident is treated # similar to staging in that the intermediate result is not the final # and thus the true target project (ex. openSUSE:Maintenance) is not # used for check_source_submission(). tgt_package = a.src_package if a.tgt_releaseproject is not None: suffix = '.' + a.tgt_releaseproject.replace(':', '_') if tgt_package.endswith(suffix): tgt_package = tgt_package[:-len(suffix)] # Note tgt_releaseproject (product) instead of tgt_project (maintenance). return self.check_source_submission(a.src_project, a.src_package, a.src_rev, a.tgt_releaseproject, tgt_package)