mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 04:15:35 +00:00
Add verbose switch to silence all output except the final report
This commit is contained in:
parent
3f742987b8
commit
6602538544
|
@ -52,7 +52,7 @@ class RepoVersion(object):
|
|||
class AbiChecker(object):
|
||||
"""API and ABI checker."""
|
||||
|
||||
def __init__(self, old_version, new_version, report_dir,
|
||||
def __init__(self, verbose, old_version, new_version, report_dir,
|
||||
keep_all_reports, brief, skip_file=None):
|
||||
"""Instantiate the API/ABI checker.
|
||||
|
||||
|
@ -65,6 +65,7 @@ class AbiChecker(object):
|
|||
"""
|
||||
self.repo_path = "."
|
||||
self.log = None
|
||||
self.verbose = verbose
|
||||
self._setup_logger()
|
||||
self.report_dir = os.path.abspath(report_dir)
|
||||
self.keep_all_reports = keep_all_reports
|
||||
|
@ -86,7 +87,10 @@ class AbiChecker(object):
|
|||
|
||||
def _setup_logger(self):
|
||||
self.log = logging.getLogger()
|
||||
self.log.setLevel(logging.INFO)
|
||||
if self.verbose:
|
||||
self.log.setLevel(logging.DEBUG)
|
||||
else:
|
||||
self.log.setLevel(logging.INFO)
|
||||
self.log.addHandler(logging.StreamHandler())
|
||||
|
||||
@staticmethod
|
||||
|
@ -100,7 +104,7 @@ class AbiChecker(object):
|
|||
Do not modify the current worktree."""
|
||||
git_worktree_path = tempfile.mkdtemp()
|
||||
if version.repository:
|
||||
self.log.info(
|
||||
self.log.debug(
|
||||
"Checking out git worktree for revision {} from {}".format(
|
||||
version.revision, version.repository
|
||||
)
|
||||
|
@ -113,12 +117,12 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
fetch_output, _ = fetch_process.communicate()
|
||||
self.log.info(fetch_output.decode("utf-8"))
|
||||
self.log.debug(fetch_output.decode("utf-8"))
|
||||
if fetch_process.returncode != 0:
|
||||
raise Exception("Fetching revision failed, aborting")
|
||||
worktree_rev = "FETCH_HEAD"
|
||||
else:
|
||||
self.log.info("Checking out git worktree for revision {}".format(
|
||||
self.log.debug("Checking out git worktree for revision {}".format(
|
||||
version.revision
|
||||
))
|
||||
worktree_rev = version.revision
|
||||
|
@ -130,7 +134,7 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
worktree_output, _ = worktree_process.communicate()
|
||||
self.log.info(worktree_output.decode("utf-8"))
|
||||
self.log.debug(worktree_output.decode("utf-8"))
|
||||
if worktree_process.returncode != 0:
|
||||
raise Exception("Checking out worktree failed, aborting")
|
||||
return git_worktree_path
|
||||
|
@ -143,7 +147,7 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
output, _ = process.communicate()
|
||||
self.log.info(output.decode("utf-8"))
|
||||
self.log.debug(output.decode("utf-8"))
|
||||
if process.returncode != 0:
|
||||
raise Exception("git submodule update failed, aborting")
|
||||
if not (os.path.exists(os.path.join(git_worktree_path, "crypto"))
|
||||
|
@ -159,7 +163,7 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
fetch_output, _ = fetch_process.communicate()
|
||||
self.log.info(fetch_output.decode("utf-8"))
|
||||
self.log.debug(fetch_output.decode("utf-8"))
|
||||
if fetch_process.returncode != 0:
|
||||
raise Exception("git fetch failed, aborting")
|
||||
crypto_rev = "FETCH_HEAD"
|
||||
|
@ -173,7 +177,7 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
checkout_output, _ = checkout_process.communicate()
|
||||
self.log.info(checkout_output.decode("utf-8"))
|
||||
self.log.debug(checkout_output.decode("utf-8"))
|
||||
if checkout_process.returncode != 0:
|
||||
raise Exception("git checkout failed, aborting")
|
||||
|
||||
|
@ -191,7 +195,7 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
make_output, _ = make_process.communicate()
|
||||
self.log.info(make_output.decode("utf-8"))
|
||||
self.log.debug(make_output.decode("utf-8"))
|
||||
for root, dirs, files in os.walk(git_worktree_path):
|
||||
for file in fnmatch.filter(files, "*.so"):
|
||||
version.modules[os.path.splitext(file)[0]] = (
|
||||
|
@ -223,7 +227,7 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
abi_dump_output, _ = abi_dump_process.communicate()
|
||||
self.log.info(abi_dump_output.decode("utf-8"))
|
||||
self.log.debug(abi_dump_output.decode("utf-8"))
|
||||
if abi_dump_process.returncode != 0:
|
||||
raise Exception("abi-dumper failed, aborting")
|
||||
version.abi_dumps[mbed_module] = output_path
|
||||
|
@ -238,7 +242,7 @@ class AbiChecker(object):
|
|||
stderr=subprocess.STDOUT
|
||||
)
|
||||
worktree_output, _ = worktree_process.communicate()
|
||||
self.log.info(worktree_output.decode("utf-8"))
|
||||
self.log.debug(worktree_output.decode("utf-8"))
|
||||
if worktree_process.returncode != 0:
|
||||
raise Exception("Worktree cleanup failed, aborting")
|
||||
|
||||
|
@ -361,6 +365,10 @@ def run_main():
|
|||
Note: must be run from Mbed TLS root."""
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"-v", "--verbose", action="store_true",
|
||||
help="set verbosity level",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-r", "--report-dir", type=str, default="reports",
|
||||
help="directory where reports are stored, default is reports",
|
||||
|
@ -413,7 +421,7 @@ def run_main():
|
|||
new_version = RepoVersion("new", abi_args.new_repo, abi_args.new_rev,
|
||||
abi_args.new_crypto_repo, abi_args.new_crypto_rev)
|
||||
abi_check = AbiChecker(
|
||||
old_version, new_version, abi_args.report_dir,
|
||||
abi_args.verbose, old_version, new_version, abi_args.report_dir,
|
||||
abi_args.keep_all_reports, abi_args.brief, abi_args.skip_file
|
||||
)
|
||||
return_code = abi_check.check_for_abi_changes()
|
||||
|
|
Loading…
Reference in a new issue