aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkkconfigsymbols.py
diff options
context:
space:
mode:
authorValentin Rothberg <valentinrothberg@gmail.com>2015-06-01 10:00:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-08-03 20:16:58 -0400
commita42fa92ce77a9181f9baf57655acbb241ac4d306 (patch)
tree7bbb6d5dd2e431e8c5160efa7ece478adf55b136 /scripts/checkkconfigsymbols.py
parentccf97fe3ddac231655f1f8cacede6182a167de8b (diff)
checkkconfigsymbols.py: find relevant commits
Add option -f/--find to find relevant commits when using the --diff option. --find is useful in case a user wants to check commits that potentially cause a Kconfig symbol to be missing. This is done via 'git log -G $SYMBOL' (i.e., to get a list of commits that change $SYMBOL). The relevant commits are printed below the "SYMBOL\tFILES" line, followed by an empty line to increase readability. Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Acked-by: Stefan Hengelein <stefan.hengelein@fau.de> Acked-by: Andreas Ruprecht <andreas.ruprecht@fau.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/checkkconfigsymbols.py')
-rwxr-xr-xscripts/checkkconfigsymbols.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
index c89fdcaf06e8..292848e32036 100755
--- a/scripts/checkkconfigsymbols.py
+++ b/scripts/checkkconfigsymbols.py
@@ -58,6 +58,11 @@ def parse_options():
58 "input format bases on Git log's " 58 "input format bases on Git log's "
59 "\'commmit1..commit2\'.") 59 "\'commmit1..commit2\'.")
60 60
61 parser.add_option('-f', '--find', dest='find', action='store_true',
62 default=False,
63 help="Find and show commits that may cause symbols to be "
64 "missing. Required to run with --diff.")
65
61 parser.add_option('-i', '--ignore', dest='ignore', action='store', 66 parser.add_option('-i', '--ignore', dest='ignore', action='store',
62 default="", 67 default="",
63 help="Ignore files matching this pattern. Note that " 68 help="Ignore files matching this pattern. Note that "
@@ -86,6 +91,9 @@ def parse_options():
86 "'--force' if you\nwant to ignore this warning and " 91 "'--force' if you\nwant to ignore this warning and "
87 "continue.") 92 "continue.")
88 93
94 if opts.commit:
95 opts.find = False
96
89 if opts.ignore: 97 if opts.ignore:
90 try: 98 try:
91 re.match(opts.ignore, "this/is/just/a/test.c") 99 re.match(opts.ignore, "this/is/just/a/test.c")
@@ -129,12 +137,18 @@ def main():
129 if not feature in undefined_a: 137 if not feature in undefined_a:
130 files = sorted(undefined_b.get(feature)) 138 files = sorted(undefined_b.get(feature))
131 print "%s\t%s" % (feature, ", ".join(files)) 139 print "%s\t%s" % (feature, ", ".join(files))
140 if opts.find:
141 commits = find_commits(feature, opts.diff)
142 print commits
132 # check if there are new files that reference the undefined feature 143 # check if there are new files that reference the undefined feature
133 else: 144 else:
134 files = sorted(undefined_b.get(feature) - 145 files = sorted(undefined_b.get(feature) -
135 undefined_a.get(feature)) 146 undefined_a.get(feature))
136 if files: 147 if files:
137 print "%s\t%s" % (feature, ", ".join(files)) 148 print "%s\t%s" % (feature, ", ".join(files))
149 if opts.find:
150 commits = find_commits(feature, opts.diff)
151 print commits
138 152
139 # reset to head 153 # reset to head
140 execute("git reset --hard %s" % head) 154 execute("git reset --hard %s" % head)
@@ -156,6 +170,13 @@ def execute(cmd):
156 return stdout 170 return stdout
157 171
158 172
173def find_commits(symbol, diff):
174 """Find commits changing %symbol in the given range of %diff."""
175 commits = execute("git log --pretty=oneline --abbrev-commit -G %s %s"
176 % (symbol, diff))
177 return commits
178
179
159def tree_is_dirty(): 180def tree_is_dirty():
160 """Return true if the current working tree is dirty (i.e., if any file has 181 """Return true if the current working tree is dirty (i.e., if any file has
161 been added, deleted, modified, renamed or copied but not committed).""" 182 been added, deleted, modified, renamed or copied but not committed)."""