Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 5 additions & 21 deletions Documentation/maintainer/maintainer-entry-profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,24 +92,8 @@ full series, or privately send a reminder email. This section might also
list how review works for this code area and methods to get feedback
that are not directly from the maintainer.

Existing profiles
-----------------

For now, existing maintainer profiles are listed here; we will likely want
to do something different in the near future.

.. toctree::
:maxdepth: 1

../doc-guide/maintainer-profile
../nvdimm/maintainer-entry-profile
../arch/riscv/patch-acceptance
../process/maintainer-soc
../process/maintainer-soc-clean-dts
../driver-api/media/maintainer-entry-profile
../process/maintainer-netdev
../driver-api/vfio-pci-device-specific-driver-acceptance
../nvme/feature-and-quirk-policy
../filesystems/nfs/nfsd-maintainer-entry-profile
../filesystems/xfs/xfs-maintainer-entry-profile
../mm/damon/maintainer-profile
Maintainer Handbooks
--------------------

For examples of other subsystem handbooks see
Documentation/process/maintainer-handbooks.rst.
17 changes: 8 additions & 9 deletions Documentation/process/maintainer-handbooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ The purpose of this document is to provide subsystem specific information
which is supplementary to the general development process handbook
:ref:`Documentation/process <development_process_main>`.

Contents:
For developers, see below for all the known subsystem specific guides.
If the subsystem you are contributing to does not have a guide listed
here, it is fair to seek clarification of questions raised in
Documentation/maintainer/maintainer-entry-profile.rst.

.. toctree::
:numbered:
:maxdepth: 2
For maintainers, consider documenting additional requirements and
expectations if submissions routinely overlook specific submission
criteria. See Documentation/maintainer/maintainer-entry-profile.rst.

maintainer-netdev
maintainer-soc
maintainer-soc-clean-dts
maintainer-tip
maintainer-kvm-x86
.. maintainers-profile-toc::
131 changes: 114 additions & 17 deletions Documentation/sphinx/maintainers_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import re
import os.path

from textwrap import indent

from docutils import statemachine
from docutils.parsers.rst import Directive
from docutils.parsers.rst.directives.misc import Include
Expand All @@ -30,20 +32,12 @@ def ErrorString(exc): # Shamelessly stolen from docutils

__version__ = '1.0'

def setup(app):
app.add_directive("maintainers-include", MaintainersInclude)
return dict(
version = __version__,
parallel_read_safe = True,
parallel_write_safe = True
)

class MaintainersInclude(Include):
"""MaintainersInclude (``maintainers-include``) directive"""
required_arguments = 0
class MaintainersParser:
"""Parse MAINTAINERS file(s) content"""

def parse_maintainers(self, path):
"""Parse all the MAINTAINERS lines into ReST for human-readability"""
def __init__(self, base_path, path):
self.profiles = {}
self.profile_urls = {}

result = list()
result.append(".. _maintainers:")
Expand All @@ -61,6 +55,7 @@ def parse_maintainers(self, path):
prev = None
field_prev = ""
field_content = ""
subsystem_name = None

for line in open(path):
# Have we reached the end of the preformatted Descriptions text?
Expand All @@ -78,6 +73,27 @@ def parse_maintainers(self, path):
# Drop needless input whitespace.
line = line.rstrip()

match = re.match(r"P:\s*(Documentation/\S+)\.rst", line)
if match:
fname = os.path.relpath(match.group(1), base_path)
if fname.startswith("../"):
if self.profiles.get(fname) is None:
self.profiles[fname] = subsystem_name
else:
self.profiles[fname] += f", {subsystem_name}"
else:
self.profiles[fname] = None

match = re.match(r"P:\s*(https?://.*)", line)
if match:
url = match.group(1).strip()
if url not in self.profile_urls:
if self.profile_urls.get(url) is None:
self.profile_urls[url] = subsystem_name
else:
self.profile_urls[url] += f", {subsystem_name}"


# Linkify all non-wildcard refs to ReST files in Documentation/.
pat = r'(Documentation/([^\s\?\*]*)\.rst)'
m = re.search(pat, line)
Expand Down Expand Up @@ -113,6 +129,8 @@ def parse_maintainers(self, path):
output = field_content + "\n\n"
field_content = ""

subsystem_name = line.title()

