From bb5baa8e13582532a8a2c7b3ef8e6c50b370473c Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 21 Sep 2023 22:49:21 +0200 Subject: [PATCH 1/5] donate-cpu-server.py: bumped version --- tools/donate-cpu-server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index aacd0a4175e..bc7587ca13f 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -26,7 +26,7 @@ # Version scheme (MAJOR.MINOR.PATCH) should orientate on "Semantic Versioning" https://semver.org/ # Every change in this script should result in increasing the version number accordingly (exceptions may be cosmetic # changes) -SERVER_VERSION = "1.3.44" +SERVER_VERSION = "1.3.45" OLD_VERSION = '2.12.0' From e2aac917cee6f0a726d50259964f8344bb995d1e Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 21 Sep 2023 23:02:37 +0200 Subject: [PATCH 2/5] donate-cpu-server.py: ignore diff part of head results in `check_library_report()` and `check_library_function_name()` --- tools/donate-cpu-server.py | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index bc7587ca13f..8f6fa3a6882 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -909,18 +909,22 @@ def check_library_report(result_path: str, message_id: str) -> str: metric = 'macros' m_column = 'macro' metric_link = 'unknown_macro' + marker = HEAD_MARKER elif message_id == 'valueFlowBailoutIncompleteVar': metric = 'variables' m_column = 'Variable' metric_link = 'incomplete_var' + marker = HEAD_MARKER elif message_id == 'checkLibraryCheckType': metric = 'types' m_column = 'Type' metric_link = 'check_library' + marker = INFO_MARKER else: metric = 'functions' m_column = 'Function' metric_link = 'check_library' + marker = INFO_MARKER functions_shown_max = 5000 html = '\n' @@ -937,7 +941,7 @@ def check_library_report(result_path: str, message_id: str) -> str: for filename in glob.glob(result_path + '/*'): if not os.path.isfile(filename) or filename.endswith('.diff'): continue - info_messages = False + in_results = False for line in open(filename, 'rt'): if line.startswith('cppcheck: '): if OLD_VERSION not in line: @@ -946,11 +950,13 @@ def check_library_report(result_path: str, message_id: str) -> str: else: # Current package, parse on continue - if message_id != 'valueFlowBailoutIncompleteVar' and message_id != 'unknownMacro': - if line == 'info messages:\n': - info_messages = True - if not info_messages: - continue + if line.startswith(marker): + in_results = True + continue + if not in_results: + continue + if line.startswith('diff:'): + break if line.endswith('[' + message_id + ']\n'): if message_id == 'unknownMacro': print(line) @@ -990,16 +996,18 @@ def check_library_function_name(result_path: str, function_name: str, query_para function_name = urllib.parse.unquote_plus(function_name) if nonfunc_id: id = '[' + nonfunc_id + marker = HEAD_MARKER else: if function_name.endswith('()'): id = '[checkLibrary' else: id = '[checkLibraryCheckType]' + marker = INFO_MARKER output_lines_list = [] for filename in glob.glob(result_path + '/*'): if not os.path.isfile(filename) or filename.endswith('.diff'): continue - info_messages = False + in_results = False package_url = None cppcheck_options = None for line in open(filename, 'rt'): @@ -1016,12 +1024,13 @@ def check_library_function_name(result_path: str, function_name: str, query_para if line.startswith('cppcheck-options:'): cppcheck_options = line continue - if not nonfunc_id: - if line == 'info messages:\n': - info_messages = True - continue - if not info_messages: - continue + if line.startswith(marker): + in_results = True + continue + if line.startswith('diff:'): + break + if not in_results: + continue if id not in line: continue if not (' ' + function_name + ' ') in line: From 8f6f5c21b92e6637245eb333a45f6d67a8e9f37f Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 21 Sep 2023 23:03:02 +0200 Subject: [PATCH 3/5] donate-cpu-server.py: cleaned up some `if`-chains --- tools/donate-cpu-server.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index 8f6fa3a6882..a4479a740f0 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -601,11 +601,10 @@ def summaryReport(resultsPath: str, name: str, prefix: str, marker: str) -> str: if line.startswith(marker): inResults = True continue - if line.startswith('diff:'): - if inResults: - break if not inResults: continue + if line.startswith('diff:'): + break if not line.endswith(']'): continue if ': note: ' in line: @@ -658,13 +657,15 @@ def messageIdReport(resultPath: str, marker: str, messageId: str, query_params: for line in open(filename, 'rt'): if line.startswith('ftp://'): url = line - elif line.startswith(marker): + continue + if line.startswith(marker): inResults = True - elif not inResults: continue - elif inResults and line.startswith('diff:'): + if not inResults: + continue + if line.startswith('diff:'): break - elif line.endswith(e): + if line.endswith(e): if url: text += url if pkgs is not None: @@ -701,13 +702,15 @@ def messageIdTodayReport(resultPath: str, messageId: str, marker: str) -> str: break if line.startswith('ftp://'): url = line - elif line.startswith(marker): + continue + if line.startswith(marker): inResults = True - elif not inResults: continue - elif inResults and line.startswith('diff:'): + if not inResults: + continue + if line.startswith('diff:'): break - elif line.endswith(e): + if line.endswith(e): if url: text += url url = None From 92c82a18258072f923d9457d030d49fb0e09a376 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 22 Sep 2023 10:30:57 +0200 Subject: [PATCH 4/5] donate-cpu-server.py: removed left-over debug log --- tools/donate-cpu-server.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index a4479a740f0..9831b1f97ce 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -962,7 +962,6 @@ def check_library_report(result_path: str, message_id: str) -> str: break if line.endswith('[' + message_id + ']\n'): if message_id == 'unknownMacro': - print(line) marker = 'required. If ' function_name = line[(line.find(marker) + len(marker)):line.rfind('is a macro') - 1] elif message_id == 'valueFlowBailoutIncompleteVar': From 8feacf8b696b2c9b0d1d4c9379bc25d291967242 Mon Sep 17 00:00:00 2001 From: firewave Date: Fri, 22 Sep 2023 10:37:27 +0200 Subject: [PATCH 5/5] donate-cpu-server.py: filtered outdated results in `messageIdReport()` --- tools/donate-cpu-server.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/donate-cpu-server.py b/tools/donate-cpu-server.py index 9831b1f97ce..d4931eb2fc4 100755 --- a/tools/donate-cpu-server.py +++ b/tools/donate-cpu-server.py @@ -655,6 +655,13 @@ def messageIdReport(resultPath: str, marker: str, messageId: str, query_params: url = None inResults = False for line in open(filename, 'rt'): + if line.startswith('cppcheck: '): + if OLD_VERSION not in line: + # Package results seem to be too old, skip + break + else: + # Current package, parse on + continue if line.startswith('ftp://'): url = line continue