lbkit 0.5.16__tar.gz → 0.5.18__tar.gz
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.
- {lbkit-0.5.16/lbkit.egg-info → lbkit-0.5.18}/PKG-INFO +1 -1
- lbkit-0.5.18/lbkit/__init__.py +2 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/ctype_defination.py +37 -32
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/idf_interface.py +67 -12
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/public.c.mako +18 -19
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/server.c.mako +5 -5
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/component/build.py +11 -11
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/component/template/deploy.mako +23 -1
- {lbkit-0.5.16 → lbkit-0.5.18/lbkit.egg-info}/PKG-INFO +1 -1
- lbkit-0.5.16/lbkit/__init__.py +0 -2
- {lbkit-0.5.16 → lbkit-0.5.18}/AUTHORS +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/LICENSE +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/MANIFEST.in +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/README.md +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/ci_robot/__init__.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/ci_robot/gitee.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/cli.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/__init__.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/codegen.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/renderer.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/client.c.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/client.h.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/interface.c.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/public.h.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/codegen/template/server.h.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/component/__init__.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/component/arg_parser.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/component/template/conanbase.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/component/test.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/errors.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/helper.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/__init__.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/build_image.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/build_manifest.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/build_prepare.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/build_rootfs.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/config.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/task.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/integration/template/conanfile.py.mako +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/lbkit.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/log.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/misc.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit/tools.py +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit.egg-info/SOURCES.txt +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit.egg-info/dependency_links.txt +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit.egg-info/entry_points.txt +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit.egg-info/requires.txt +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/lbkit.egg-info/top_level.txt +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/setup.cfg +0 -0
- {lbkit-0.5.16 → lbkit-0.5.18}/setup.py +0 -0
|
@@ -5,9 +5,11 @@ from lbkit.errors import OdfValidateException
|
|
|
5
5
|
|
|
6
6
|
class IdfValidator():
|
|
7
7
|
validator = {}
|
|
8
|
+
name = ""
|
|
8
9
|
|
|
9
|
-
def set_validator(self, value):
|
|
10
|
+
def set_validator(self, value, name):
|
|
10
11
|
self.validator = value
|
|
12
|
+
self.name = name
|
|
11
13
|
|
|
12
14
|
def odf_validate(self):
|
|
13
15
|
idf_validator = idf_validator
|
|
@@ -84,8 +86,8 @@ class IntegerValidator(IdfValidator):
|
|
|
84
86
|
raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}")
|
|
85
87
|
super().__init__()
|
|
86
88
|
|
|
87
|
-
def set_validator(self, value):
|
|
88
|
-
super().set_validator(value)
|
|
89
|
+
def set_validator(self, value, name):
|
|
90
|
+
super().set_validator(value, name)
|
|
89
91
|
max = self.validator.get("max", self.maximum)
|
|
90
92
|
if max > self.maximum:
|
|
91
93
|
max = self.maximum
|
|
@@ -97,20 +99,23 @@ class IntegerValidator(IdfValidator):
|
|
|
97
99
|
if not self.signed and self.minimum < 0:
|
|
98
100
|
self.minimum = 0
|
|
99
101
|
if self.maximum < self.minimum:
|
|
100
|
-
raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}")
|
|
102
|
+
raise OdfValidateException(f"The max value {self.maximum} less than or equal to {self.minimum}, property {name} validation failed")
|
|
101
103
|
|
|
102
104
|
def odf_validate(self):
|
|
103
105
|
func = []
|
|
104
106
|
if self.signed:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
min_str = self.minimum
|
|
108
|
+
max_str = self.maximum
|
|
109
|
+
if self.minimum <= -9223372036854775808:
|
|
110
|
+
min_str = "G_MININT64"
|
|
111
|
+
if self.maximum >= 9223372036854775807:
|
|
112
|
+
max_str = "G_MAXINT64"
|
|
113
|
+
func.append(f"validate_odf_as_signed(doc, node, prop, {max_str}, {min_str}, error_list)")
|
|
109
114
|
else:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
max_str = f"{self.maximum}UL"
|
|
116
|
+
if self.maximum >= 18446744073709551615:
|
|
117
|
+
max_str = "G_MAXUINT64"
|
|
118
|
+
func.append(f"validate_odf_as_unsigned(doc, node, prop, {max_str}, {self.minimum}UL, error_list)")
|
|
114
119
|
return func
|
|
115
120
|
|
|
116
121
|
def odf_schema(self, allow_ref):
|
|
@@ -142,21 +147,21 @@ class IntegerValidator(IdfValidator):
|
|
|
142
147
|
class IntegerArrayValidator(IntegerValidator):
|
|
143
148
|
def odf_validate(self):
|
|
144
149
|
func = []
|
|
145
|
-
|
|
146
|
-
|
|
150
|
+
min_str = f"{self.minimum}UL"
|
|
151
|
+
max_str = f"{self.maximum}UL"
|
|
147
152
|
if self.signed:
|
|
148
|
-
if self.minimum <= -
|
|
149
|
-
|
|
153
|
+
if self.minimum <= -9223372036854775808:
|
|
154
|
+
min_str = "G_MININT64"
|
|
150
155
|
if self.maximum >= 0x7fff_ffff_ffff_ffff:
|
|
151
|
-
|
|
156
|
+
max_str = "G_MAXINT64"
|
|
152
157
|
else:
|
|
153
158
|
if self.maximum >= 0xffff_ffff_ffff_ffff:
|
|
154
|
-
|
|
159
|
+
max_str = "G_MAXUINT64"
|
|
155
160
|
|
|
156
161
|
if self.signed:
|
|
157
|
-
func.append(f"validate_odf_as_signed_v(doc, node, prop, {
|
|
162
|
+
func.append(f"validate_odf_as_signed_v(doc, node, prop, {max_str}, {min_str}, error_list)")
|
|
158
163
|
else:
|
|
159
|
-
func.append(f"validate_odf_as_unsigned_v(doc, node, prop, {
|
|
164
|
+
func.append(f"validate_odf_as_unsigned_v(doc, node, prop, {max_str}, {min_str}, error_list)")
|
|
160
165
|
return func
|
|
161
166
|
|
|
162
167
|
def odf_schema(self, allow_ref):
|
|
@@ -199,18 +204,18 @@ class FloatValidator(IdfValidator):
|
|
|
199
204
|
def odf_validate(self):
|
|
200
205
|
func = ["validate_odf_as_double(doc, node, prop, error_list)"]
|
|
201
206
|
if self.exclusive_max is not None:
|
|
202
|
-
func.append(f"
|
|
207
|
+
func.append(f"validate_odf_as_double_exclusive_max(doc, node, prop, {self.exclusive_max}, error_list)")
|
|
203
208
|
elif self.maximum != sys.float_info.max:
|
|
204
|
-
func.append(f"
|
|
209
|
+
func.append(f"validate_odf_as_double_max(doc, node, prop, {self.maximum}, error_list)")
|
|
205
210
|
|
|
206
211
|
if self.exclusive_min is not None:
|
|
207
|
-
func.append(f"
|
|
212
|
+
func.append(f"validate_odf_as_double_exclusive_min(doc, node, prop, {self.exclusive_min}, error_list)")
|
|
208
213
|
elif self.minimum != (-sys.float_info.max):
|
|
209
|
-
func.append(f"
|
|
214
|
+
func.append(f"validate_odf_as_double_min(doc, node, prop, {self.minimum}, error_list)")
|
|
210
215
|
return func
|
|
211
216
|
|
|
212
|
-
def set_validator(self, value):
|
|
213
|
-
super().set_validator(value)
|
|
217
|
+
def set_validator(self, value, name):
|
|
218
|
+
super().set_validator(value, name)
|
|
214
219
|
self.maximum = self.validator.get("max", self.maximum)
|
|
215
220
|
self.minimum = self.validator.get("min", self.minimum)
|
|
216
221
|
self.exclusive_max = self.validator.get("exclusive_max", None)
|
|
@@ -256,14 +261,14 @@ class FloatArrayValidator(FloatValidator):
|
|
|
256
261
|
def odf_validate(self):
|
|
257
262
|
func = ["validate_odf_as_double_v(doc, node, prop, error_list)"]
|
|
258
263
|
if self.exclusive_max is not None:
|
|
259
|
-
func.append(f"
|
|
264
|
+
func.append(f"validate_odf_as_double_exclusive_max_v(doc, node, prop, {self.exclusive_max}, error_list)")
|
|
260
265
|
elif self.maximum != sys.float_info.max:
|
|
261
|
-
func.append(f"
|
|
266
|
+
func.append(f"validate_odf_as_double_max_v(doc, node, prop, {self.maximum}, error_list)")
|
|
262
267
|
|
|
263
268
|
if self.exclusive_min is not None:
|
|
264
|
-
func.append(f"
|
|
269
|
+
func.append(f"validate_odf_as_double_exclusive_min_v(doc, node, prop, {self.exclusive_min}, error_list)")
|
|
265
270
|
elif self.minimum != (-sys.float_info.max):
|
|
266
|
-
func.append(f"
|
|
271
|
+
func.append(f"validate_odf_as_double_min_v(doc, node, prop, {self.minimum}, error_list)")
|
|
267
272
|
return func
|
|
268
273
|
|
|
269
274
|
def odf_schema(self, allow_ref):
|
|
@@ -294,9 +299,9 @@ class StringValidator(IdfValidator):
|
|
|
294
299
|
self.pattern = pattern
|
|
295
300
|
super().__init__()
|
|
296
301
|
|
|
297
|
-
def set_validator(self, value):
|
|
302
|
+
def set_validator(self, value, name):
|
|
303
|
+
super().set_validator(value, name)
|
|
298
304
|
self.pattern = self.validator.get("pattern", self.pattern)
|
|
299
|
-
super().set_validator(value)
|
|
300
305
|
|
|
301
306
|
def odf_validate(self):
|
|
302
307
|
func = []
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import yaml
|
|
2
2
|
import os
|
|
3
3
|
import re
|
|
4
|
+
import copy
|
|
4
5
|
import hashlib
|
|
5
6
|
from lbkit.log import Logger
|
|
6
7
|
from lbkit.codegen.renderer import Renderer
|
|
7
8
|
from lbkit.codegen.ctype_defination import CTYPE_OBJS, RefObjArrayValidator, RefObjValidator
|
|
8
9
|
from lbkit.misc import load_yml_with_json_schema_validate
|
|
10
|
+
from lbkit.errors import OdfValidateException
|
|
9
11
|
|
|
10
12
|
log = Logger("gen_interface")
|
|
11
13
|
|
|
@@ -39,14 +41,14 @@ class IdfAnnotation():
|
|
|
39
41
|
else:
|
|
40
42
|
raise IDFException(f"the value of {name} with type error, must be a string or bool, but real type is {type(value)}")
|
|
41
43
|
|
|
42
|
-
# "pattern": "^(readwrite|readonly|writeonly|deprecated|
|
|
44
|
+
# "pattern": "^(readwrite|readonly|writeonly|deprecated|hidden|emits_change|emits_invalidation|refval|refobj)(,(readwrite|readonly|writeonly|deprecated|hidden|emits_change|emits_invalidation|refobj|refval))*$"
|
|
43
45
|
ANNOTATION_MAP = {
|
|
44
46
|
"deprecated": IdfAnnotation("org.freedesktop.DBus.Deprecated", "true"),
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
47
|
+
"emits_change": IdfAnnotation("org.freedesktop.DBus.Property.EmitsChangedSignal", "true"),
|
|
48
|
+
"emits_invalidation": IdfAnnotation("org.freedesktop.DBus.Property.EmitsChangedSignal", "invalidates"),
|
|
49
|
+
"const": IdfAnnotation("org.freedesktop.DBus.Property.EmitsChangedSignal", "const"),
|
|
48
50
|
"emits_false": IdfAnnotation("org.freedesktop.DBus.Property.EmitsChangedSignal", "false"),
|
|
49
|
-
"
|
|
51
|
+
"hidden": IdfAnnotation("com.litebmc.Dbus.Property.Private", "const"),
|
|
50
52
|
"refobj": IdfAnnotation("com.litebmc.Dbus.Property.RefObject", "true"),
|
|
51
53
|
"required": IdfAnnotation("com.litebmc.Dbus.Property.Required", "true"),
|
|
52
54
|
}
|
|
@@ -130,6 +132,7 @@ class IdfCtypeRender():
|
|
|
130
132
|
intf: IdfInterfaceBase = None
|
|
131
133
|
ctype: str = None
|
|
132
134
|
name: str = ""
|
|
135
|
+
idf_data = None
|
|
133
136
|
flags: list[str] = []
|
|
134
137
|
|
|
135
138
|
def __init__(self):
|
|
@@ -144,19 +147,26 @@ class IdfCtypeRender():
|
|
|
144
147
|
if "variant" == self.ctype:
|
|
145
148
|
return []
|
|
146
149
|
match = re.match(f"^array\[({CTYPE_BASE_REG})\]$", self.ctype)
|
|
150
|
+
validator_cfg = self.validator_cfg
|
|
147
151
|
if match:
|
|
148
152
|
if "refobj" in self.flags:
|
|
149
153
|
valiator = RefObjArrayValidator()
|
|
150
154
|
return valiator.odf_validate()
|
|
151
|
-
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
152
|
-
|
|
155
|
+
ctype_obj = copy.deepcopy(CTYPE_OBJS.get(self.ctype))
|
|
156
|
+
validator = ctype_obj.validator
|
|
157
|
+
if validator_cfg:
|
|
158
|
+
validator.set_validator(validator_cfg, self.name)
|
|
159
|
+
return validator.odf_validate()
|
|
153
160
|
match = re.match(f"^({CTYPE_BASE_REG})$", self.ctype)
|
|
154
161
|
if match:
|
|
155
162
|
if "refobj" in self.flags:
|
|
156
163
|
valiator = RefObjValidator()
|
|
157
164
|
return valiator.odf_validate()
|
|
158
|
-
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
159
|
-
|
|
165
|
+
ctype_obj = copy.deepcopy(CTYPE_OBJS.get(self.ctype))
|
|
166
|
+
validator = ctype_obj.validator
|
|
167
|
+
if validator_cfg:
|
|
168
|
+
validator.set_validator(validator_cfg, self.name)
|
|
169
|
+
return validator.odf_validate()
|
|
160
170
|
# 非基础类型
|
|
161
171
|
is_array = False
|
|
162
172
|
ctype = self.ctype
|
|
@@ -500,9 +510,52 @@ class IdfCtypeRender():
|
|
|
500
510
|
else:
|
|
501
511
|
return f"<arg_name> = _load_odf_as_{stru_name}(doc, <node>)"
|
|
502
512
|
|
|
513
|
+
@property
|
|
514
|
+
def validator_cfg(self):
|
|
515
|
+
cfg = {}
|
|
516
|
+
if (self.ctype == "string" or self.ctype == "array[string]" or
|
|
517
|
+
self.ctype == "object_path" or self.ctype == "array[object_path]" or
|
|
518
|
+
self.ctype == "signature" or self.ctype == "array[signature]"):
|
|
519
|
+
value = self.idf_data.get("pattern")
|
|
520
|
+
if value:
|
|
521
|
+
cfg["pattern"] = value
|
|
522
|
+
elif (self.ctype == "byte" or self.ctype == "array[byte]" or
|
|
523
|
+
self.ctype == "int16" or self.ctype == "array[int16]" or
|
|
524
|
+
self.ctype == "uint16" or self.ctype == "array[uint16]" or
|
|
525
|
+
self.ctype == "int32" or self.ctype == "array[int32]" or
|
|
526
|
+
self.ctype == "uint32" or self.ctype == "array[uint32]" or
|
|
527
|
+
self.ctype == "int64" or self.ctype == "array[int64]" or
|
|
528
|
+
self.ctype == "uint64" or self.ctype == "array[uint64]"):
|
|
529
|
+
value = self.idf_data.get("max")
|
|
530
|
+
if value:
|
|
531
|
+
cfg["max"] = value
|
|
532
|
+
value = self.idf_data.get("min")
|
|
533
|
+
if value:
|
|
534
|
+
cfg["min"] = value
|
|
535
|
+
if self.ctype == "double" or self.ctype == "array[double]":
|
|
536
|
+
emin = self.idf_data.get("exclusive_min")
|
|
537
|
+
if emin:
|
|
538
|
+
cfg["exclusive_min"] = emin
|
|
539
|
+
emax = self.idf_data.get("exclusive_max")
|
|
540
|
+
if emax:
|
|
541
|
+
cfg["exclusive_max"] = emax
|
|
542
|
+
mmin = self.idf_data.get("min")
|
|
543
|
+
if mmin:
|
|
544
|
+
cfg["min"] = mmin
|
|
545
|
+
mmax = self.idf_data.get("max")
|
|
546
|
+
if mmax:
|
|
547
|
+
cfg["max"] = mmax
|
|
548
|
+
if mmax is not None and emax is not None:
|
|
549
|
+
raise OdfValidateException(f"Cannot set max and exclusive_max at the same time, property {self.name} validation failed")
|
|
550
|
+
if mmin is not None and emin is not None:
|
|
551
|
+
raise OdfValidateException(f"Cannot set min and exclusive_min at the same time, property {self.name} validation failed")
|
|
552
|
+
return cfg
|
|
553
|
+
|
|
554
|
+
|
|
503
555
|
class IdfProperty(IdfCtypeRender):
|
|
504
556
|
def __init__(self, intf: IdfInterfaceBase, prop_data):
|
|
505
557
|
self.intf = intf
|
|
558
|
+
self.idf_data = prop_data
|
|
506
559
|
self.ctype = prop_data.get("type", "")
|
|
507
560
|
super().__init__()
|
|
508
561
|
self.name = prop_data.get("name")
|
|
@@ -511,7 +564,7 @@ class IdfProperty(IdfCtypeRender):
|
|
|
511
564
|
self.description = prop_data.get("description", "")
|
|
512
565
|
flags = prop_data.get("flags", "").split(",")
|
|
513
566
|
self.flags = flags
|
|
514
|
-
self.private = True if ("
|
|
567
|
+
self.private = True if ("hidden" in flags) else False
|
|
515
568
|
self.deprecated = True if ("deprecated" in flags) else False
|
|
516
569
|
# refobj的ctype只能是s或as
|
|
517
570
|
if "refobj" in flags and self.ctype != "string" and self.ctype != "array[string]":
|
|
@@ -528,11 +581,11 @@ class IdfProperty(IdfCtypeRender):
|
|
|
528
581
|
c_flags = []
|
|
529
582
|
if self.private:
|
|
530
583
|
c_flags.append("PM_FLAGS_PROPERTY_PRIVATE")
|
|
531
|
-
elif "
|
|
584
|
+
elif "const" in flags:
|
|
532
585
|
c_flags.append("PM_FLAGS_PROPERTY_EMIT_CONST")
|
|
533
586
|
elif "emits_false" in flags:
|
|
534
587
|
c_flags.append("PM_FLAGS_PROPERTY_EMIT_FALSE")
|
|
535
|
-
elif "
|
|
588
|
+
elif "emits_invalidation" in flags:
|
|
536
589
|
c_flags.append("PM_FLAGS_PROPERTY_EMIT_INVALIDATES")
|
|
537
590
|
else:
|
|
538
591
|
c_flags.append("PM_FLAGS_PROPERTY_EMIT_TRUE")
|
|
@@ -548,8 +601,10 @@ class IdfProperty(IdfCtypeRender):
|
|
|
548
601
|
def signature(self):
|
|
549
602
|
return ctype_to_variant_signature(self.intf, self.ctype)
|
|
550
603
|
|
|
604
|
+
|
|
551
605
|
class IdfParameter(IdfCtypeRender):
|
|
552
606
|
def __init__(self, intf: IdfInterfaceBase, para_data):
|
|
607
|
+
self.idf_data = para_data
|
|
553
608
|
self.intf = intf
|
|
554
609
|
self.name = para_data.get("name")
|
|
555
610
|
self.ctype = para_data.get("type", "")
|
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
% for name, stru in intf.structures.items():
|
|
7
7
|
/* ${name} structure object */
|
|
8
8
|
/* START: 结构体${name}及其数组类型的ODF校验函数 */
|
|
9
|
-
static gboolean _validate_odf_as_struct_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
10
|
-
static gboolean _validate_odf_as_struct_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
9
|
+
static gboolean __attribute__((unused)) _validate_odf_as_struct_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
10
|
+
static gboolean __attribute__((unused)) _validate_odf_as_struct_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
11
11
|
|
|
12
12
|
% endfor
|
|
13
13
|
## 定义枚举ODF加载函数
|
|
14
14
|
% for name, enum in intf.enumerations.items():
|
|
15
15
|
/* START: 枚举${name}及其数组类型的ODF校验函数 */
|
|
16
|
-
static gboolean _validate_odf_as_enum_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
17
|
-
static gboolean _validate_odf_as_enum_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
16
|
+
static gboolean __attribute__((unused)) _validate_odf_as_enum_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
17
|
+
static gboolean __attribute__((unused)) _validate_odf_as_enum_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
18
18
|
|
|
19
19
|
% endfor
|
|
20
20
|
## 定义字典ODF加载函数
|
|
21
21
|
% for name, dictionary in intf.dictionaries.items():
|
|
22
|
-
static gboolean _validate_odf_as_dict_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
23
|
-
static gboolean _validate_odf_as_dict_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
22
|
+
static gboolean __attribute__((unused)) _validate_odf_as_dict_${name}(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
23
|
+
static gboolean __attribute__((unused)) _validate_odf_as_dict_${name}_v(yaml_document_t *doc, yaml_node_t *node, GString *prop, GSList **error_list);
|
|
24
24
|
|
|
25
25
|
% endfor
|
|
26
26
|
% for name, stru in intf.structures.items():
|
|
@@ -36,7 +36,7 @@ GVariant *${name}_encode(const ${name} *value)
|
|
|
36
36
|
value = &default_val;
|
|
37
37
|
}
|
|
38
38
|
% endif
|
|
39
|
-
GVariant *tmp = NULL;
|
|
39
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
40
40
|
GVariantBuilder builder;
|
|
41
41
|
const gchar *sig = "${stru.signature}";
|
|
42
42
|
g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
|
|
@@ -56,7 +56,7 @@ GVariant *${name}_encode(const ${name} *value)
|
|
|
56
56
|
${name} *${name}_decode(GVariant *in)
|
|
57
57
|
{
|
|
58
58
|
GVariantIter iter;
|
|
59
|
-
GVariant *tmp = NULL;
|
|
59
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
60
60
|
${name} *output = g_new0(${name}, 1);
|
|
61
61
|
if (!in) {
|
|
62
62
|
return output;
|
|
@@ -161,9 +161,9 @@ gboolean _validate_odf_as_struct_${name}(yaml_document_t *doc, yaml_node_t *node
|
|
|
161
161
|
"the node type of property %s is not a mapping, get %s", prop->str, gcl_yaml_node_type_str(node->type)));
|
|
162
162
|
return FALSE;
|
|
163
163
|
}
|
|
164
|
-
gsize len = prop->len;
|
|
164
|
+
__attribute__((unused)) gsize len = prop->len;
|
|
165
165
|
gboolean valid = TRUE;
|
|
166
|
-
yaml_node_t *val;
|
|
166
|
+
__attribute__((unused)) yaml_node_t *val;
|
|
167
167
|
GHashTable *prop_table = load_yaml_mapping_to_hash_table(doc, node);
|
|
168
168
|
% for prop in stru.values.parameters:
|
|
169
169
|
val = g_hash_table_lookup(prop_table, "${prop.name}");
|
|
@@ -501,7 +501,7 @@ static void ${name}_foreach_encode(${key_declare}, ${name}${dictionary.key} *val
|
|
|
501
501
|
g_assert(value && dict_builder);
|
|
502
502
|
% endif
|
|
503
503
|
|
|
504
|
-
GVariant *tmp = NULL;
|
|
504
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
505
505
|
GVariantBuilder builder;
|
|
506
506
|
% if len(dictionary.values.parameters) == 1:
|
|
507
507
|
## 当只有一个成员时直接添加值
|
|
@@ -563,7 +563,6 @@ ${name} *${name}_decode(GVariant *in)
|
|
|
563
563
|
% if len(dictionary.values.parameters) > 1:
|
|
564
564
|
GVariantIter item_iter;
|
|
565
565
|
% endif
|
|
566
|
-
GVariant *next_item = NULL;
|
|
567
566
|
GVariant *next_mem = NULL;
|
|
568
567
|
|
|
569
568
|
${name} *dict = ${name}_new();
|
|
@@ -824,7 +823,7 @@ GVariant *${class_name}_${method.name}_Req_encode(${class_name}_${method.name}_R
|
|
|
824
823
|
if (!value) {
|
|
825
824
|
value = &default_val;
|
|
826
825
|
}
|
|
827
|
-
GVariant *tmp = NULL;
|
|
826
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
828
827
|
GVariantBuilder builder;
|
|
829
828
|
const gchar *sig = "${method.in_signature}";
|
|
830
829
|
g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
|
|
@@ -842,7 +841,7 @@ GVariant *${class_name}_${method.name}_Req_encode(${class_name}_${method.name}_R
|
|
|
842
841
|
${class_name}_${method.name}_Req *${class_name}_${method.name}_Req_decode(GVariant *in)
|
|
843
842
|
{
|
|
844
843
|
GVariantIter iter;
|
|
845
|
-
GVariant *tmp = NULL;
|
|
844
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
846
845
|
${class_name}_${method.name}_Req *output = g_new0(${class_name}_${method.name}_Req, 1);
|
|
847
846
|
if (!in) {
|
|
848
847
|
return output;
|
|
@@ -885,7 +884,7 @@ GVariant *${class_name}_${method.name}_Rsp_encode(${class_name}_${method.name}_R
|
|
|
885
884
|
if (!value) {
|
|
886
885
|
value = &default_val;
|
|
887
886
|
}
|
|
888
|
-
GVariant *tmp = NULL;
|
|
887
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
889
888
|
GVariantBuilder builder;
|
|
890
889
|
const gchar *sig = "${method.out_signature}";
|
|
891
890
|
g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
|
|
@@ -903,7 +902,7 @@ GVariant *${class_name}_${method.name}_Rsp_encode(${class_name}_${method.name}_R
|
|
|
903
902
|
${class_name}_${method.name}_Rsp *${class_name}_${method.name}_Rsp_decode(GVariant *in)
|
|
904
903
|
{
|
|
905
904
|
GVariantIter iter;
|
|
906
|
-
GVariant *tmp = NULL;
|
|
905
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
907
906
|
${class_name}_${method.name}_Rsp *output = g_new0(${class_name}_${method.name}_Rsp, 1);
|
|
908
907
|
if (!in) {
|
|
909
908
|
return output;
|
|
@@ -1077,7 +1076,7 @@ GVariant *${class_name}_${signal.name}_Msg_encode(${class_name}_${signal.name}_M
|
|
|
1077
1076
|
if (!value) {
|
|
1078
1077
|
value = &default_val;
|
|
1079
1078
|
}
|
|
1080
|
-
GVariant *tmp = NULL;
|
|
1079
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
1081
1080
|
GVariantBuilder builder;
|
|
1082
1081
|
const gchar *sig = "${signal.signature}";
|
|
1083
1082
|
g_variant_builder_init(&builder, G_VARIANT_TYPE(sig));
|
|
@@ -1095,7 +1094,7 @@ GVariant *${class_name}_${signal.name}_Msg_encode(${class_name}_${signal.name}_M
|
|
|
1095
1094
|
${class_name}_${signal.name}_Msg *${class_name}_${signal.name}_Msg_decode(GVariant *in)
|
|
1096
1095
|
{
|
|
1097
1096
|
GVariantIter iter;
|
|
1098
|
-
GVariant *tmp = NULL;
|
|
1097
|
+
__attribute__((unused)) GVariant *tmp = NULL;
|
|
1099
1098
|
${class_name}_${signal.name}_Msg *output = g_new0(${class_name}_${signal.name}_Msg, 1);
|
|
1100
1099
|
if (!in) {
|
|
1101
1100
|
return output;
|
|
@@ -1162,7 +1161,7 @@ static gboolean _validate_odf_prop_${prop.name}(yaml_document_t *doc, GHashTable
|
|
|
1162
1161
|
if (!node) {
|
|
1163
1162
|
## 检查属性是否存在
|
|
1164
1163
|
% if "required" in prop.flags:
|
|
1165
|
-
*error_list = g_slist_append(*error_list, g_error_new(ODF_ERROR, ODF_ERROR_PROP_MISSING, "Property
|
|
1164
|
+
*error_list = g_slist_append(*error_list, g_error_new(ODF_ERROR, ODF_ERROR_PROP_MISSING, "Property ${prop.name} is missing"));
|
|
1166
1165
|
valid = FALSE;
|
|
1167
1166
|
% endif
|
|
1168
1167
|
break;
|
|
@@ -44,7 +44,7 @@ ${name} *_load_odf_as_${name}(yaml_document_t *doc, yaml_node_t *node)
|
|
|
44
44
|
% if cnt == 0:
|
|
45
45
|
return g_new0(${name}, 1);
|
|
46
46
|
% else:
|
|
47
|
-
yaml_node_t *val;
|
|
47
|
+
__attribute__((unused)) yaml_node_t *val;
|
|
48
48
|
${name} *output = g_new0(${name}, 1);
|
|
49
49
|
GHashTable *prop_table = load_yaml_mapping_to_hash_table(doc, node);
|
|
50
50
|
% for prop in stru.values.parameters:
|
|
@@ -236,7 +236,6 @@ gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const
|
|
|
236
236
|
static GclObject *_${class_name}_create(const gchar *obj_name, gpointer opaque);
|
|
237
237
|
static void _load_from_odf(yaml_document_t *doc, yaml_node_t *node, GclObject *gcl_obj,
|
|
238
238
|
property_reference_loaded ref_loaded, gpointer user_data);
|
|
239
|
-
static void _valid_from_odf(yaml_document_t *doc, yaml_node_t *node, const gchar *object_name);
|
|
240
239
|
|
|
241
240
|
static GclInterface _${class_name}_interface = {
|
|
242
241
|
.create = _${intf.alias}_create,
|
|
@@ -255,7 +254,7 @@ static void _load_odf_as_prop_${prop.name}(yaml_document_t *doc, GHashTable *pro
|
|
|
255
254
|
const gchar *flags = NULL;
|
|
256
255
|
yaml_node_t *val = g_hash_table_lookup(prop_table, "_${prop.name}_flags");
|
|
257
256
|
if (val && val->type == YAML_SCALAR_NODE) {
|
|
258
|
-
flags = val->data.scalar.value;
|
|
257
|
+
flags = (const gchar *)val->data.scalar.value;
|
|
259
258
|
}
|
|
260
259
|
val = g_hash_table_lookup(prop_table, "${prop.name}");
|
|
261
260
|
## validate接口在加载odf前完成属性是否必选校验,此处如果是必选属性一定存在
|
|
@@ -269,8 +268,9 @@ static void _load_odf_as_prop_${prop.name}(yaml_document_t *doc, GHashTable *pro
|
|
|
269
268
|
% if "refobj" in prop.flags:
|
|
270
269
|
ref_loaded(obj, &${properties}.${prop.name}, doc, val, user_data, flags);
|
|
271
270
|
% else:
|
|
272
|
-
|
|
273
|
-
|
|
271
|
+
const gchar *val_str = (const gchar *)val->data.scalar.value;
|
|
272
|
+
if (val->type == YAML_SCALAR_NODE && val_str[0] == '$' &&
|
|
273
|
+
g_regex_match(gcl_ref_prop_regex(), val_str, 0, NULL)) {
|
|
274
274
|
ref_loaded(obj, &${properties}.${prop.name}, doc, val, user_data, flags);
|
|
275
275
|
} else {
|
|
276
276
|
% if prop.odf_load_func() is not None:
|
|
@@ -59,7 +59,6 @@ class BuildComponent():
|
|
|
59
59
|
self.build_type = self.options.build_type
|
|
60
60
|
self.profile = self.options.profile
|
|
61
61
|
self.profile_build = self.options.profile_build
|
|
62
|
-
self.runtime_packages = []
|
|
63
62
|
self.verbose = False if self.options.summary else True
|
|
64
63
|
self.from_source = self.options.from_source
|
|
65
64
|
# 当前组件及其依赖将被部署到rootfs目录
|
|
@@ -134,14 +133,8 @@ class BuildComponent():
|
|
|
134
133
|
if self.options.test:
|
|
135
134
|
for rt in requires.get("test", []):
|
|
136
135
|
deps.append(rt)
|
|
137
|
-
conan = rt.get("conan")
|
|
138
|
-
if conan is not None:
|
|
139
|
-
self.runtime_packages.append(conan)
|
|
140
136
|
for rt in requires.get("compile", []):
|
|
141
137
|
deps.append(rt)
|
|
142
|
-
conan = rt.get("conan")
|
|
143
|
-
if conan is not None:
|
|
144
|
-
self.runtime_packages.append(conan)
|
|
145
138
|
|
|
146
139
|
for dep in deps:
|
|
147
140
|
option = dep.get("option", {})
|
|
@@ -179,7 +172,7 @@ class BuildComponent():
|
|
|
179
172
|
# 生成部署deploy命令
|
|
180
173
|
lookup = TemplateLookup(directories=os.path.join(lb_cwd, "template"))
|
|
181
174
|
template = lookup.get_template("deploy.mako")
|
|
182
|
-
deploy = template.render(lookup=lookup, pkg=self.pkg, packages=
|
|
175
|
+
deploy = template.render(lookup=lookup, pkg=self.pkg, packages=[])
|
|
183
176
|
dir = os.path.join(cwd, ".temp", "deploy")
|
|
184
177
|
# 创建临时目录并写入conanfile.py文件
|
|
185
178
|
os.makedirs(dir, exist_ok=True)
|
|
@@ -191,6 +184,11 @@ class BuildComponent():
|
|
|
191
184
|
|
|
192
185
|
cmd = self.base_cmd.replace(self.package, "")
|
|
193
186
|
cmd = f"conan create . {cmd} --build=missing -tf=\"\""
|
|
187
|
+
if self.options.test:
|
|
188
|
+
cmd += " -o deploy/*:test=True"
|
|
189
|
+
for pkg_option in self.options.pkg_options:
|
|
190
|
+
if not pkg_option.startswith(self.name + "/"):
|
|
191
|
+
cmd += " -o " + pkg_option
|
|
194
192
|
tools.exec(cmd, verbose=True)
|
|
195
193
|
os.chdir(cwd)
|
|
196
194
|
|
|
@@ -203,9 +201,7 @@ class BuildComponent():
|
|
|
203
201
|
# 生成部署deploy命令
|
|
204
202
|
lookup = TemplateLookup(directories=os.path.join(lb_cwd, "template"))
|
|
205
203
|
template = lookup.get_template("deploy.mako")
|
|
206
|
-
|
|
207
|
-
packages.append(self.package)
|
|
208
|
-
deploy = template.render(lookup=lookup, pkg=self.pkg, packages=packages)
|
|
204
|
+
deploy = template.render(lookup=lookup, pkg=self.pkg, packages=[self.package])
|
|
209
205
|
dir = os.path.join(cwd, ".temp", "deploy")
|
|
210
206
|
# 创建临时目录并写入conanfile.py文件
|
|
211
207
|
os.makedirs(dir, exist_ok=True)
|
|
@@ -217,6 +213,10 @@ class BuildComponent():
|
|
|
217
213
|
|
|
218
214
|
cmd = self.base_cmd.replace(self.package, "")
|
|
219
215
|
cmd = f"conan graph info . {cmd} --build=missing -f json --filter=ref --filter=package_id --filter=context"
|
|
216
|
+
if self.options.test:
|
|
217
|
+
cmd += " -o deploy/*:test=True"
|
|
218
|
+
for pkg_option in self.options.pkg_options:
|
|
219
|
+
cmd += " -o " + pkg_option
|
|
220
220
|
res = tools.run(cmd).stdout.strip()
|
|
221
221
|
graph = json.loads(res)
|
|
222
222
|
nodes = graph.get("graph", {}).get("nodes", {})
|
|
@@ -34,9 +34,31 @@ class DeployConan(ConanFile):
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
def requirements(self):
|
|
37
|
-
|
|
37
|
+
% for package in packages:
|
|
38
38
|
self.requires("${package}")
|
|
39
|
+
% endfor
|
|
40
|
+
% if len(pkg.get("requires", {})) > 0:
|
|
41
|
+
% for conan in pkg["requires"].get("compile", []):
|
|
42
|
+
% if conan.get("when") is not None:
|
|
43
|
+
if ${conan.get("when")}:
|
|
44
|
+
self.requires("${conan.get("conan")}")
|
|
45
|
+
% else:
|
|
46
|
+
self.requires("${conan.get("conan")}")
|
|
47
|
+
% endif
|
|
39
48
|
% endfor
|
|
49
|
+
<%test_requires=pkg["requires"].get("test", [])%>\
|
|
50
|
+
% if len(test_requires):
|
|
51
|
+
if self.options.test == True:
|
|
52
|
+
% for conan in test_requires:
|
|
53
|
+
% if conan.get("when") is not None:
|
|
54
|
+
if ${conan.get("when")}:
|
|
55
|
+
self.requires("${conan.get("conan")}")
|
|
56
|
+
% else:
|
|
57
|
+
self.requires("${conan.get("conan")}")
|
|
58
|
+
% endif
|
|
59
|
+
% endfor
|
|
60
|
+
% endif
|
|
61
|
+
% endif
|
|
40
62
|
pass
|
|
41
63
|
|
|
42
64
|
def configure(self):
|
lbkit-0.5.16/lbkit/__init__.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|