2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 08:15:25 +00:00

checkpatch: Fix checkpatch's check-authors-file option in CirrusCI.

This patch makes sure that if git is missing it's not showing
any errors on the standard output. Secondly the OVS_SRC_DIR
environment variable is used to locate the OVS source directory.

Fixes: a6ccd11155 ("checkpatch: Add new check-authors-file option to checkpatch.py.")
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
This commit is contained in:
Eelco Chaudron
2024-10-10 15:37:46 +02:00
parent 54aa6e12a7
commit d1430f3d89
2 changed files with 11 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ import email
import getopt
import os
import re
import subprocess
import sys
RETURN_CHECK_INITIAL_STATE = 0
@@ -867,13 +868,14 @@ def run_subject_checks(subject, spellcheck=False):
def get_top_directory():
with os.popen('git rev-parse --show-toplevel') as pipe:
path = pipe.read()
result = subprocess.run('git rev-parse --show-toplevel',
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL, shell=True)
if path:
return path.strip()
if result and result.returncode == 0:
return result.stdout.decode('utf-8').strip()
return "."
return os.getenv('OVS_SRC_DIR', '.')
def update_missing_authors(diffed_line):