lkml.org 
[lkml]   [2010]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] scripts/get_maintainer.pl: add .get_maintainer.conf default options file
On Sat, 08 May 2010 15:26:49 -0700
Joe Perches <joe@perches.com> wrote:

> Allow the use of a .get_maintainer.conf file to control the
> default options applied when scripts/get_maintainer.pl is run.
>
> .get_maintainer.conf entries can be any valid argument.
>
> Multiple lines may be used, blank lines ignored, # is a comment
>
> Signed-off-by: Joe Perches <joe@perches.com>

probably worth noting, that an entry is of the form

"--cmdlinearg"

as that's unexpected for a config file.

> ---
> scripts/get_maintainer.pl | 24 ++++++++++++++++++++++++
> 1 files changed, 24 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
> index 6f97a13..0c4c7e0 100755
> --- a/scripts/get_maintainer.pl
> +++ b/scripts/get_maintainer.pl
> @@ -97,6 +97,30 @@ my %VCS_cmds_hg = (
> "blame_commit_pattern" => "^([0-9a-f]+):"
> );
>
> +if (-f ${lk_path}.get_maintainer.conf) {

missing "" around the argument to -f ...

i wouldn't put the trailing slash in the variables but add it when composing path's.
but it seems this is the convention for get_maintainer.pl...




> + my @conf_args;
> + open(my $conffile, '<', "${lk_path}.get_maintainer.conf")
> + or warn "$P: Can't open .get_maintainer.conf: $!\n";
> + while (<$conffile>) {
> + my $line = $_;
> +
> + $line =~ s/\s*\n?$//g;
> + $line =~ s/^\s*//g;
> + $line =~ s/\s+/ /g;
> +
> + next if ($line =~ m/^\s*#/);
> + next if ($line =~ m/^\s*$/);
> +
> + my @words = split(" ", $line);
> + foreach my $word (@words) {
> + last if ($word =~ m/^#/);
> + push (@conf_args, $word);
> + }
> + }
> + close($conffile);
> + unshift(@ARGV, @conf_args) if @conf_args;
> +}
this works.

> +
> if (!GetOptions(
> 'email!' => \$email,
> 'git!' => \$email_git,
>

Reviewed-by:Florian Mickler <florian@mickler.org>



\
 
 \ /
  Last update: 2010-05-09 11:15    [W:0.068 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site