openubmc-bingo 0.5.253__py3-none-any.whl → 0.5.254__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of openubmc-bingo might be problematic. Click here for more details.
- bmcgo/__init__.py +1 -1
- bmcgo/component/build.py +10 -1
- bmcgo/component/coverage/incremental_cov.py +2 -2
- bmcgo/functional/config.py +7 -0
- bmcgo/functional/json_check.py +109 -0
- bmcgo/misc.py +1 -0
- bmcgo/utils/basic_enums.py +45 -0
- bmcgo/utils/json_validator.py +241 -0
- {openubmc_bingo-0.5.253.dist-info → openubmc_bingo-0.5.254.dist-info}/METADATA +1 -1
- {openubmc_bingo-0.5.253.dist-info → openubmc_bingo-0.5.254.dist-info}/RECORD +13 -10
- {openubmc_bingo-0.5.253.dist-info → openubmc_bingo-0.5.254.dist-info}/WHEEL +0 -0
- {openubmc_bingo-0.5.253.dist-info → openubmc_bingo-0.5.254.dist-info}/entry_points.txt +0 -0
- {openubmc_bingo-0.5.253.dist-info → openubmc_bingo-0.5.254.dist-info}/top_level.txt +0 -0
bmcgo/__init__.py
CHANGED
bmcgo/component/build.py
CHANGED
|
@@ -26,6 +26,7 @@ from bmcgo.errors import BmcGoException
|
|
|
26
26
|
from bmcgo.component.package_info import InfoComp
|
|
27
27
|
from bmcgo.component.component_helper import ComponentHelper
|
|
28
28
|
from bmcgo import misc
|
|
29
|
+
from bmcgo.utils.json_validator import JSONValidator
|
|
29
30
|
|
|
30
31
|
log = Logger()
|
|
31
32
|
tool = Tools()
|
|
@@ -172,9 +173,9 @@ class BuildComp():
|
|
|
172
173
|
tool.run_command(cmd, show_log=True)
|
|
173
174
|
|
|
174
175
|
def run(self):
|
|
176
|
+
tool.clean_locks()
|
|
175
177
|
self.check_conan_profile()
|
|
176
178
|
self.check_luac()
|
|
177
|
-
tool.clean_locks()
|
|
178
179
|
from_source = "--build=missing"
|
|
179
180
|
if self.info.from_source:
|
|
180
181
|
from_source = "--build"
|
|
@@ -186,6 +187,7 @@ class BuildComp():
|
|
|
186
187
|
cmd = [misc.CONAN, "create"]
|
|
187
188
|
cmd += append.split()
|
|
188
189
|
tool.run_command(cmd, show_log=True)
|
|
190
|
+
self._check_sr_validation(cache_dir)
|
|
189
191
|
self.upload()
|
|
190
192
|
|
|
191
193
|
def test(self):
|
|
@@ -194,3 +196,10 @@ class BuildComp():
|
|
|
194
196
|
cmd += self.info.cmd_base.split()
|
|
195
197
|
cmd += ["-tf", "test_package"]
|
|
196
198
|
Helper.run(cmd)
|
|
199
|
+
|
|
200
|
+
def _check_sr_validation(self, dir_path):
|
|
201
|
+
# 检查所有 sr 文件是否合法
|
|
202
|
+
log.info("========== sr 文件检查开始 ==========")
|
|
203
|
+
jc = self.bconfig.bmcgo_config_list.get(misc.ENV_CONST, {}).get(misc.JSON_CHECKER, None)
|
|
204
|
+
JSONValidator().validate_files(dir_path, ['sr'], jc)
|
|
205
|
+
log.info("========== sr 文件检查结束 ==========")
|
|
@@ -140,8 +140,8 @@ class IncrementalCov(object):
|
|
|
140
140
|
temp_uncovers = []
|
|
141
141
|
temp_changes = []
|
|
142
142
|
filters = filter_lines[file]
|
|
143
|
-
if file not in cov_lines:
|
|
144
|
-
|
|
143
|
+
if file not in cov_lines or file not in filter_lines:
|
|
144
|
+
continue
|
|
145
145
|
else:
|
|
146
146
|
cov = cov_lines[file]
|
|
147
147
|
|
bmcgo/functional/config.py
CHANGED
|
@@ -14,6 +14,7 @@ import os
|
|
|
14
14
|
import stat
|
|
15
15
|
import re
|
|
16
16
|
import argparse
|
|
17
|
+
from pathlib import Path
|
|
17
18
|
|
|
18
19
|
from bmcgo import misc
|
|
19
20
|
from bmcgo.utils.tools import Tools
|
|
@@ -59,6 +60,12 @@ _CONFIGS = {
|
|
|
59
60
|
misc.JARSIGNER_HTTP_PROXY: {
|
|
60
61
|
misc.DESCRIPTION: "",
|
|
61
62
|
misc.PATTERN: r"^((https?://)?[a-zA-Z0-9.]+:[0-9]+)?$"
|
|
63
|
+
},
|
|
64
|
+
misc.JSON_CHECKER: {
|
|
65
|
+
misc.DESCRIPTION: "检查 json 文件的工具"
|
|
66
|
+
},
|
|
67
|
+
misc.CUSTOM_PLUGINS: {
|
|
68
|
+
misc.DESCRIPTION: f"设置插件地址,默认 {Path(misc.DEFAULT_PLUGINS_PATH).resolve()}"
|
|
62
69
|
}
|
|
63
70
|
},
|
|
64
71
|
misc.DEPLOY_HOST_CONST: {
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# encoding=utf-8
|
|
3
|
+
# 描述:bingo 配置默认参数功能
|
|
4
|
+
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
|
5
|
+
# openUBMC is licensed under Mulan PSL v2.
|
|
6
|
+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
7
|
+
# You may obtain a copy of Mulan PSL v2 at:
|
|
8
|
+
# http://license.coscl.org.cn/MulanPSL2
|
|
9
|
+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
10
|
+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
11
|
+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
12
|
+
# See the Mulan PSL v2 for more details.
|
|
13
|
+
import os
|
|
14
|
+
import re
|
|
15
|
+
import argparse
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
from bmcgo import misc
|
|
19
|
+
from bmcgo.utils.tools import Tools
|
|
20
|
+
from bmcgo.utils.json_validator import JsonTypeEnum, JSONValidator, get_cpu_count
|
|
21
|
+
from bmcgo.bmcgo_config import BmcgoConfig
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
tools = Tools("JSONChecker")
|
|
25
|
+
logger = tools.log
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
command_info: misc.CommandInfo = misc.CommandInfo(
|
|
29
|
+
group=misc.GRP_MISC,
|
|
30
|
+
name="json_check",
|
|
31
|
+
description=["json 文件检查"],
|
|
32
|
+
hidden=False
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def if_available(bconfig: BmcgoConfig):
|
|
37
|
+
return True
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
CMD = "bingo"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def get_desc(cmd):
|
|
44
|
+
|
|
45
|
+
return f"""
|
|
46
|
+
json 文件合法性检查工具:
|
|
47
|
+
|
|
48
|
+
1. 检查当前路径下所有 sr 文件:
|
|
49
|
+
>> {cmd} json_test -e sr
|
|
50
|
+
|
|
51
|
+
2. 检查其他路径下所有 sr, json, jn 文件:
|
|
52
|
+
>> {cmd} json_test -p /path/to/test/ -e .sr,json,jn
|
|
53
|
+
|
|
54
|
+
3. 用其他工具检查,比如 pyjson5, json5 (需要提前通过 pip 安装):
|
|
55
|
+
>> {cmd} json_test -e sr -j pyjson5
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
DEFAULT_JSON_TYPE = JsonTypeEnum.JSON
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class BmcgoCommand:
|
|
62
|
+
def __init__(self, bconfig: BmcgoConfig, *args):
|
|
63
|
+
self.bconfig = bconfig
|
|
64
|
+
jc = self.bconfig.bmcgo_config_list.get(misc.ENV_CONST, {}).get(misc.JSON_CHECKER, DEFAULT_JSON_TYPE)
|
|
65
|
+
|
|
66
|
+
parser = argparse.ArgumentParser(
|
|
67
|
+
prog=f"{CMD}参数配置",
|
|
68
|
+
description=get_desc(CMD),
|
|
69
|
+
add_help=True,
|
|
70
|
+
formatter_class=argparse.RawTextHelpFormatter
|
|
71
|
+
)
|
|
72
|
+
parser.add_argument(
|
|
73
|
+
"-p",
|
|
74
|
+
"--path",
|
|
75
|
+
type=Path,
|
|
76
|
+
default=Path(".").resolve(),
|
|
77
|
+
help="文件路径:检查单个文件合法性;文件夹路径:递归遍历所有指定拓展名文件合法性"
|
|
78
|
+
)
|
|
79
|
+
parser.add_argument(
|
|
80
|
+
"-e",
|
|
81
|
+
"--extensions",
|
|
82
|
+
type=lambda s: [ext.strip().lstrip('.').lower() for ext in re.split(r'\s*[,,]\s*', s) if ext],
|
|
83
|
+
required=True,
|
|
84
|
+
help="需要检查的文件后缀,通过','分隔,比如 -e sr,json"
|
|
85
|
+
)
|
|
86
|
+
parser.add_argument(
|
|
87
|
+
"-j",
|
|
88
|
+
"--json-type",
|
|
89
|
+
choices=list(JsonTypeEnum),
|
|
90
|
+
default=jc,
|
|
91
|
+
help=f"选择检查工具,可以通过 {CMD} config {misc.ENV_CONST}.{misc.JSON_CHECKER}=json/json5/pyjson5 指定默认值,当前为:{jc}\n"
|
|
92
|
+
"选择其他工具请先确认是否已经安装"
|
|
93
|
+
)
|
|
94
|
+
parser.add_argument(
|
|
95
|
+
"-n",
|
|
96
|
+
"--worker-num",
|
|
97
|
+
type=int,
|
|
98
|
+
default=get_cpu_count() * 2,
|
|
99
|
+
help=f"指定并行处理器数目,默认为{get_cpu_count() * 2}"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
self.args, self.kwargs = parser.parse_known_args(*args)
|
|
103
|
+
self.logger = tools.log
|
|
104
|
+
self._json_checker = JSONValidator()
|
|
105
|
+
|
|
106
|
+
def run(self):
|
|
107
|
+
self._json_checker.validate_files(
|
|
108
|
+
self.args.path, self.args.extensions, self.args.json_type, self.args.worker_num)
|
|
109
|
+
return 0
|
bmcgo/misc.py
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
|
4
|
+
# openUBMC is licensed under Mulan PSL v2.
|
|
5
|
+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
6
|
+
# You may obtain a copy of Mulan PSL v2 at:
|
|
7
|
+
# http://license.coscl.org.cn/MulanPSL2
|
|
8
|
+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
9
|
+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
10
|
+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
11
|
+
# See the Mulan PSL v2 for more details.
|
|
12
|
+
from enum import Enum, EnumMeta, auto
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class StringEnumMeta(EnumMeta):
|
|
16
|
+
def __contains__(cls, value):
|
|
17
|
+
return value in cls._value2member_map_
|
|
18
|
+
|
|
19
|
+
def __iter__(cls):
|
|
20
|
+
return (mem.value for mem in super().__iter__())
|
|
21
|
+
|
|
22
|
+
def __repr__(cls):
|
|
23
|
+
return repr(list(cls))
|
|
24
|
+
|
|
25
|
+
def __str__(cls):
|
|
26
|
+
return str(list(cls))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class BaseStringEnum(str, Enum, metaclass=StringEnumMeta):
|
|
30
|
+
def __str__(self):
|
|
31
|
+
return self.value
|
|
32
|
+
|
|
33
|
+
def __repr__(self):
|
|
34
|
+
return f"'{self.value}'"
|
|
35
|
+
|
|
36
|
+
@staticmethod
|
|
37
|
+
def _generate_next_value_(name, start, count, last_values):
|
|
38
|
+
return name.lower()
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def _missing_(cls, value):
|
|
42
|
+
for mem in cls:
|
|
43
|
+
if mem.value.lower() == value:
|
|
44
|
+
return mem
|
|
45
|
+
return None
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
#!/usr/bin/python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Copyright (c) 2025 Huawei Technologies Co., Ltd.
|
|
4
|
+
# openUBMC is licensed under Mulan PSL v2.
|
|
5
|
+
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
6
|
+
# You may obtain a copy of Mulan PSL v2 at:
|
|
7
|
+
# http://license.coscl.org.cn/MulanPSL2
|
|
8
|
+
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
|
9
|
+
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
|
10
|
+
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
|
11
|
+
# See the Mulan PSL v2 for more details.
|
|
12
|
+
import os
|
|
13
|
+
import re
|
|
14
|
+
import argparse
|
|
15
|
+
import concurrent.futures
|
|
16
|
+
from enum import auto
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Callable, List, Optional
|
|
19
|
+
|
|
20
|
+
from bmcgo.utils.tools import Tools
|
|
21
|
+
from bmcgo.utils.basic_enums import BaseStringEnum
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
tools = Tools("JSONChecker")
|
|
25
|
+
logger = tools.log
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class JsonTypeEnum(BaseStringEnum):
|
|
29
|
+
JSON = auto()
|
|
30
|
+
JSON5 = auto()
|
|
31
|
+
PYJSON5 = auto()
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class JSONValidator:
|
|
35
|
+
def __init__(self):
|
|
36
|
+
self.logger = tools.log
|
|
37
|
+
|
|
38
|
+
self.loaders = {
|
|
39
|
+
JsonTypeEnum.JSON: load_json,
|
|
40
|
+
JsonTypeEnum.JSON5: load_json5,
|
|
41
|
+
JsonTypeEnum.PYJSON5: load_pyjson5
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
def validate_files(
|
|
45
|
+
self,
|
|
46
|
+
root_path: Path,
|
|
47
|
+
extensions: List[str],
|
|
48
|
+
json_type: JsonTypeEnum = JsonTypeEnum.JSON,
|
|
49
|
+
max_workers: Optional[int] = None
|
|
50
|
+
):
|
|
51
|
+
root_path = Path(root_path)
|
|
52
|
+
files = find_files(root_path, extensions)
|
|
53
|
+
|
|
54
|
+
if not files:
|
|
55
|
+
self.logger.info(f"没有找到{extensions}后缀的文件!")
|
|
56
|
+
return
|
|
57
|
+
|
|
58
|
+
loader = self._get_loader(json_type)
|
|
59
|
+
fails = {}
|
|
60
|
+
|
|
61
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
|
|
62
|
+
future_to_file = {executor.submit(validate, file, loader): file for file in files}
|
|
63
|
+
|
|
64
|
+
for future in concurrent.futures.as_completed(future_to_file):
|
|
65
|
+
file_path = future_to_file[future]
|
|
66
|
+
try:
|
|
67
|
+
error = future.result()
|
|
68
|
+
if error:
|
|
69
|
+
self.logger.debug(f"{str(file_path)}: Failed!")
|
|
70
|
+
fails[file_path] = error
|
|
71
|
+
else:
|
|
72
|
+
self.logger.debug(f"{str(file_path)}: PASS!")
|
|
73
|
+
except Exception as e:
|
|
74
|
+
self.logger.error(f"{file_path} - {str(e)}")
|
|
75
|
+
|
|
76
|
+
self._print_summary(fails)
|
|
77
|
+
if fails:
|
|
78
|
+
raise ValueError("JSON 格式错误!")
|
|
79
|
+
|
|
80
|
+
def _get_loader(self, json_type: JsonTypeEnum):
|
|
81
|
+
if json_type == JsonTypeEnum.JSON5:
|
|
82
|
+
try:
|
|
83
|
+
import json5
|
|
84
|
+
except ImportError:
|
|
85
|
+
self.logger.warning("json5 不可用,使用 json 检查")
|
|
86
|
+
json_type = JsonTypeEnum.JSON
|
|
87
|
+
elif json_type == JsonTypeEnum.PYJSON5:
|
|
88
|
+
try:
|
|
89
|
+
import pyjson5
|
|
90
|
+
except ImportError:
|
|
91
|
+
self.logger.warning("pyjson5 不可用,使用 json 检查")
|
|
92
|
+
json_type = JsonTypeEnum.JSON
|
|
93
|
+
else:
|
|
94
|
+
json_type = JsonTypeEnum.JSON
|
|
95
|
+
|
|
96
|
+
return self.loaders.get(json_type)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _print_summary(self, fails):
|
|
100
|
+
if fails:
|
|
101
|
+
self.logger.error("json 检查找到以下错误:")
|
|
102
|
+
for path, err in fails.items():
|
|
103
|
+
self.logger.error(f"{path}")
|
|
104
|
+
for detail in err:
|
|
105
|
+
self.logger.error(detail)
|
|
106
|
+
else:
|
|
107
|
+
self.logger.info("json 检查全部通过!")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def format_error_position(content: str, message: str, position: int, window: int = 50):
|
|
111
|
+
lines = content.splitlines()
|
|
112
|
+
curr_pos = 0
|
|
113
|
+
for ln, line in enumerate(lines, 1):
|
|
114
|
+
if curr_pos + len(line) >= position:
|
|
115
|
+
start = max(0, position - curr_pos - window)
|
|
116
|
+
end = min(len(line), position - curr_pos + window)
|
|
117
|
+
|
|
118
|
+
snippet = line[start:end]
|
|
119
|
+
marker = " " * (position - curr_pos - start) + "↑"
|
|
120
|
+
if start > 0:
|
|
121
|
+
marker = " " * 3 + marker
|
|
122
|
+
|
|
123
|
+
prefix = "..." if start > 0 else ""
|
|
124
|
+
suffix = "..." if end < len(line) else ""
|
|
125
|
+
|
|
126
|
+
return (f"Line {ln}: {message}", f"{prefix}{snippet}{suffix}", f"{marker} ({position - curr_pos + 1})")
|
|
127
|
+
curr_pos += len(line) + 1
|
|
128
|
+
return ""
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def format_error_row_and_col(content: str, message: str, lineno: int, colno: int, window: int = 50):
|
|
132
|
+
lines = content.splitlines()
|
|
133
|
+
for ln, line in enumerate(lines, 1):
|
|
134
|
+
if ln != lineno:
|
|
135
|
+
continue
|
|
136
|
+
|
|
137
|
+
start = max(0, colno - window)
|
|
138
|
+
end = min(len(line), colno + window)
|
|
139
|
+
|
|
140
|
+
snippet = line[start:end]
|
|
141
|
+
marker = " " * (colno - start - 1) + "↑"
|
|
142
|
+
if start > 0:
|
|
143
|
+
marker = " " * 3 + marker
|
|
144
|
+
|
|
145
|
+
prefix = "..." if start > 0 else ""
|
|
146
|
+
suffix = "..." if end < len(line) else ""
|
|
147
|
+
|
|
148
|
+
return (f"Line {ln}: {message}", f"{prefix}{snippet}{suffix}", f"{marker} ({colno})")
|
|
149
|
+
return ""
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def format_error(error: Exception, content: str, file_path: Path):
|
|
153
|
+
error_msg = str(error)
|
|
154
|
+
pos = getattr(error, 'pos', None)
|
|
155
|
+
if pos is not None:
|
|
156
|
+
return format_error_position(content, error_msg, error.pos)
|
|
157
|
+
|
|
158
|
+
args = getattr(error, 'args')
|
|
159
|
+
if args:
|
|
160
|
+
msg = args[0]
|
|
161
|
+
|
|
162
|
+
result = re.search(r"<string>:(\d+)\s+(.+?)\s+at column\s+(\d+)", msg)
|
|
163
|
+
if result:
|
|
164
|
+
lineno = int(result.group(1))
|
|
165
|
+
colno = int(result.group(3))
|
|
166
|
+
reason = result.group(2)
|
|
167
|
+
|
|
168
|
+
return format_error_row_and_col(content, reason, lineno=lineno, colno=colno)
|
|
169
|
+
|
|
170
|
+
result = re.search(r"near (\d+)", msg)
|
|
171
|
+
if result:
|
|
172
|
+
pos = int(result.group(1)) - 1
|
|
173
|
+
return format_error_position(content, msg, pos)
|
|
174
|
+
|
|
175
|
+
# 需要以 tuple 返回,和 format_error_x 返回类型一致
|
|
176
|
+
return f"{error_msg}\n in {file_path}",
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def validate(file_path: Path, loader: Callable):
|
|
180
|
+
try:
|
|
181
|
+
content = file_path.read_text(encoding='utf-8')
|
|
182
|
+
loader(content)
|
|
183
|
+
return None
|
|
184
|
+
except Exception as e:
|
|
185
|
+
return format_error(e, content, file_path)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def find_files(root_path: Path, extensions: List[str]):
|
|
189
|
+
if root_path.is_dir():
|
|
190
|
+
ret = list(root_path.rglob("*"))
|
|
191
|
+
elif root_path.is_file():
|
|
192
|
+
ret = [root_path]
|
|
193
|
+
else:
|
|
194
|
+
ret = []
|
|
195
|
+
|
|
196
|
+
return [path for path in ret if path.suffix.lstrip(".").lower() in extensions]
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def load_json(content: str):
|
|
200
|
+
import json
|
|
201
|
+
json.loads(content)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def load_json5(content: str):
|
|
205
|
+
import json5
|
|
206
|
+
json5.loads(content)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def load_pyjson5(content: str):
|
|
210
|
+
import pyjson5
|
|
211
|
+
pyjson5.loads(content)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def get_cpu_count():
|
|
215
|
+
return os.cpu_count() or 1
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def main():
|
|
219
|
+
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
|
220
|
+
parser.add_argument("-p", "--path", type=Path, default=Path(".").resolve())
|
|
221
|
+
parser.add_argument(
|
|
222
|
+
"-e",
|
|
223
|
+
"--extensions",
|
|
224
|
+
type=lambda s: [ext.strip().lstrip('.').lower() for ext in re.split(r'\s*[,,]\s*', s) if ext],
|
|
225
|
+
required=True
|
|
226
|
+
)
|
|
227
|
+
parser.add_argument("-j", "--json-type", choices=list(JsonTypeEnum), default=JsonTypeEnum.JSON)
|
|
228
|
+
parser.add_argument("-n", "--worker-num", type=int, default=get_cpu_count() * 2)
|
|
229
|
+
args = parser.parse_args()
|
|
230
|
+
|
|
231
|
+
validator = JSONValidator()
|
|
232
|
+
validator.validate_files(
|
|
233
|
+
root_path=args.path,
|
|
234
|
+
extensions=args.extensions,
|
|
235
|
+
json_type=args.json_type,
|
|
236
|
+
max_workers=args.worker_num
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
if __name__ == "__main__":
|
|
241
|
+
main()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
bmcgo/__init__.py,sha256=
|
|
1
|
+
bmcgo/__init__.py,sha256=raLp35VhtW_V2qbfKmaKKWBtbrpksL9JqqOSEC_mO-A,563
|
|
2
2
|
bmcgo/bmcgo.py,sha256=uD4TsfjrFB5aQPIS6WRUVc9ShXX-dSImY9ezkB13g1w,685
|
|
3
3
|
bmcgo/bmcgo_config.py,sha256=zPghH-W8vNK1bAc5PjfwnWzkHYT499PlGbhUWhPKT5U,10888
|
|
4
4
|
bmcgo/errors.py,sha256=QW1ndrJcJ2Ws7riOznPKVvZsNlrYk73eZol7w8gJTPU,3076
|
|
5
5
|
bmcgo/frame.py,sha256=iUZSd3Pj7T4yDZYX7A4DeaV9dnmJqOTjMIiJMmL9zfM,10427
|
|
6
6
|
bmcgo/logger.py,sha256=4TPOkBA80Z00rSCOdEv_WkwE5Kr3HCDt-HuVe9waXck,6645
|
|
7
|
-
bmcgo/misc.py,sha256=
|
|
7
|
+
bmcgo/misc.py,sha256=KNO1PX54UnxBpvT-4Y5BKHSSeJrmDJaWnUwVhfGquu0,4259
|
|
8
8
|
bmcgo/worker.py,sha256=-KxZIW4dziej5wCY-v5XEmtY-CDCL2-FO3VHFovlFbM,15228
|
|
9
9
|
bmcgo/cli/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
|
|
10
10
|
bmcgo/cli/cli.py,sha256=pqAkvjrk4F7x58-fYeGn0TydT3szZ2pM7guYwDoU2Ew,21520
|
|
@@ -158,7 +158,7 @@ bmcgo/codegen/lua/v1/script/render_utils/model_lua.py,sha256=zIcWxspjnfF-r9MZEXM
|
|
|
158
158
|
bmcgo/codegen/lua/v1/templates/apps/model.lua.mako,sha256=ORS8i3cDaP7rqEa1W3yI7DmD1X3wUeIZKj42I70AmS8,1979
|
|
159
159
|
bmcgo/codegen/lua/v1/templates/apps/service.lua.mako,sha256=52zAvt7tqgeSsBleaiOtpbUoTv0WUJd0mqzRXc8iNO4,7477
|
|
160
160
|
bmcgo/component/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
|
|
161
|
-
bmcgo/component/build.py,sha256=
|
|
161
|
+
bmcgo/component/build.py,sha256=S0borHjBQfb0EWQ6uqKWUJGImkzHpb2x5qqz-qnzsHI,8959
|
|
162
162
|
bmcgo/component/component_dt_version_parse.py,sha256=KyrfyjbrszU-hhG1Hr6TzKuSabmGIK51b_3KuVBv5-g,14139
|
|
163
163
|
bmcgo/component/component_helper.py,sha256=k-q2uT8XbZM6BgnQMFgqtyjwTtJxmsWCMMFc2_CIyJs,6319
|
|
164
164
|
bmcgo/component/deploy.py,sha256=EO0hSZzXYPG-1SQOhNMkqLQWSeqkU3RxKemsqfWrgBE,4569
|
|
@@ -177,7 +177,7 @@ bmcgo/component/analysis/smc_dfx_whitelist.json,sha256=dy_6-FddhG6UY7D1KUCW3Vme2
|
|
|
177
177
|
bmcgo/component/analysis/sr_validation.py,sha256=i1mlJb_D7RqE510LSAcCW81K1VUmZ7oSmLiMfUgdSJI,15598
|
|
178
178
|
bmcgo/component/coverage/__init__.py,sha256=ZgUEyI86FTlOdBzcuTzz7UqTtfWcz416Gx4BCqcQlhA,557
|
|
179
179
|
bmcgo/component/coverage/c_incremental_cov_report.template,sha256=FPhK1DZtmWsjDxa32R1ViH3IGCtNHcx0zFfgRo0s2nI,1576
|
|
180
|
-
bmcgo/component/coverage/incremental_cov.py,sha256=
|
|
180
|
+
bmcgo/component/coverage/incremental_cov.py,sha256=JFmlJONo0eVGu39Es5BmYyKVh-PuSOPqi4FqwqrcGfE,16823
|
|
181
181
|
bmcgo/component/template/conanbase.py.mako,sha256=MMZezCl5oFucRraOJt1WjmPL2S7wa4Hzfc7yDfTkW7Q,10949
|
|
182
182
|
bmcgo/component/template/conanfile.deploy.py.mako,sha256=zpxluBjUFmJHfFrnBknxZ3cv3cxcqzJuGh2eN0uMXZA,889
|
|
183
183
|
bmcgo/functional/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
|
|
@@ -185,12 +185,13 @@ bmcgo/functional/analysis.py,sha256=qjJQqd895-QmRpvges6ynwgV4w4vUYUqrMrajNUWON0,
|
|
|
185
185
|
bmcgo/functional/bmc_studio_action.py,sha256=Gg96UB8QtnhsaqSdMhXuS9fddzAFPhR6UYCpto9UOYA,3605
|
|
186
186
|
bmcgo/functional/check.py,sha256=LWoDAtEB2p65FemLEoNGz33ldtkbcJlc-uz8hwJl89U,8183
|
|
187
187
|
bmcgo/functional/conan_index_build.py,sha256=cYpv83DFnsbUJri_dKyThLo7-SDRQ4253P4Nud-HYFY,9074
|
|
188
|
-
bmcgo/functional/config.py,sha256=
|
|
188
|
+
bmcgo/functional/config.py,sha256=ZQ-a9hegI0cV41iTo7t49ryBeUH4wPJ-qkVvWp8toV4,10824
|
|
189
189
|
bmcgo/functional/csr_build.py,sha256=_1ZGYxMNOmd_52upS1RdXf1uT8rjaW1bfIw7psfkDt0,40791
|
|
190
190
|
bmcgo/functional/deploy.py,sha256=2NsxCpoZjL4jTyRpbIp20-EKKbQkQe-Hsm20uxHK2Xc,10677
|
|
191
191
|
bmcgo/functional/diff.py,sha256=WBH6aRVyVInzyvqQrmslqpItKncFbB2Z9WIBE1_O6bo,10558
|
|
192
192
|
bmcgo/functional/fetch.py,sha256=JE4iZt6a-vjuCrDg9RYDCTyLf5TvXZQvs0PgD3VBvtQ,10767
|
|
193
193
|
bmcgo/functional/full_component.py,sha256=AqVpWHtzdK-XwzE_l6vPcVNIVkAzyE2X5nqSkgsdvhA,16277
|
|
194
|
+
bmcgo/functional/json_check.py,sha256=ACoABAV1YfrrR98-G_0sX5i5lFHRjl00GspmKRdUFz8,3473
|
|
194
195
|
bmcgo/functional/maintain.py,sha256=8bUwaCsZAiBWDrf8NsdVoOvyMY2JOoXdzvahU9Hd8-0,17951
|
|
195
196
|
bmcgo/functional/new.py,sha256=A4--cy3R-moFD8KtrGGIzMiVVwnB2rL8qlrJz1dGGMg,6157
|
|
196
197
|
bmcgo/functional/schema_valid.py,sha256=jk4blLZgQCJv4eOY0YK2Fy0oRCdG1sfSssd2rGT-Eoc,3910
|
|
@@ -223,6 +224,7 @@ bmcgo/tasks/task_packet_to_supporte.py,sha256=eaNtri3YQfXFBnceM1-2C_6AgMgrGxEj4x
|
|
|
223
224
|
bmcgo/tasks/task_prepare.py,sha256=vKHb5QPbIx0lHOGpcDjeAB7rMfERqMUCad2EzxLauBw,4534
|
|
224
225
|
bmcgo/tasks/task_sign_and_pack_hpm.py,sha256=X8m1WAj3c0bKi2JAaumR81Qxv1FnFi0SrRL-l6vDRAo,1965
|
|
225
226
|
bmcgo/utils/__init__.py,sha256=BDXz8BcSlCkfo5UYt6j2rm89-HiYA1ZzfpFhy99MH-0,538
|
|
227
|
+
bmcgo/utils/basic_enums.py,sha256=L5VtHtzSvs6duAnphgqDGXX80Wit3Y7DjMlpi9MCxyI,1348
|
|
226
228
|
bmcgo/utils/buffer.py,sha256=t1SkWntWksboNFMPsltslwRdXZi3FAe8eV0JAAE7Vto,4004
|
|
227
229
|
bmcgo/utils/combine_json_schemas.py,sha256=08JrAlLeo_JgUqzYcZNgSwJZPLfjbWVJ4esPPt9bPMY,7967
|
|
228
230
|
bmcgo/utils/component_post.py,sha256=b2sr2IVensmnvcB7VcbIHkzCtS-fbtjPb4k1LiNReQk,2296
|
|
@@ -230,6 +232,7 @@ bmcgo/utils/component_version_check.py,sha256=ZhY3LUgmvuoDTlSjyFeh2blmcYbFcwtijN
|
|
|
230
232
|
bmcgo/utils/config.py,sha256=P3cqV0wlMn5U8NApUD7JKIuMVKqARtNfxsKopDn-rv4,48484
|
|
231
233
|
bmcgo/utils/fetch_component_code.py,sha256=vH9rY2YcXK5tBUEK7fLmKVxK9cYDM39FHmManBQA2KQ,10011
|
|
232
234
|
bmcgo/utils/install_manager.py,sha256=XMZUuIHm7_DWRdLV4dAevsyamQ6rt8lb_7OqGWzNBC8,4927
|
|
235
|
+
bmcgo/utils/json_validator.py,sha256=_k5wU78wfYGrzvSDaqOEtT4otgKUjquVhZNpVf2PW_c,7524
|
|
233
236
|
bmcgo/utils/mapping_config_patch.py,sha256=_gKfZnrvsLPgHn1yXhEJRVTAeuGpeGD9T-Pqyw5Ydys,16827
|
|
234
237
|
bmcgo/utils/perf_analysis.py,sha256=fh6lV9AAKVhpPkGPwAJ8EWfGfUoHjqGYQxrvc32Xiac,4767
|
|
235
238
|
bmcgo/utils/tools.py,sha256=fLKBz_FiNc0s8UBkXQ_TZrzldCYLGEH8ZuqLUgS9g30,28849
|
|
@@ -242,8 +245,8 @@ bmcgo/utils/installations/version_util.py,sha256=dOwvLZ7iOmnzSeyD6_pRm7NS7I13Um5
|
|
|
242
245
|
bmcgo/utils/installations/install_plans/bingo.yml,sha256=Zw1HnAyNJdEwkE3fnd-_GCe9bwv1m6bmMlaQTJXaFa8,210
|
|
243
246
|
bmcgo/utils/installations/installers/apt_installer.py,sha256=nPaCb4cobSi9InN_aHsEPtQ0k4FgsCUWE5_VgBPvcRE,3769
|
|
244
247
|
bmcgo/utils/installations/installers/pip_installer.py,sha256=dDdios1EQ7fzt90r02pZeoM3jCmjslLzkSvzd2hgRVM,3241
|
|
245
|
-
openubmc_bingo-0.5.
|
|
246
|
-
openubmc_bingo-0.5.
|
|
247
|
-
openubmc_bingo-0.5.
|
|
248
|
-
openubmc_bingo-0.5.
|
|
249
|
-
openubmc_bingo-0.5.
|
|
248
|
+
openubmc_bingo-0.5.254.dist-info/METADATA,sha256=8j5YISPGw7_HqnCHCbsotTo030S0JKPoYYE9dLw5-qU,925
|
|
249
|
+
openubmc_bingo-0.5.254.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
250
|
+
openubmc_bingo-0.5.254.dist-info/entry_points.txt,sha256=UUoUP-vAWTgg9vEYbRwYqOBHgpRtkngdzMPb-ocz90g,42
|
|
251
|
+
openubmc_bingo-0.5.254.dist-info/top_level.txt,sha256=9AcvCAt1nZcOgMsGt6T07mg2Bgtdet-3mHTwg91axgI,6
|
|
252
|
+
openubmc_bingo-0.5.254.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|