[dpdk-ci] [PATCH v2 04/10] tools: add functionality for detecting tree maintainers

Thomas Monjalon thomas at monjalon.net
Thu Sep 30 10:29:54 CEST 2021


21/09/2021 16:35, alialnu at nvidia.com:
> From: Ali Alnubani <alialnu at nvidia.com>
> 
> Detecting a maintainer works by searching the
> 'General Project Administration' section for subsections
> containing the provided tree, and then returning the maintainers
> specified in that subsection.
> 
> Signed-off-by: Ali Alnubani <alialnu at nvidia.com>
> ---
> @@ -118,6 +120,7 @@ class Maintainers(object):
>  
>      file_regex = r'F:\s(.*)'
>      tree_regex = r'T: (?P<url>git:\/\/dpdk\.org(?:\/next)*\/(?P<name>.*))'
> +    maintainer_regex = r'M:\s(.*)'
>      section_regex = r'([^\n]*)\n-+.*?(?=([^\n]*\n-+)|\Z)'
>      subsection_regex = r'[^\n](?:(?!\n{{2}}).)*?^{}: {}$(?:(?!\n{{2}}).)*'
>  
> @@ -141,6 +144,26 @@ class Maintainers(object):
>          # Save already matched patterns.
>          self.matched = {}
>  
> +    def get_maintainers(self, tree):
> +        """
> +        Return a list of a tree's maintainers."""
> +        maintainers = []
> +        for section in self.sections:
> +            if section.group(1) == 'General Project Administration':

Should this constant string be declared above with other regex?

> +                # Find the block containing the tree.
> +                regex = self.subsection_regex.format('T', re.escape(tree))
> +                subsection_match = re.findall(
> +                        regex,
> +                        section.group(0),
> +                        re.DOTALL | re.MULTILINE)
> +                if len(subsection_match):
> +                    subsection = subsection_match[-1]
> +                    # Look for maintainers
> +                    maintainers = re.findall(
> +                            self.maintainer_regex, subsection)
> +                    return maintainers
> +                break





More information about the ci mailing list