Only decline delete requests that affect linked packages within the target

This decline reason came from https://github.com/openSUSE/openSUSE-release-tools/pull/603
without much more context, so I'm guessing it's about delete requests for
e.g. kernel-default that should delete kernel-source

Packages that link to *other* projects basically do not exist in openSUSE
distributions but are very common in SLE service packs, so we need to diff
on this.

Fixes #1824
This commit is contained in:
Stephan Kulow 2019-01-09 12:58:54 +01:00
parent aa1c004dda
commit 646ce308d7

View File

@ -279,20 +279,24 @@ class CheckSource(ReviewBot.ReviewBot):
self.review_messages['declined'] = "There is a pending request %s to %s/%s in process." % (','.join(ids), action.tgt_project, action.tgt_package)
return False
# Decline the delete request against linked package.
links = root.findall('sourceinfo/linked')
if links is None or len(links) == 0:
# Decline delete requests against linked flavor package
linked = root.find('sourceinfo/linked')
if not (linked is None or self.check_linked_package(action, linked)):
return False
if not self.ignore_devel:
self.devel_project_review_ensure(request, action.tgt_project, action.tgt_package)
if not self.skip_add_reviews and self.repo_checker is not None:
self.add_review(self.request, by_user=self.repo_checker, msg='Is this delete request safe?')
return True
def check_linked_package(self, action, linked):
if linked.get('project', action.tgt_project) != action.tgt_project:
return True
else:
linked = links[0]
linked_project = linked.get('project')
linked_package = linked.get('package')
self.review_messages['declined'] = "This is an incorrect request, it's a linked package to %s/%s" % (linked_project, linked_package)
self.review_messages['declined'] = "Delete the package %s instead" % (linked_package)
return False
def check_action_delete_project(self, request, action):