Re: [U-Boot] [PATCH 1/4] patman: Add a call to get_maintainer.pl if it exists

2012-12-03 Thread Simon Glass
On Fri, Nov 30, 2012 at 4:29 PM, Doug Anderson diand...@chromium.org wrote:
 For Linux the best way to figure out where to send a patch is with the
 get_maintainer.pl script.  Add support for calling it from patman.
 Support is added unconditionally for scripts/get_maintainer.pl in
 case it is helpful for any other projects.

 Signed-off-by: Doug Anderson diand...@chromium.org

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/4] patman: Add a call to get_maintainer.pl if it exists

2012-11-30 Thread Doug Anderson
For Linux the best way to figure out where to send a patch is with the
get_maintainer.pl script.  Add support for calling it from patman.
Support is added unconditionally for scripts/get_maintainer.pl in
case it is helpful for any other projects.

Signed-off-by: Doug Anderson diand...@chromium.org
---
 tools/patman/README|   11 ++-
 tools/patman/get_maintainer.py |   63 
 tools/patman/series.py |2 +
 3 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 tools/patman/get_maintainer.py

diff --git a/tools/patman/README b/tools/patman/README
index dc3957c..903d02f 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -43,6 +43,9 @@ Series-to: fred.bl...@napier.co.nz
 
 in one of your commits, the series will be sent there.
 
+In Linux this will also call get_maintainer.pl on each of your
+patches automatically.
+
 
 How to use this tool
 
@@ -65,8 +68,12 @@ will get a consistent result each time.
 How to configure it
 ===
 
-For most cases patman will locate and use the file 'doc/git-mailrc' in
-your U-Boot directory. This contains most of the aliases you will need.
+For most cases of using patman for U-Boot developement patman will
+locate and use the file 'doc/git-mailrc' in your U-Boot directory.
+This contains most of the aliases you will need.
+
+For Linux the 'scripts/get_maintainer.pl' handles figuring out where
+to send patches pretty well.
 
 During the first run patman creates a config file for you by taking the default
 user name and email address from the global .gitconfig file.
diff --git a/tools/patman/get_maintainer.py b/tools/patman/get_maintainer.py
new file mode 100644
index 000..cb11373
--- /dev/null
+++ b/tools/patman/get_maintainer.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2012 The Chromium OS Authors.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+import command
+import gitutil
+import os
+
+def FindGetMaintainer():
+Look for the get_maintainer.pl script.
+
+Returns:
+If the script is found we'll return a path to it; else None.
+
+try_list = [
+os.path.join(gitutil.GetTopLevel(), 'scripts'),
+]
+# Look in the list
+for path in try_list:
+fname = os.path.join(path, 'get_maintainer.pl')
+if os.path.isfile(fname):
+return fname
+
+return None
+
+def GetMaintainer(fname, verbose=False):
+Run get_maintainer.pl on a file if we find it.
+
+We look for get_maintainer.pl in the 'scripts' directory at the top of
+git.  If we find it we'll run it.  If we don't find get_maintainer.pl
+then we fail silently.
+
+Args:
+fname: Path to the patch file to run get_maintainer.pl on.
+
+Returns:
+A list of email addresses to CC to.
+
+get_maintainer = FindGetMaintainer()
+if not get_maintainer:
+if verbose:
+print WARNING: Couldn't find get_maintainer.pl
+return []
+
+stdout = command.Output(get_maintainer, '--norolestats', fname)
+return stdout.splitlines()
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 083af0f..6c5c570 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -22,6 +22,7 @@
 import itertools
 import os
 
+import get_maintainer
 import gitutil
 import terminal
 
@@ -225,6 +226,7 @@ class Series(dict):
 if process_tags:
 list += gitutil.BuildEmailList(commit.tags)
 list += gitutil.BuildEmailList(commit.cc_list)
+list += get_maintainer.GetMaintainer(commit.patch)
 all_ccs += list
 print fd, commit.patch, ', '.join(list)
 self._generated_cc[commit.patch] = list
-- 
1.7.7.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot