]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-fsl-qoriq
authorTom Rini <trini@ti.com>
Wed, 10 Sep 2014 00:01:59 +0000 (20:01 -0400)
committerTom Rini <trini@ti.com>
Wed, 10 Sep 2014 00:01:59 +0000 (20:01 -0400)
12 files changed:
tools/buildman/README
tools/buildman/board.py
tools/buildman/builder.py
tools/buildman/builderthread.py
tools/buildman/buildman.py
tools/buildman/control.py
tools/buildman/toolchain.py
tools/patman/gitutil.py
tools/patman/patchstream.py
tools/patman/patman.py
tools/patman/terminal.py
tools/patman/test.py

index d4e840480a0922964e1fa90b0069bff984362ef0..8ba19ec1030d8bf82a10ef1b8534ddb9c849955d 100644 (file)
@@ -114,6 +114,13 @@ the '&' operator to limit the selection:
 * 'freescale & arm sandbox'  All Freescale boards with ARM architecture,
                              plus sandbox
 
+You can also use -x to specifically exclude some boards. For example:
+
+ buildmand arm -x nvidia,freescale,.*ball$
+
+means to build all arm boards except nvidia, freescale and anything ending
+with 'ball'.
+
 It is convenient to use the -n option to see whaat will be built based on
 the subset given.
 
@@ -435,7 +442,11 @@ is fixed, but there is a new one at line 126. This is probably only because
 we added some code and moved the broken line father down the file.
 
 If many boards have the same error, then -e will display the error only
-once. This makes the output as concise as possible.
+once. This makes the output as concise as possible. To see which boards have
+each error, use -l.
+
+Buildman tries to distinguish warnings from errors, and shows warning lines
+separately with a 'w' prefix.
 
 The full build output in this case is available in:
 
@@ -670,7 +681,9 @@ snapper9g45=${at91-boards} BUILD_TAG=443
 This will use 'make ENABLE_AT91_TEST=1 BUILD_TAG=442' for snapper9260
 and 'make ENABLE_AT91_TEST=1 BUILD_TAG=443' for snapper9g45. A special
 variable ${target} is available to access the target name (snapper9260 and
-snapper9g20 in this case). Variables are resolved recursively.
+snapper9g20 in this case). Variables are resolved recursively. Note that
+variables can only contain the characters A-Z, a-z, 0-9, hyphen (-) and
+underscore (_).
 
 It is expected that any variables added are dealt with in U-Boot's
 config.mk file and documented in the README.
@@ -690,6 +703,12 @@ Other options
 
 Buildman has various other command line options. Try --help to see them.
 
+When doing builds, Buildman's return code will reflect the overall result:
+
+    0 (success)     No errors or warnings found
+    128             Errors found
+    129             Warnings found
+
 
 How to change from MAKEALL
 ==========================
@@ -730,10 +749,10 @@ followed by (afterwards, or perhaps concurrently in another terminal):
 to see the results of the build. Rather than showing you all the output,
 buildman just shows a summary, with red indicating that a commit introduced
 an error and green indicating that a commit fixed an error. Use the -e
-flag to see the full errors.
+flag to see the full errors and -l to see which boards caused which errors.
 
 If you really want to see build results as they happen, use -v when doing a
-build (and -e if you want to see errors as well).
+build (-e will be enabled automatically).
 
 You don't need to stick around on that branch while buildman is running. It
 checks out its own copy of the source code, so you can change branches,
index a3332876240ea673e02c51db3d0bcab0e181e387..5d536d5f20049fc40dd78880632ac10257bcd4c8 100644 (file)
@@ -239,13 +239,14 @@ class Boards:
             terms.append(term)
         return terms
 
