Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package openSUSE-release-tools for
openSUSE:Factory checked in at 2021-07-29 21:31:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/openSUSE-release-tools (Old)
and /work/SRC/openSUSE:Factory/.openSUSE-release-tools.new.1899 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openSUSE-release-tools"
Thu Jul 29 21:31:59 2021 rev:312 rq:909147 version:20210729.455dc99c
Changes:
--------
---
/work/SRC/openSUSE:Factory/openSUSE-release-tools/openSUSE-release-tools.changes
2021-07-24 20:39:16.116407545 +0200
+++
/work/SRC/openSUSE:Factory/.openSUSE-release-tools.new.1899/openSUSE-release-tools.changes
2021-07-29 21:33:06.940685973 +0200
@@ -1,0 +2,9 @@
+Thu Jul 29 10:49:18 UTC 2021 - [email protected]
+
+- Update to version 20210729.455dc99c:
+ * Refactor code to split big method and improve doc
+ * Add test for inherit maintainer role
+ * Add note about explicit ignoring of inherited maintainership
+ * Avoid creation of duplicate add_role requests (fixes #2609)
+
+-------------------------------------------------------------------
Old:
----
openSUSE-release-tools-20210723.7e5bacec.obscpio
New:
----
openSUSE-release-tools-20210729.455dc99c.obscpio
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ openSUSE-release-tools.spec ++++++
--- /var/tmp/diff_new_pack.IQNCtm/_old 2021-07-29 21:33:07.520685258 +0200
+++ /var/tmp/diff_new_pack.IQNCtm/_new 2021-07-29 21:33:07.524685254 +0200
@@ -20,7 +20,7 @@
%define source_dir openSUSE-release-tools
%define announcer_filename factory-package-news
Name: openSUSE-release-tools
-Version: 20210723.7e5bacec
+Version: 20210729.455dc99c
Release: 0
Summary: Tools to aid in staging and release work for openSUSE/SUSE
License: GPL-2.0-or-later AND MIT
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.IQNCtm/_old 2021-07-29 21:33:07.564685205 +0200
+++ /var/tmp/diff_new_pack.IQNCtm/_new 2021-07-29 21:33:07.568685199 +0200
@@ -1,6 +1,6 @@
<servicedata>
<service name="tar_scm">
<param
name="url">https://github.com/openSUSE/openSUSE-release-tools.git</param>
- <param
name="changesrevision">7e5bacec144b38e1f37116ad9e7ad943a324f02f</param>
+ <param
name="changesrevision">c838245a377d88baed3e6e8b132d0db6a367b9b8</param>
</service>
</servicedata>
++++++ openSUSE-release-tools-20210723.7e5bacec.obscpio ->
openSUSE-release-tools-20210729.455dc99c.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/openSUSE-release-tools-20210723.7e5bacec/check_source.py
new/openSUSE-release-tools-20210729.455dc99c/check_source.py
--- old/openSUSE-release-tools-20210723.7e5bacec/check_source.py
2021-07-23 09:28:59.000000000 +0200
+++ new/openSUSE-release-tools-20210729.455dc99c/check_source.py
2021-07-29 12:48:27.000000000 +0200
@@ -25,6 +25,7 @@
from osclib.core import target_archs
from osclib.core import create_add_role_request
from osc.core import show_project_meta
+from osc.core import get_request_list
from urllib.error import HTTPError
import ReviewBot
@@ -170,15 +171,9 @@
(self.required_maintainer, source_project)
)
- try:
- add_role_msg = 'Created automatically from request %s' %
self.request.reqid
- add_role_reqid = create_add_role_request(self.apiurl,
source_project, self.required_maintainer,
- 'maintainer',
message=add_role_msg)
- declined_msg += ' Created the add_role request %s for
addressing this problem.' % add_role_reqid
- except HTTPError as e:
- self.logger.error(
- 'Cannot create the corresponding add_role request for %s:
%s' % (self.request.reqid, e)
- )
+ req = self.__ensure_add_role_request(source_project)
+ if req:
+ declined_msg += ' Created the add_role request %s for
addressing this problem.' % req
self.review_messages['declined'] = declined_msg
return False
@@ -341,7 +336,8 @@
"""Checks whether the source project has the required maintainer
If a 'required-source-maintainer' is set, it checks whether it is a
- maintainer for the source project.
+ maintainer for the source project. Inherited maintainership is
+ intentionally ignored to have explicit maintainer set.
source_project - source project name
"""
@@ -356,6 +352,33 @@
return self.required_maintainer in maintainers
+ def __ensure_add_role_request(self, source_project):
+ """Returns add_role request ID for given source project. Creates that
add role if needed."""
+ try:
+ add_roles = get_request_list(self.apiurl, source_project,
+ req_state=['new', 'review'], req_type='add_role')
+ add_roles = list(filter(self.__is_required_maintainer, add_roles))
+ if len(add_roles) > 0:
+ return add_roles[0].reqid
+ else:
+ add_role_msg = 'Created automatically from request %s' %
self.request.reqid
+ return create_add_role_request(self.apiurl, source_project,
self.required_maintainer,
+ 'maintainer',
message=add_role_msg)
+ except HTTPError as e:
+ self.logger.error(
+ 'Cannot create the corresponding add_role request for %s: %s'
% (self.request.reqid, e)
+ )
+
+ def __is_required_maintainer(self, request):
+ """Returns true for add role requests that adds required maintainer
user or group"""
+ action = request.actions[0]
+ user = self.required_maintainer
+ if user.startswith('group:'):
+ group = user.replace('group:', '')
+ return action.group_name == group and action.group_role ==
'maintainer'
+ else:
+ return action.person_name == user and action.person_role ==
'maintainer'
+
@staticmethod
def checkout_package(*args, **kwargs):
_stdout = sys.stdout
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/openSUSE-release-tools-20210723.7e5bacec/tests/check_source_tests.py
new/openSUSE-release-tools-20210729.455dc99c/tests/check_source_tests.py
--- old/openSUSE-release-tools-20210723.7e5bacec/tests/check_source_tests.py
2021-07-23 09:28:59.000000000 +0200
+++ new/openSUSE-release-tools-20210729.455dc99c/tests/check_source_tests.py
2021-07-29 12:48:27.000000000 +0200
@@ -80,28 +80,39 @@
self.assertReview(req_id, by_group=(REVIEW_TEAM, 'new'))
def test_no_source_maintainer(self):
- """Declines the request when the 'required_maintainer' is not
maintainer of the source project"""
+ """Declines the request when the 'required_maintainer' is not
maintainer of the source project
+
+ Create also request to add required maintainers to source project
unless it is already open
+ """
self._setup_devel_project()
# Change the required maintainer
self.wf.create_group(FACTORY_MAINTAINERS.replace('group:', ''))
self.wf.remote_config_set({ 'required-source-maintainer':
FACTORY_MAINTAINERS })
- req_id = self.wf.create_submit_request(SRC_PROJECT, 'blowfish').reqid
+ req = self.wf.create_submit_request(SRC_PROJECT, 'blowfish')
- self.assertReview(req_id, by_user=(self.bot_user, 'new'))
+ self.assertReview(req.reqid, by_user=(self.bot_user, 'new'))
- self.review_bot.set_request_ids([req_id])
+ self.review_bot.set_request_ids([req.reqid])
self.review_bot.check_requests()
- review = self.assertReview(req_id, by_user=(self.bot_user, 'declined'))
+ review = self.assertReview(req.reqid, by_user=(self.bot_user,
'declined'))
add_role_req = get_request_list(self.wf.apiurl, SRC_PROJECT,
req_state=['new'], req_type='add_role')[0]
self.assertIn('unless %s is a maintainer of %s' %
(FACTORY_MAINTAINERS, SRC_PROJECT), review.comment)
self.assertIn('Created the add_role request %s' % add_role_req.reqid,
review.comment)
self.assertEqual(add_role_req.actions[0].tgt_project, SRC_PROJECT)
- self.assertEqual('Created automatically from request %s' % req_id,
add_role_req.description)
+ self.assertEqual('Created automatically from request %s' % req.reqid,
add_role_req.description)
+
+ # reopen request and do it again to test that new add_role request
won't be created
+ req.change_state('new')
+
+ self.review_bot.check_requests()
+ add_role_reqs = get_request_list(self.wf.apiurl, SRC_PROJECT,
req_state=['new'], req_type='add_role')
+
+ self.assertEqual(len(add_role_reqs), 1)
def test_source_maintainer(self):
"""Accepts the request when the 'required_maintainer' is a group and
is a maintainer for the project"""
@@ -121,6 +132,34 @@
self.assertReview(req_id, by_user=(self.bot_user, 'accepted'))
self.assertReview(req_id, by_group=(REVIEW_TEAM, 'new'))
+ def test_source_inherited_maintainer(self):
+ """Declines the request when the 'required_maintainer' is only
inherited maintainer of the source project"""
+ # Change the required maintainer
+ group_name = FACTORY_MAINTAINERS.replace('group:', '')
+ self.wf.create_group(group_name)
+ self.wf.remote_config_set({ 'required-source-maintainer':
FACTORY_MAINTAINERS })
+
+ root_project = self.wf.create_project(SRC_PROJECT.rsplit(':', 1)[0],
+ maintainer={'groups': [group_name]})
+
+ self._setup_devel_project()
+
+ req = self.wf.create_submit_request(SRC_PROJECT, 'blowfish')
+
+ self.assertReview(req.reqid, by_user=(self.bot_user, 'new'))
+
+ self.review_bot.set_request_ids([req.reqid])
+ self.review_bot.check_requests()
+
+ review = self.assertReview(req.reqid, by_user=(self.bot_user,
'declined'))
+ add_role_req = get_request_list(self.wf.apiurl, SRC_PROJECT,
req_state=['new'], req_type='add_role')[0]
+
+ self.assertIn('unless %s is a maintainer of %s' %
(FACTORY_MAINTAINERS, SRC_PROJECT), review.comment)
+ self.assertIn('Created the add_role request %s' % add_role_req.reqid,
review.comment)
+
+ self.assertEqual(add_role_req.actions[0].tgt_project, SRC_PROJECT)
+ self.assertEqual('Created automatically from request %s' % req.reqid,
add_role_req.description)
+
def _setup_devel_project(self, maintainer={}):
devel_project = self.wf.create_project(SRC_PROJECT,
maintainer=maintainer)
devel_package = OBSLocal.Package('blowfish', project=devel_project)
++++++ openSUSE-release-tools.obsinfo ++++++
--- /var/tmp/diff_new_pack.IQNCtm/_old 2021-07-29 21:33:08.196684426 +0200
+++ /var/tmp/diff_new_pack.IQNCtm/_new 2021-07-29 21:33:08.196684426 +0200
@@ -1,5 +1,5 @@
name: openSUSE-release-tools
-version: 20210723.7e5bacec
-mtime: 1627025339
-commit: 7e5bacec144b38e1f37116ad9e7ad943a324f02f
+version: 20210729.455dc99c
+mtime: 1627555707
+commit: 455dc99c10beb8e109a8439d52c4c500da6fc26d