# Collapse whitespace in subsystem name.
heading = re.sub(r"\s+", " ", line)
output = output + "%s\n%s" % (heading, "~" * len(heading))
Expand Down Expand Up @@ -165,12 +183,81 @@ def parse_maintainers(self, path):
for separated in field_content.split('\n'):
result.append(separated)

output = "\n".join(result)
self.output = "\n".join(result)

# Create a TOC class

class MaintainersInclude(Include):
"""MaintainersInclude (``maintainers-include``) directive"""
required_arguments = 0

def emit(self, base_path, path):
"""Parse all the MAINTAINERS lines into ReST for human-readability"""

output = MaintainersParser(base_path, path).output

# For debugging the pre-rendered results...
#print(output, file=open("/tmp/MAINTAINERS.rst", "w"))

self.state_machine.insert_input(
statemachine.string2lines(output), path)
self.state_machine.insert_input(statemachine.string2lines(output), path)

def run(self):
"""Include the MAINTAINERS file as part of this reST file."""
if not self.state.document.settings.file_insertion_enabled:
raise self.warning('"%s" directive disabled.' % self.name)

# Walk up source path directories to find Documentation/../
path = self.state_machine.document.attributes['source']
path = os.path.realpath(path)
tail = path
while tail != "Documentation" and tail != "":
(path, tail) = os.path.split(path)

# Append "MAINTAINERS"
path = os.path.join(path, "MAINTAINERS")
base_path = os.path.dirname(self.state.document.document.current_source)

try:
self.state.document.settings.record_dependencies.add(path)
lines = self.emit(base_path, path)
except IOError as error:
raise self.severe('Problems with "%s" directive path:\n%s.' %
(self.name, ErrorString(error)))

return []

class MaintainersProfile(Include):
required_arguments = 0

def emit(self, base_path, path):
"""Parse all the MAINTAINERS lines looking for profile entries"""

maint = MaintainersParser(base_path, path)

output = ".. toctree::\n"
output += " :maxdepth: 1\n\n"

items = sorted(maint.profiles.items(),
key=lambda kv: (kv[1] or "", kv[0]))
for fname, profile in items:
if profile:
output += f" {profile} <{fname}>\n"
else:
output += f" {fname}\n"

output += "\n**External profiles**\n\n"

items = sorted(maint.profile_urls.items(),
key=lambda kv: (kv[1] or "", kv[0]))
for url, profile in items:
if profile:
output += f"- {profile} <{url}>\n"
else:
output += f"- {url}\n"

output += "\n"

self.state_machine.insert_input(statemachine.string2lines(output), path)

def run(self):
"""Include the MAINTAINERS file as part of this reST file."""
Expand All @@ -186,12 +273,22 @@ def run(self):

# Append "MAINTAINERS"
path = os.path.join(path, "MAINTAINERS")
base_path = os.path.dirname(self.state.document.document.current_source)

try:
self.state.document.settings.record_dependencies.add(path)
lines = self.parse_maintainers(path)
lines = self.emit(base_path, path)
except IOError as error:
raise self.severe('Problems with "%s" directive path:\n%s.' %
(self.name, ErrorString(error)))

return []

def setup(app):
app.add_directive("maintainers-include", MaintainersInclude)
app.add_directive("maintainers-profile-toc", MaintainersProfile)
return dict(
version = __version__,
parallel_read_safe = True,
parallel_write_safe = True
)
2 changes: 2 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -16108,6 +16108,7 @@ S: Maintained
W: https://linuxtv.org
Q: http://patchwork.kernel.org/project/linux-media/list/
T: git git://linuxtv.org/media.git
P: Documentation/driver-api/media/maintainer-entry-profile.rst
F: Documentation/admin-guide/media/
F: Documentation/devicetree/bindings/media/
F: Documentation/driver-api/media/
Expand Down Expand Up @@ -28547,6 +28548,7 @@ M: Ingo Molnar <mingo@redhat.com>
M: Borislav Petkov <bp@alien8.de>
M: Dave Hansen <dave.hansen@linux.intel.com>
M: x86@kernel.org
P: Documentation/process/maintainer-tip.rst
R: "H. Peter Anvin" <hpa@zytor.com>
L: linux-kernel@vger.kernel.org
S: Maintained
Expand Down
Loading