-    def SelectBoards(self, args):
+    def SelectBoards(self, args, exclude=[]):
         """Mark boards selected based on args
 
         Args:
-            List of strings specifying boards to include, either named, or
-            by their target, architecture, cpu, vendor or soc. If empty, all
-            boards are selected.
+            args: List of strings specifying boards to include, either named,
+                  or by their target, architecture, cpu, vendor or soc. If
+                  empty, all boards are selected.
+            exclude: List of boards to exclude, regardless of 'args'
 
         Returns:
             Dictionary which holds the number of boards which were selected
@@ -258,17 +259,33 @@ class Boards:
         for term in terms:
             result[str(term)] = 0
 
+        exclude_list = []
+        for expr in exclude:
+            exclude_list.append(Expr(expr))
+
         for board in self._boards:
+            matching_term = None
+            build_it = False
             if terms:
                 match = False
                 for term in terms:
                     if term.Matches(board.props):
-                        board.build_it = True
-                        result[str(term)] += 1
-                        result['all'] += 1
+                        matching_term = str(term)
+                        build_it = True
                         break
             else:
+                build_it = True
+
+            # Check that it is not specifically excluded
+            for expr in exclude_list:
+                if expr.Matches(board.props):
+                    build_it = False
+                    break
+
+            if build_it:
                 board.build_it = True
+                if matching_term:
+                    result[matching_term] += 1
                 result['all'] += 1
 
         return result
index a555bd81fc4826dffe410b0fc87996437f4abbd8..324239a84126bfc676c7f67fac37d60e252c9309 100644 (file)
@@ -140,6 +140,7 @@ class Builder:
     Private members:
         _base_board_dict: Last-summarised Dict of boards
         _base_err_lines: Last-summarised list of errors
+        _base_warn_lines: Last-summarised list of warnings
         _build_period_us: Time taken for a single build (float object).
         _complete_delay: Expected delay until completion (timedelta)
         _next_delay_update: Next time we plan to display a progress update
@@ -214,6 +215,11 @@ class Builder:
 
         self.col = terminal.Color()
 
+        self._re_function = re.compile('(.*): In function.*')
+        self._re_files = re.compile('In file included from.*')
+        self._re_warning = re.compile('(.*):(\d*):(\d*): warning: .*')
+        self._re_note = re.compile('(.*):(\d*):(\d*): note: this is the location of the previous.*')
+
         self.queue = Queue.Queue()
         self.out_queue = Queue.Queue()
         for i in range(self.num_threads):
@@ -237,18 +243,21 @@ class Builder:
             del t
 
     def SetDisplayOptions(self, show_errors=False, show_sizes=False,
-                          show_detail=False, show_bloat=False):
+                          show_detail=False, show_bloat=False,
+                          list_error_boards=False):
         """Setup display options for the builder.
 
         show_errors: True to show summarised error/warning info
         show_sizes: Show size deltas
         show_detail: Show detail for each board
         show_bloat: Show detail for each function
+        list_error_boards: Show the boards which caused each error/warning
         """
         self._show_errors = show_errors
         self._show_sizes = show_sizes
         self._show_detail = show_detail
         self._show_bloat = show_bloat
+        self._list_error_boards = list_error_boards
 
     def _AddTimestamp(self):
         """Add a new timestamp to the list and record the build period.
@@ -569,19 +578,57 @@ class Builder:
             Tuple:
                 Dict containing boards which passed building this commit.
                     keyed by board.target
-                List containing a summary of error/warning lines
+                List containing a summary of error lines
+                Dict keyed by error line, containing a list of the Board
+                    objects with that error
+                List containing a summary of warning lines
+                Dict keyed by error line, containing a list of the Board
+                    objects with that warning
         """
+        def AddLine(lines_summary, lines_boards, line, board):
+            line = line.rstrip()
+            if line in lines_boards:
+                lines_boards[line].append(board)
+            else:
+                lines_boards[line] = [board]
+                lines_summary.append(line)
+
         board_dict = {}
         err_lines_summary = []
+        err_lines_boards = {}
+        warn_lines_summary = []
+        warn_lines_boards = {}
 
         for board in boards_selected.itervalues():
             outcome = self.GetBuildOutcome(commit_upto, board.target,
                                            read_func_sizes)
             board_dict[board.target] = outcome
-            for err in outcome.err_lines:
-                if err and not err.rstrip() in err_lines_summary:
-                    err_lines_summary.append(err.rstrip())
-        return board_dict, err_lines_summary
+            last_func = None
+            last_was_warning = False
+            for line in outcome.err_lines:
+                if line:
+                    if (self._re_function.match(line) or
+                            self._re_files.match(line)):
+                        last_func = line
+                    else:
+                        is_warning = self._re_warning.match(line)
+                        is_note = self._re_note.match(line)
+                        if is_warning or (last_was_warning and is_note):
+                            if last_func:
+                                AddLine(warn_lines_summary, warn_lines_boards,
+                                        last_func, board)
+                            AddLine(warn_lines_summary, warn_lines_boards,
+                                    line, board)
+                        else:
+                            if last_func:
+                                AddLine(err_lines_summary, err_lines_boards,
+                                        last_func, board)
+                            AddLine(err_lines_summary, err_lines_boards,
+                                    line, board)
+                        last_was_warning = is_warning
+                        last_func = None
+        return (board_dict, err_lines_summary, err_lines_boards,
+                warn_lines_summary, warn_lines_boards)
 
     def AddOutcome(self, board_dict, arch_list, changes, char, color):
         """Add an output to our list of outcomes for each architecture
@@ -636,6 +683,9 @@ class Builder:
         for board in board_selected:
             self._base_board_dict[board] = Builder.Outcome(0, [], [], {})
         self._base_err_lines = []
+        self._base_warn_lines = []
+        self._base_err_line_boards = {}
+        self._base_warn_line_boards = {}
 
     def PrintFuncSizeDetail(self, fname, old, new):
         grow, shrink, add, remove, up, down = 0, 0, 0, 0, 0, 0
@@ -828,6 +878,7 @@ class Builder:
 
 
     def PrintResultSummary(self, board_selected, board_dict, err_lines,
+                           err_line_boards, warn_lines, warn_line_boards,
                            show_sizes, show_detail, show_bloat):
         """Compare results with the base results and display delta.
 
@@ -843,10 +894,48 @@ class Builder:
                 commit, keyed by board.target. The value is an Outcome object.
             err_lines: A list of errors for this commit, or [] if there is
                 none, or we don't want to print errors
+            err_line_boards: Dict keyed by error line, containing a list of
+                the Board objects with that error
+            warn_lines: A list of warnings for this commit, or [] if there is
+                none, or we don't want to print errors
+            warn_line_boards: Dict keyed by warning line, containing a list of
+                the Board objects with that warning
             show_sizes: Show image size deltas
             show_detail: Show detail for each board
             show_bloat: Show detail for each function
         """
+        def _BoardList(line, line_boards):
+            """Helper function to get a line of boards containing a line
+
+            Args:
+                line: Error line to search for
+            Return:
+                String containing a list of boards with that error line, or
+                '' if the user has not requested such a list
+            """
+            if self._list_error_boards:
+                names = []
+                for board in line_boards[line]:
+                    names.append(board.target)
+                names_str = '(%s) ' % ','.join(names)
+            else:
+                names_str = ''
+            return names_str
+
+        def _CalcErrorDelta(base_lines, base_line_boards, lines, line_boards,
+                            char):
+            better_lines = []
+            worse_lines = []
+            for line in lines:
+                if line not in base_lines:
+                    worse_lines.append(char + '+' +
+                            _BoardList(line, line_boards) + line)
+            for line in base_lines:
+                if line not in lines:
+                    better_lines.append(char + '-' +
+                            _BoardList(line, base_line_boards) + line)
+            return better_lines, worse_lines
+
         better = []     # List of boards fixed since last commit
         worse = []      # List of new broken boards since last commit
         new = []        # List of boards that didn't exist last time
@@ -870,17 +959,14 @@ class Builder:
                 new.append(target)
 
         # Get a list of errors that have appeared, and disappeared
-        better_err = []
-        worse_err = []
-        for line in err_lines:
-            if line not in self._base_err_lines:
-                worse_err.append('+' + line)
-        for line in self._base_err_lines:
-            if line not in err_lines:
-                better_err.append('-' + line)
+        better_err, worse_err = _CalcErrorDelta(self._base_err_lines,
+                self._base_err_line_boards, err_lines, err_line_boards, '')
+        better_warn, worse_warn = _CalcErrorDelta(self._base_warn_lines,
+                self._base_warn_line_boards, warn_lines, warn_line_boards, 'w')
 
         # Display results by arch
-        if better or worse or unknown or new or worse_err or better_err:
+        if (better or worse or unknown or new or worse_err or better_err
+                or worse_warn or better_warn):
             arch_list = {}
             self.AddOutcome(board_selected, arch_list, better, '',
                     self.col.GREEN)
@@ -899,6 +985,12 @@ class Builder:
             if worse_err:
                 print self.col.Color(self.col.RED, '\n'.join(worse_err))
                 self._error_lines += 1
+            if better_warn:
+                print self.col.Color(self.col.YELLOW, '\n'.join(better_warn))
+                self._error_lines += 1
+            if worse_warn:
+                print self.col.Color(self.col.MAGENTA, '\n'.join(worse_warn))
+                self._error_lines += 1
 
         if show_sizes:
             self.PrintSizeSummary(board_selected, board_dict, show_detail,
@@ -907,6 +999,9 @@ class Builder:
         # Save our updated information for the next call to this function
         self._base_board_dict = board_dict
         self._base_err_lines = err_lines
+        self._base_warn_lines = warn_lines
+        self._base_err_line_boards = err_line_boards
+        self._base_warn_line_boards = warn_line_boards
 
         # Get a list of boards that did not get built, if needed
         not_built = []
@@ -918,14 +1013,17 @@ class Builder:
                     ', '.join(not_built))
 
     def ProduceResultSummary(self, commit_upto, commits, board_selected):
-            board_dict, err_lines = self.GetResultSummary(board_selected,
-                    commit_upto, read_func_sizes=self._show_bloat)
+            (board_dict, err_lines, err_line_boards, warn_lines,
+                    warn_line_boards) = self.GetResultSummary(
+                    board_selected, commit_upto,
+                    read_func_sizes=self._show_bloat)
             if commits:
                 msg = '%02d: %s' % (commit_upto + 1,
                         commits[commit_upto].subject)
                 print self.col.Color(self.col.BLUE, msg)
             self.PrintResultSummary(board_selected, board_dict,
-                    err_lines if self._show_errors else [],
+                    err_lines if self._show_errors else [], err_line_boards,
+                    warn_lines if self._show_errors else [], warn_line_boards,
                     self._show_sizes, self._show_detail, self._show_bloat)
 
     def ShowSummary(self, commits, board_selected):
@@ -1031,6 +1129,10 @@ class Builder:
                     value is Board object
             keep_outputs: True to save build output files
             verbose: Display build results as they are completed
+        Returns:
+            Tuple containing:
+                - number of boards that failed to build
+                - number of boards that issued warnings
         """
         self.commit_count = len(commits) if commits else 1
         self.commits = commits
@@ -1060,3 +1162,4 @@ class Builder:
         self.out_queue.join()
         print
         self.ClearLine(0)
+        return (self.fail, self.warned)
index 8214662e368890d05bc1017c15adc9acb430031f..0246375bfadd8baa3be8b5d4cfdbd493b1ca00f8 100644 (file)
@@ -177,6 +177,7 @@ class BuilderThread(threading.Thread):
                 Mkdir(out_dir)
                 args = []
                 cwd = work_dir
+                src_dir = os.path.realpath(work_dir)
                 if not self.builder.in_tree:
                     if commit_upto is None:
                         # In this case we are building in the original source
@@ -189,6 +190,7 @@ class BuilderThread(threading.Thread):
                         work_dir = os.path.realpath(work_dir)
                         args.append('O=%s/build' % work_dir)
                         cwd = None
+                        src_dir = os.getcwd()
                     else:
                         args.append('O=build')
                 args.append('-s')
@@ -209,7 +211,7 @@ class BuilderThread(threading.Thread):
                 if result.return_code == 0:
                     result = self.Make(commit, brd, 'build', cwd, *args,
                             env=env)
-                    result.stdout = config_out + result.stdout
+                result.stderr = result.stderr.replace(src_dir + '/', '')
             else:
                 result.return_code = 1
                 result.stderr = 'No tool chain for %s\n' % brd.arch
index e18859b3d79723288eb43dd70da6d2acdf081d82..1258b760ca36e67597ffe793810c9b815ddb16f6 100755 (executable)
@@ -94,6 +94,8 @@ parser.add_option('-j', '--jobs', dest='jobs', type='int',
        default=None, help='Number of jobs to run at once (passed to make)')
 parser.add_option('-k', '--keep-outputs', action='store_true',
        default=False, help='Keep all build output files (e.g. binaries)')
+parser.add_option('-l', '--list-error-boards', action='store_true',
+       default=False, help='Show a list of boards next to each error/warning')
 parser.add_option('--list-tool-chains', action='store_true', default=False,
        help='List available tool chains')
 parser.add_option('-n', '--dry-run', action='store_true', dest='dry_run',
@@ -117,6 +119,9 @@ parser.add_option('-u', '--show_unknown', action='store_true',
        default=False, help='Show boards with unknown build result')
 parser.add_option('-v', '--verbose', action='store_true',
        default=False, help='Show build results while the build progresses')
+parser.add_option('-x', '--exclude', dest='exclude',
+      type='string', action='append',
+      help='Specify a list of boards to exclude, separated by comma')
 
 parser.usage += """
 
@@ -136,4 +141,5 @@ elif options.full_help:
 
 # Build selected commits for selected boards
 else:
-    control.DoBuildman(options, args)
+    ret_code = control.DoBuildman(options, args)
+    sys.exit(ret_code)
index 68ea961876ebde40f7b61bae85a150b7593ca7e7..06c9229fba66b397f8a106d3261e6ff57f13a654 100644 (file)
@@ -94,7 +94,7 @@ def DoBuildman(options, args):
     if options.list_tool_chains:
         toolchains.List()
         print
-        return
+        return 0
 
     # Work out how many commits to build. We want to build everything on the
     # branch. We also build the upstream commit as a control so we can see
@@ -127,7 +127,13 @@ def DoBuildman(options, args):
 
     boards = board.Boards()
     boards.ReadBoards(os.path.join(options.git, 'boards.cfg'))
-    why_selected = boards.SelectBoards(args)
+
+    exclude = []
+    if options.exclude:
+        for arg in options.exclude:
+            exclude += arg.split(',')
+
+    why_selected = boards.SelectBoards(args, exclude)
     selected = boards.GetSelected()
     if not len(selected):
         sys.exit(col.Color(col.RED, 'No matching boards found'))
@@ -210,12 +216,18 @@ def DoBuildman(options, args):
                                options)
 
         builder.SetDisplayOptions(options.show_errors, options.show_sizes,
-                                  options.show_detail, options.show_bloat)
+                                  options.show_detail, options.show_bloat,
+                                  options.list_error_boards)
         if options.summary:
             # We can't show function sizes without board details at present
             if options.show_bloat:
                 options.show_detail = True
             builder.ShowSummary(commits, board_selected)
         else:
-            builder.BuildBoards(commits, board_selected,
+            fail, warned = builder.BuildBoards(commits, board_selected,
                                 options.keep_outputs, options.verbose)
+            if fail:
+                return 128
+            elif warned:
+                return 129
+    return 0
index 1b9771f8e6f42a749a8be0e50e2a327252bdf8e7..0e9129437f65f41163c3ad2b54cd98d94cc7b6ee 100644 (file)
@@ -198,7 +198,7 @@ class Toolchains:
         >>> tcs.ResolveReferences(var_dict, 'this=${oblique}_set${first}nd')
         'this=OBLIQUE_setfi2ndrstnd'
         """
-        re_var = re.compile('(\$\{[a-z0-9A-Z]{1,}\})')
+        re_var = re.compile('(\$\{[-_a-z0-9A-Z]{1,}\})')
 
         while True:
             m = re_var.search(args)
index e2b4959d58b377dab1546a470df1fa6b07e89af7..80edc7c2c6ca0b1072abb247605b8d0ee023b7f1 100644 (file)
@@ -33,7 +33,7 @@ def LogCmd(commit_range, git_dir=None, oneline=False, reverse=False,
     cmd = ['git']
     if git_dir:
         cmd += ['--git-dir', git_dir]
-    cmd += ['log', '--no-color']
+    cmd += ['--no-pager', 'log', '--no-color']
     if oneline:
         cmd.append('--oneline')
     if use_no_decorate:
@@ -215,94 +215,6 @@ def CreatePatches(start, count, series):
     else:
        return None, files
 
-def ApplyPatch(verbose, fname):
-    """Apply a patch with git am to test it
-
-    TODO: Convert these to use command, with stderr option
-
-    Args:
-        fname: filename of patch file to apply
-    """
-    col = terminal.Color()
-    cmd = ['git', 'am', fname]
-    pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE)
-    stdout, stderr = pipe.communicate()
-    re_error = re.compile('^error: patch failed: (.+):(\d+)')
-    for line in stderr.splitlines():
-        if verbose:
-            print line
-        match = re_error.match(line)
-        if match:
-            print checkpatch.GetWarningMsg(col, 'warning', match.group(1),
-                                           int(match.group(2)), 'Patch failed')
-    return pipe.returncode == 0, stdout
-
-def ApplyPatches(verbose, args, start_point):
-    """Apply the patches with git am to make sure all is well
-
-    Args:
-        verbose: Print out 'git am' output verbatim
-        args: List of patch files to apply
-        start_point: Number of commits back from HEAD to start applying.
-            Normally this is len(args), but it can be larger if a start
-            offset was given.
-    """
-    error_count = 0
-    col = terminal.Color()
-
-    # Figure out our current position
-    cmd = ['git', 'name-rev', 'HEAD', '--name-only']
-    pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE)
-    stdout, stderr = pipe.communicate()
-    if pipe.returncode:
-        str = 'Could not find current commit name'
-        print col.Color(col.RED, str)
-        print stdout
-        return False
-    old_head = stdout.splitlines()[0]
-    if old_head == 'undefined':
-        str = "Invalid HEAD '%s'" % stdout.strip()
-        print col.Color(col.RED, str)
-        return False
-
-    # Checkout the required start point
-    cmd = ['git', 'checkout', 'HEAD~%d' % start_point]
-    pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE)
-    stdout, stderr = pipe.communicate()
-    if pipe.returncode:
-        str = 'Could not move to commit before patch series'
-        print col.Color(col.RED, str)
-        print stdout, stderr
-        return False
-
-    # Apply all the patches
-    for fname in args:
-        ok, stdout = ApplyPatch(verbose, fname)
-        if not ok:
-            print col.Color(col.RED, 'git am returned errors for %s: will '
-                    'skip this patch' % fname)
-            if verbose:
-                print stdout
-            error_count += 1
-            cmd = ['git', 'am', '--skip']
-            pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE)
-            stdout, stderr = pipe.communicate()
-            if pipe.returncode != 0:
-                print col.Color(col.RED, 'Unable to skip patch! Aborting...')
-                print stdout
-                break
-
-    # Return to our previous position
-    cmd = ['git', 'checkout', old_head]
-    pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    stdout, stderr = pipe.communicate()
-    if pipe.returncode:
-        print col.Color(col.RED, 'Could not move back to head commit')
-        print stdout, stderr
-    return error_count == 0
-
 def BuildEmailList(in_list, tag=None, alias=None, raise_on_error=True):
     """Build a list of email addresses based on an input list.
 
@@ -478,13 +390,13 @@ def LookupEmail(lookup_name, alias=None, raise_on_error=True, level=0):
     ...
     OSError: Recursive email alias at 'other'
     >>> LookupEmail('odd', alias, raise_on_error=False)
-    \033[1;31mAlias 'odd' not found\033[0m
+    Alias 'odd' not found
     []
     >>> # In this case the loop part will effectively be ignored.
     >>> LookupEmail('loop', alias, raise_on_error=False)
-    \033[1;31mRecursive email alias at 'other'\033[0m
-    \033[1;31mRecursive email alias at 'john'\033[0m
-    \033[1;31mRecursive email alias at 'mary'\033[0m
+    Recursive email alias at 'other'
+    Recursive email alias at 'john'
+    Recursive email alias at 'mary'
     ['j.bloggs@napier.co.nz', 'm.poppins@cloud.net']
     """
     if not alias:
@@ -569,6 +481,8 @@ def GetDefaultUserEmail():
 def Setup():
     """Set up git utils, by reading the alias files."""
     # Check for a git alias file also
+    global use_no_decorate
+
     alias_fname = GetAliasFile()
     if alias_fname:
         settings.ReadGitAliases(alias_fname)
index 00404681c420ee2140936c7aadea805152db221e..b0b81534bfd39b43717181679f2d4251183baef0 100644 (file)
@@ -72,7 +72,6 @@ class PatchStream:
         self.in_change = 0               # Non-zero if we are in a change list
         self.blank_count = 0             # Number of blank lines stored up
         self.state = STATE_MSG_HEADER    # What state are we in?
-        self.tags = []                   # Tags collected, like Tested-by...
         self.signoff = []                # Contents of signoff line
         self.commit = None               # Current commit
 
@@ -113,16 +112,6 @@ class PatchStream:
             self.series.AddCommit(self.commit)
             self.commit = None
 
-    def FormatTags(self, tags):
-        out_list = []
-        for tag in sorted(tags):
-            if tag.startswith('Cc:'):
-                tag_list = tag[4:].split(',')
-                out_list += gitutil.BuildEmailList(tag_list, 'Cc:')
-            else:
-                out_list.append(tag)
-        return out_list
-
     def ProcessLine(self, line):
         """Process a single line of a patch file or commit log
 
@@ -271,11 +260,11 @@ class PatchStream:
             elif tag_match.group(1) == 'Patch-cc':
                 self.commit.AddCc(tag_match.group(2).split(','))
             else:
-                self.tags.append(line);
+                out = [line]
 
         # Suppress duplicate signoffs
         elif signoff_match:
-            if (self.is_log or
+            if (self.is_log or not self.commit or
                 self.commit.CheckDuplicateSignoff(signoff_match.group(1))):
                 out = [line]
 
@@ -311,8 +300,10 @@ class PatchStream:
                 # Output the tags (signeoff first), then change list
                 out = []
                 log = self.series.MakeChangeLog(self.commit)
-                out += self.FormatTags(self.tags)
-                out += [line] + self.commit.notes + [''] + log
+                out += [line]
+                if self.commit:
+                    out += self.commit.notes
+                out += [''] + log
             elif self.found_test:
                 if not re_allowed_after_test.match(line):
                     self.lines_after_test += 1
index ca34cb9fd8bac0b54eabb7cecb6fbd56a99147ac..5ab74fa2510ab559287938dbda7b5757d135b043 100755 (executable)
@@ -25,9 +25,6 @@ import test
 
 
 parser = OptionParser()
-parser.add_option('-a', '--no-apply', action='store_false',
-                  dest='apply_patches', default=True,
-                  help="Don't test-apply patches with git am")
 parser.add_option('-H', '--full-help', action='store_true', dest='full_help',
        default=False, help='Display the README file')
 parser.add_option('-c', '--count', dest='count', type='int',
@@ -143,10 +140,6 @@ else:
         ok = checkpatch.CheckPatches(options.verbose, args)
     else:
         ok = True
-    if options.apply_patches:
-        if not gitutil.ApplyPatches(options.verbose, args,
-                                    options.count + options.start):
-            ok = False
 
     cc_file = series.MakeCcFile(options.process_tags, cover_fname,
                                 not options.ignore_bad_tags)
index 597d526861ad2db2f37fce5a6e3377c77b4c8ef4..963f2f891b1748ca08440d81f9ab6612b6053919 100644 (file)
@@ -15,66 +15,72 @@ import sys
 COLOR_IF_TERMINAL, COLOR_ALWAYS, COLOR_NEVER = range(3)
 
 class Color(object):
-  """Conditionally wraps text in ANSI color escape sequences."""
-  BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
-  BOLD = -1
-  BRIGHT_START = '\033[1;%dm'
-  NORMAL_START = '\033[22;%dm'
-  BOLD_START = '\033[1m'
-  RESET = '\033[0m'
+    """Conditionally wraps text in ANSI color escape sequences."""
+    BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
+    BOLD = -1
+    BRIGHT_START = '\033[1;%dm'
+    NORMAL_START = '\033[22;%dm'
+    BOLD_START = '\033[1m'
+    RESET = '\033[0m'
 
-  def __init__(self, colored=COLOR_IF_TERMINAL):
-    """Create a new Color object, optionally disabling color output.
+    def __init__(self, colored=COLOR_IF_TERMINAL):
+        """Create a new Color object, optionally disabling color output.
 
-    Args:
-      enabled: True if color output should be enabled. If False then this
-        class will not add color codes at all.
-    """
-    self._enabled = (colored == COLOR_ALWAYS or
-        (colored == COLOR_IF_TERMINAL and os.isatty(sys.stdout.fileno())))
+        Args:
+          enabled: True if color output should be enabled. If False then this
+            class will not add color codes at all.
+        """
+        try:
+            self._enabled = (colored == COLOR_ALWAYS or
+                    (colored == COLOR_IF_TERMINAL and
+                     os.isatty(sys.stdout.fileno())))
+        except:
+            self._enabled = False
 
-  def Start(self, color, bright=True):
-    """Returns a start color code.
+    def Start(self, color, bright=True):
+        """Returns a start color code.
 
-    Args:
-      color: Color to use, .e.g BLACK, RED, etc.
+        Args:
+          color: Color to use, .e.g BLACK, RED, etc.
 
-    Returns:
-      If color is enabled, returns an ANSI sequence to start the given color,
-      otherwise returns empty string
-    """
-    if self._enabled:
-        base = self.BRIGHT_START if bright else self.NORMAL_START
-        return base % (color + 30)
-    return ''
+        Returns:
+          If color is enabled, returns an ANSI sequence to start the given
+          color, otherwise returns empty string
+        """
+        if self._enabled:
+            base = self.BRIGHT_START if bright else self.NORMAL_START
+            return base % (color + 30)
+        return ''
 
-  def Stop(self):
-    """Retruns a stop color code.
+    def Stop(self):
+        """Retruns a stop color code.
 
-    Returns:
-      If color is enabled, returns an ANSI color reset sequence, otherwise
-      returns empty string
-    """
-    if self._enabled:
-        return self.RESET
-    return ''
+        Returns:
+          If color is enabled, returns an ANSI color reset sequence,
+          otherwise returns empty string
+        """
+        if self._enabled:
+            return self.RESET
+        return ''
 
-  def Color(self, color, text, bright=True):
-    """Returns text with conditionally added color escape sequences.
+    def Color(self, color, text, bright=True):
+        """Returns text with conditionally added color escape sequences.
 
-    Keyword arguments:
-      color: Text color -- one of the color constants defined in this class.
-      text: The text to color.
+        Keyword arguments:
+          color: Text color -- one of the color constants defined in this
+                  class.
+          text: The text to color.
 
-    Returns:
-      If self._enabled is False, returns the original text. If it's True,
-      returns text with color escape sequences based on the value of color.
-    """
-    if not self._enabled:
-        return text
-    if color == self.BOLD:
-        start = self.BOLD_START
-    else:
-        base = self.BRIGHT_START if bright else self.NORMAL_START
-        start = base % (color + 30)
-    return start + text + self.RESET
+        Returns:
+          If self._enabled is False, returns the original text. If it's True,
+          returns text with color escape sequences based on the value of
+          color.
+        """
+        if not self._enabled:
+            return text
+        if color == self.BOLD:
+            start = self.BOLD_START
+        else:
+            base = self.BRIGHT_START if bright else self.NORMAL_START
+            start = base % (color + 30)
+        return start + text + self.RESET
index 8fcfe530dc5beac1453711e4e239ee2dc0d9491d..e8f7472785fb5704fb5df8da85d3758163f9686c 100644 (file)
@@ -55,6 +55,7 @@ This adds functions to enable/disable clocks and reset to on-chip peripherals.
 
 Signed-off-by: Simon Glass <sjg@chromium.org>
 ---
+
  arch/arm/cpu/armv7/tegra2/Makefile         |    2 +-
  arch/arm/cpu/armv7/tegra2/ap20.c           |   57 ++----
  arch/arm/cpu/armv7/tegra2/clock.c          |  163 +++++++++++++++++
@@ -200,7 +201,7 @@ index 0000000..2234c87
         self.assertEqual(result.errors, 0)
         self.assertEqual(result.warnings, 0)
         self.assertEqual(result.checks, 0)
-        self.assertEqual(result.lines, 67)
+        self.assertEqual(result.lines, 56)
         os.remove(inf)
 
     def testNoSignoff(self):
@@ -211,18 +212,18 @@ index 0000000..2234c87
         self.assertEqual(result.errors, 1)
         self.assertEqual(result.warnings, 0)
         self.assertEqual(result.checks, 0)
-        self.assertEqual(result.lines, 67)
+        self.assertEqual(result.lines, 56)
         os.remove(inf)
 
     def testSpaces(self):
         inf = self.SetupData('spaces')
         result = checkpatch.CheckPatch(inf)
         self.assertEqual(result.ok, False)
-        self.assertEqual(len(result.problems), 1)
+        self.assertEqual(len(result.problems), 2)
         self.assertEqual(result.errors, 0)
-        self.assertEqual(result.warnings, 1)
+        self.assertEqual(result.warnings, 2)
         self.assertEqual(result.checks, 0)
-        self.assertEqual(result.lines, 67)
+        self.assertEqual(result.lines, 56)
         os.remove(inf)
 
     def testIndent(self):
@@ -233,7 +234,7 @@ index 0000000..2234c87
         self.assertEqual(result.errors, 0)
         self.assertEqual(result.warnings, 0)
         self.assertEqual(result.checks, 1)
-        self.assertEqual(result.lines, 67)
+        self.assertEqual(result.lines, 56)
         os.remove(inf)