Message ID | 20230804205834.2522-1-csomani@redhat.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [ovs-dev,1/2] checkpatch: Enable subject checking on git-based patches. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
ovsrobot/intel-ovs-compilation | success | test: success |
On Fri, Aug 04, 2023 at 04:58:33PM -0400, Chandan Somani wrote: > Subject spellcheck on git-based patches is now included in commands like > utilities/checkpatch.py -S -2. Additionally, a block of code that is > used to call ovs_checkpatch_parse() has been deleted since > ovs_checkpatch_file() calls ovs_checkpatch_parse() anyways. This > prevents duplicate WARNINGS and ERRORS from being printed. > > Signed-off-by: Chandan Somani <csomani@redhat.com> > --- > utilities/checkpatch.py | 27 +++------------------------ > 1 file changed, 3 insertions(+), 24 deletions(-) > > diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py > index 5c4aaefb3..fd44bacf1 100755 > --- a/utilities/checkpatch.py > +++ b/utilities/checkpatch.py > @@ -1111,30 +1111,9 @@ if __name__ == '__main__': > colors = True > > if n_patches: > - status = 0 > - > - git_log = 'git log --no-color --no-merges --pretty=format:"%H %s" ' > - with os.popen(git_log + '-%d' % n_patches, 'r') as f: > - commits = f.read().split("\n") > - > - for i in reversed(range(0, n_patches)): > - revision, name = commits[i].split(" ", 1) > - f = os.popen('''git format-patch -1 --stdout --pretty=format:"\ > -Author: %an <%ae> > -Commit: %cn <%ce> > -Subject: %s > - > -%b" ''' + revision, 'r') > - patch = f.read() > - f.close() > - > - if not quiet: > - print('== Checking %s ("%s") ==' % (revision[0:12], name)) > - result = ovs_checkpatch_parse(patch, revision) > - ovs_checkpatch_print_result() > - if result: > - status = EXIT_FAILURE > - sys.exit(status) > + patch_name = os.popen('git format-patch -' + str(n_patches)) Hi Chandan, With this change, it appears that patch files, generated by git format-patch, are left behind after checkpatch is run. It also seems that this would overwrite any existing files with the same name (though perhaps that was already the case). This doesn't seem desirable from my perspective. > + args = patch_name.read().strip().split('\n') > + patch_name.close() > > if not args: > if sys.stdin.isatty(): > -- > 2.26.3 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev >
diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index 5c4aaefb3..fd44bacf1 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -1111,30 +1111,9 @@ if __name__ == '__main__': colors = True if n_patches: - status = 0 - - git_log = 'git log --no-color --no-merges --pretty=format:"%H %s" ' - with os.popen(git_log + '-%d' % n_patches, 'r') as f: - commits = f.read().split("\n") - - for i in reversed(range(0, n_patches)): - revision, name = commits[i].split(" ", 1) - f = os.popen('''git format-patch -1 --stdout --pretty=format:"\ -Author: %an <%ae> -Commit: %cn <%ce> -Subject: %s - -%b" ''' + revision, 'r') - patch = f.read() - f.close() - - if not quiet: - print('== Checking %s ("%s") ==' % (revision[0:12], name)) - result = ovs_checkpatch_parse(patch, revision) - ovs_checkpatch_print_result() - if result: - status = EXIT_FAILURE - sys.exit(status) + patch_name = os.popen('git format-patch -' + str(n_patches)) + args = patch_name.read().strip().split('\n') + patch_name.close() if not args: if sys.stdin.isatty():
Subject spellcheck on git-based patches is now included in commands like utilities/checkpatch.py -S -2. Additionally, a block of code that is used to call ovs_checkpatch_parse() has been deleted since ovs_checkpatch_file() calls ovs_checkpatch_parse() anyways. This prevents duplicate WARNINGS and ERRORS from being printed. Signed-off-by: Chandan Somani <csomani@redhat.com> --- utilities/checkpatch.py | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-)