mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Moffett <mrmacman_g4@mac.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>, Rene Herman <rene.herman@gmail.com>
Cc: Dave Jones <davej@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Joe Perches <joe@perches.com>, Pavel Machek <pavel@ucw.cz>,
	linux-pm@lists.linux-foundation.org,
	LKML Kernel <linux-kernel@vger.kernel.org>,
	Salikh Zakirov <salikh@gmail.com>,
	git@vger.kernel.org
Subject: Storing Maintainers info around the kernel tree
Date: Thu, 16 Aug 2007 09:04:50 -0400	[thread overview]
Message-ID: <D31EF534-ACD1-426D-AF88-F152C23CB542@mac.com> (raw)
In-Reply-To: <200708151321.05959.rjw@sisk.pl>

[-- Attachment #1: Type: text/plain, Size: 4286 bytes --]

Merging a couple related threads here:

On Aug 16, 2007, at 07:57:23, Rene Herman wrote:
> On 08/16/2007 01:26 PM, Salikh Zakirov wrote:
>> Rene Herman wrote:
>>> Perhaps that immediately suggests an implementation to someone  
>>> already familiar with git internals?
>> perhaps http://www.kernel.org/pub/software/scm/git/docs/ 
>> gitattributes.html and http://www.kernel.org/pub/software/scm/git/ 
>> docs/git-check-attr.html can help you?
>
> No, thanks, saw them, but .gitattributes is in fact in the same  
> category as .gitignore, which would _be_ a property.
>
> If you do this stuff in files scattered around the tree, updating  
> and moving stuff becomes a pain -- the tool would need to go edit  
> files.

 From a practical standpoint we don't want to duplicate someone's  
maintainer information in the attributes of every file they  
maintain.  It would be much easier to put in the "kernel/somesubsys"  
directory a Maintainers file which has:

[SOME RANDOM SUBSYSTEM]
P: J. Random Hacker
M: j.random.hacker@localhost
L: random-subsys-devel@vger.kernel.org
F: *

Anywhere else you had files that you wanted to associate with J.  
Random Hacker's maintainership, you would just use:

[SOME RANDOM SUBSYSTEM]
F: somesubsys.h


I posted a comment describing a mechanism like this a couple days ago:
   http://lkml.org/lkml/2007/8/14/488

Executive overview:
On Aug 15, 2007, at 07:21:04, Rafael J. Wysocki wrote:
> On Wednesday, 15 August 2007 04:51, Kyle Moffett wrote:
>> (a) "Maintainers" files sprinkled around the source tree with  
>> relative pathnames and other data
>>
>> (b) Tool to generate a combined "MAINTAINERS" file from the ones  
>> sprinkled around the source tree
>>
>> (c) Tool to search through the generated "MAINTAINERS" file with  
>> all sorts of useful command-line options
>>
>> (d) Tool to check the generated "MAINTAINERS" file against recent  
>> git history and make suggestions
>
> I like this idea. :-)

Well, to back up this idea with some code, I'm attaching a little  
perl script which does part (b).  Basically you call it as:
   ./maint-combine $(find . -name Maintainers)

It will print any syntax errors on stderr during parsing.  Once it's  
done it will dump to stdout its combined "MAINTAINERS" text.  A  
couple notes:

*  It uses a little "priority" system to figure out what order to  
print the data from each origin in.  For example, the "F:" tag is  
given a score of 0, to force data consisting of just files towards  
the end.  The "P:", "M:", and "L:" tags are given scores of 5, since  
people are generally interesting to know about.  Everything else is  
given a score of "1".  The scores are added up per ($file,  
$subsystem) pair and then during printing each subsystem's data is  
ordered by score (highest comes first).

*  It generally allows any field at all; eventually we might want to  
limit it to a fixed list to help avoid typos.

*  It has a little bit of magic logic for the "F:" field so that it  
figures out the relative directory for each field when generating the  
output.  For example, an entry of "asm-*/suspend.h" in a file  
"include/Maintainers" will produce the output file entry: "F: include/ 
asm-*/suspend.h"

*  The format isn't quite the same as the current MAINTAINERS file,  
to make parsing easier and more dummy-proof I changed the syntax for  
a subsystem-name to use square brackets (IE: "[SUSPEND TO RAM]").   
The samples I gave in my previous email are what I used to test it  
with, plus a little dummy file with some syntax errors to check out  
the error messages:

Maintainers:
> [EVERYTHING ELSE]
> P: Various Linux Kernel Developers
> L: linux-kernel@vger.kernel.org
> F: *

kernel/power/Maintainers:
> [SUSPEND TO RAM]
> P: Pavel Machek
> M: pavel@suse.cz
> P: Rafael J. Wysocki
> M: rjw@sisk.pl
> L: linux-pm@lists.linux-foundation.org
> S: Maintained
> F: *

include/Maintainers:
> [SUSPEND TO RAM]
> F: linux/suspend.h
> F: linux/freezer.h
> F: linux/pm.h
> F: asm-*/suspend.h



If you have any other questions, the perl script is pretty self- 
explanatory and I'll be completely back online this weekend.  With  
any luck I'll have some time in a hotel tomorrow (mmm, slow-as-dirt  
hotel wireless, what fun) to work on parts (c) and (d).

Cheers,
Kyle Moffett


[-- Attachment #2: maint-combine.txt --]
[-- Type: text/plain, Size: 2040 bytes --]

#! /usr/bin/perl

use strict;
use warnings;

## This table is for determining what order to show entries from different
## source "Maintainers" files.  They are prioritized based on the number and
## significance of each field, as listed in this table.  Any field not found
## here will be assumed to have a significance of "1".
my %fieldprio = (
	p => 5,  ## Person
	m => 5,  ## Email
	l => 5,  ## Mailing List
	f => 0,  ## File
);


my %mprio;
my %maint;
my $section;
my $origin;
my $pathprefix;
my $printorigin;

while (<>) {
	unless (defined $origin and $origin eq $ARGV) {
		undef $section;

		## Get rid of extra slashes, unnecessary "./" entries
		$ARGV =~ s{//+}{/}g;
		$ARGV =~ s{(^|/)\./}{$1};

		$origin = $ARGV;
	}

	chomp; s/\s+/ /g; s/^ //; s/ $//;
	/\S+/ or next;

	if (/^\[ ?([^]]+) ?\]$/) {
		$section = uc $1;

		$printorigin = 1 if $origin ne '-';

		$maint{$section}{$origin} ||= [];
		$mprio{$section}{$origin} ||= 0;

		## Figure out a useful path prefix if there is one
		$pathprefix = ($origin =~ m{(^.*/)(?!\.\.?$)[^/]+$})?$1:"";

		next;
	}

	unless (/^([^:]+?) ?: ?(.*)$/) {
		print STDERR "$ARGV:$.: Invalid line: $_\n";
		next;
	}

	my($field,$value) = (lc($1), $2);

	unless (defined $section) {
		print STDERR "$ARGV:$.: Found field '\u$field' before ",
				"any subsystem declaration: $_\n";
		next;
	}

	## Preprocess paths to make them absolute
	$value = $pathprefix.$value if $field eq 'f';

	## Update the sorting order
	if (exists $fieldprio{$field}) {
		$mprio{$section}{$origin} += $fieldprio{$field};
	} else {
		$mprio{$section}{$origin}++;
	}

	push @{$maint{$section}{$origin}}, [$field, $value];
}

sub priosort ( $@ )
{
	my $section = shift;
	return sort {$mprio{$section}{$b} <=> $mprio{$section}{$a}} @_;
}

for $section (sort {$a cmp $b} keys %maint) {
	print "[$section]\n";
	for my $origin (priosort $section, keys %{$maint{$section}}) {
		print "\nOrigin: $origin\n" if $printorigin;
		print "\u$_->[0]: $_->[1]\n" for @{$maint{$section}{$origin}};
	}
	print "\n\n";
}

# vim:set ft=perl:

  reply	other threads:[~2007-08-16 13:05 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-13  6:36 [PATCH] [443/2many] MAINTAINERS - HIBERNATION (aka Software Suspend, aka swsusp): joe
2007-08-13 14:18 ` Pavel Machek
2007-08-13 20:50 ` Rafael J. Wysocki
2007-08-13 20:54   ` Joe Perches
2007-08-13 21:25     ` Rafael J. Wysocki
2007-08-13 21:21       ` Joe Perches
2007-08-13 21:38         ` Rafael J. Wysocki
2007-08-14  7:05           ` Pavel Machek
2007-08-14 17:37             ` Rafael J. Wysocki
2007-08-14 17:57               ` Joe Perches
2007-08-14 18:14                 ` Rafael J. Wysocki
2007-08-14 18:15                 ` Linus Torvalds
2007-08-14 18:22                   ` Andrew Morton
2007-08-14 23:24                     ` Dave Jones
2007-08-15  2:51                       ` Kyle Moffett
2007-08-15 11:21                         ` Rafael J. Wysocki
2007-08-16 13:04                           ` Kyle Moffett [this message]
2007-08-16 15:13                             ` Storing Maintainers info around the kernel tree Rene Herman
2007-08-16 15:31                               ` [linux-pm] " Alan Stern
2007-08-16 15:50                                 ` Rene Herman
2007-08-16 21:39                                   ` Stefan Richter
2007-08-17  1:43                                     ` Rene Herman
2007-08-17  1:58                                       ` Alan Stern
2007-08-17  2:18                                         ` Rene Herman
2007-08-17  6:25                                           ` Stefan Richter
2007-08-14 18:25                   ` [PATCH] [443/2many] MAINTAINERS - HIBERNATION (aka Software Suspend, aka swsusp): Rene Herman
2007-08-14 18:42                   ` Joe Perches
2007-08-15  1:45                   ` Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=D31EF534-ACD1-426D-AF88-F152C23CB542@mac.com \
    --to=mrmacman_g4@mac.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=git@vger.kernel.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@ucw.cz \
    --cc=rene.herman@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=salikh@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®