From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 919FC7803CC for ; Wed, 8 Nov 2023 20:43:34 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=7DBcs7rziC2xTLvfyKH+am9ZJiDZOfhhDSS3+tjBr80=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1699476213; v=1; b=LG3owsB7hlO8xi1+IIVrbSjc0ROb2zu/j/Yzs8d9SiJ28MIkVnq3R4lJaZlN3pjko985tPYr +er3U1OXuPa3KbDRz8qjFASfzuFsixEmjfpRviMBUTG9MGIV4QfZKBKiC5sVVdloOPOEnbJd4wS WM2MqcH8zLFjozLUTHWXQifo= X-Received: by 127.0.0.2 with SMTP id UVlnYY7687511xzihJ2XiRKf; Wed, 08 Nov 2023 12:43:33 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.51801.1699476212201032695 for ; Wed, 08 Nov 2023 12:43:32 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10888"; a="420956001" X-IronPort-AV: E=Sophos;i="6.03,287,1694761200"; d="scan'208";a="420956001" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2023 12:43:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10888"; a="886769223" X-IronPort-AV: E=Sophos;i="6.03,287,1694761200"; d="scan'208";a="886769223" X-Received: from shubhans-mobl.amr.corp.intel.com (HELO mdkinney-mobl.amr.corp.intel.com) ([10.212.163.175]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2023 12:43:27 -0800 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen , Leif Lindholm Subject: [edk2-devel] [edk2-stable202311][Patch 1/1] BaseTools/Scripts: Handle reviewer only case in GetMaintainer.py Date: Wed, 8 Nov 2023 12:43:23 -0800 Message-Id: <20231108204323.1292-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 31zHCcPG2XqoeCe4O6RdcHYVx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=LG3owsB7; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4593 If a package only has reviewers and no maintainers, then also return the maintainers. Update get_maintainers() to return maintainers, reviews, and lists separately instead of a single merged list to allow this module to be used by other scripts and distinguish types. Sort the list of output addresses alphabetically. Fix logic bug where maintainers was incorrectly added to lists. Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Cc: Leif Lindholm Signed-off-by: Michael D Kinney --- BaseTools/Scripts/GetMaintainer.py | 42 ++++++++++++++++++------------ 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/BaseTools/Scripts/GetMaintainer.py b/BaseTools/Scripts/GetMaintainer.py index d1e042c0afe4..b33546b10f21 100644 --- a/BaseTools/Scripts/GetMaintainer.py +++ b/BaseTools/Scripts/GetMaintainer.py @@ -76,6 +76,7 @@ def get_section_maintainers(path, section): """Returns a list with email addresses to any M: and R: entries matching the provided path in the provided section.""" maintainers = [] + reviewers = [] lists = [] nowarn_status = ['Supported', 'Maintained'] @@ -83,12 +84,18 @@ def get_section_maintainers(path, section): for status in section['status']: if status not in nowarn_status: print('WARNING: Maintained status for "%s" is \'%s\'!' % (path, status)) - for address in section['maintainer'], section['reviewer']: + for address in section['maintainer']: # Convert to list if necessary if isinstance(address, list): maintainers += address else: - lists += [address] + maintainers += [address] + for address in section['reviewer']: + # Convert to list if necessary + if isinstance(address, list): + reviewers += address + else: + reviewers += [address] for address in section['list']: # Convert to list if necessary if isinstance(address, list): @@ -96,32 +103,34 @@ def get_section_maintainers(path, section): else: lists += [address] - return maintainers, lists + return maintainers, reviewers, lists def get_maintainers(path, sections, level=0): """For 'path', iterates over all sections, returning maintainers for matching ones.""" maintainers = [] + reviewers = [] lists = [] for section in sections: - tmp_maint, tmp_lists = get_section_maintainers(path, section) - if tmp_maint: - maintainers += tmp_maint - if tmp_lists: - lists += tmp_lists + tmp_maint, tmp_review, tmp_lists = get_section_maintainers(path, section) + maintainers += tmp_maint + reviewers += tmp_review + lists += tmp_lists if not maintainers: # If no match found, look for match for (nonexistent) file # REPO.working_dir/ print('"%s": no maintainers found, looking for default' % path) if level == 0: - maintainers = get_maintainers('', sections, level=level + 1) + maintainers, tmp_review, tmp_lists = get_maintainers('', sections, level=level + 1) + reviewers += tmp_review + lists += tmp_lists else: print("No maintainers set for project.") if not maintainers: return None - return maintainers + lists + return maintainers, reviewers, lists def parse_maintainers_line(line): """Parse one line of Maintainers.txt, returning any match group and its key.""" @@ -182,15 +191,16 @@ if __name__ == '__main__': else: FILES = get_modified_files(REPO, ARGS) - ADDRESSES = [] - + # Accumulate a sorted list of addresses + ADDRESSES = set([]) for file in FILES: print(file) - addresslist = get_maintainers(file, SECTIONS) - if addresslist: - ADDRESSES += addresslist + maintainers, reviewers, lists = get_maintainers(file, SECTIONS) + ADDRESSES |= set(maintainers + reviewers + lists) + ADDRESSES = list(ADDRESSES) + ADDRESSES.sort() - for address in list(OrderedDict.fromkeys(ADDRESSES)): + for address in ADDRESSES: if '<' in address and '>' in address: address = address.split('>', 1)[0] + '>' print(' %s' % address) -- 2.40.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#110925): https://edk2.groups.io/g/devel/message/110925 Mute This Topic: https://groups.io/mt/102472591/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-