lbkit 0.5.11__tar.gz → 0.5.13__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.11/lbkit.egg-info → lbkit-0.5.13}/PKG-INFO +1 -1
- lbkit-0.5.13/lbkit/__init__.py +2 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/codegen.py +1 -1
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/ctype_defination.py +27 -4
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/idf_interface.py +39 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/client.c.mako +2 -24
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/client.h.mako +33 -3
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/public.c.mako +12 -15
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/public.h.mako +58 -20
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/server.c.mako +0 -15
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/server.h.mako +25 -8
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/component/build.py +39 -7
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/component/template/conanbase.mako +2 -2
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/component/test.py +2 -0
- {lbkit-0.5.11 → lbkit-0.5.13/lbkit.egg-info}/PKG-INFO +1 -1
- lbkit-0.5.11/lbkit/__init__.py +0 -2
- {lbkit-0.5.11 → lbkit-0.5.13}/AUTHORS +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/LICENSE +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/MANIFEST.in +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/README.md +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/ci_robot/__init__.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/ci_robot/gitee.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/cli.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/__init__.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/renderer.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/interface.c.mako +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/codegen/template/interface.introspect.xml.mako +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/component/__init__.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/component/arg_parser.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/component/template/deploy.mako +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/errors.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/helper.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/__init__.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/build_image.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/build_manifest.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/build_prepare.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/build_rootfs.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/config.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/task.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/integration/template/conanfile.py.mako +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/lbkit.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/log.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/misc.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit/tools.py +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit.egg-info/SOURCES.txt +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit.egg-info/dependency_links.txt +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit.egg-info/entry_points.txt +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit.egg-info/requires.txt +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/lbkit.egg-info/top_level.txt +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/setup.cfg +0 -0
- {lbkit-0.5.11 → lbkit-0.5.13}/setup.py +0 -0
|
@@ -414,12 +414,26 @@ class RefObjArrayValidator(RefObjValidator):
|
|
|
414
414
|
|
|
415
415
|
class CTypeBase(object):
|
|
416
416
|
"""C语言相关的操作函数&类型定义"""
|
|
417
|
-
def __init__(self, declare, free_func, encode_func, decode_func,
|
|
417
|
+
def __init__(self, declare, free_func, encode_func, decode_func,
|
|
418
|
+
validator: IdfValidator = None,
|
|
419
|
+
const_declare = None,
|
|
420
|
+
const_free_func = None,
|
|
421
|
+
const_decode_func = None):
|
|
418
422
|
self.declare = declare
|
|
419
423
|
self.free_func = free_func
|
|
420
424
|
self.encode_func = encode_func
|
|
421
425
|
self.decode_func = decode_func
|
|
422
426
|
self.validator = validator
|
|
427
|
+
# Req消息顶层数据结构的释放和解码函数,注意顶层的(string/signature/object_path)数据可以是const的
|
|
428
|
+
self.const_declare = const_declare
|
|
429
|
+
self.const_free_func = const_free_func
|
|
430
|
+
self.const_decode_func = const_decode_func
|
|
431
|
+
if const_declare is None:
|
|
432
|
+
self.const_declare = self.declare
|
|
433
|
+
if const_free_func is None:
|
|
434
|
+
self.const_free_func = self.free_func
|
|
435
|
+
if const_decode_func is None:
|
|
436
|
+
self.const_decode_func = self.decode_func
|
|
423
437
|
|
|
424
438
|
|
|
425
439
|
"""定义支持的C语言类型"""
|
|
@@ -513,21 +527,30 @@ CTYPE_OBJS = {
|
|
|
513
527
|
["gcl_free_p((void **)&<arg_name>)"],
|
|
514
528
|
["<arg_out> = gcl_string_encode(<arg_name>)"],
|
|
515
529
|
["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
|
|
516
|
-
StringValidator("^.*$")
|
|
530
|
+
StringValidator("^.*$"),
|
|
531
|
+
["const gchar *<arg_name>"],
|
|
532
|
+
[],
|
|
533
|
+
["<arg_in> = g_variant_get_string(<arg_name>, NULL)"],
|
|
517
534
|
),
|
|
518
535
|
"object_path": CTypeBase(
|
|
519
536
|
["<const>gchar *<arg_name>"],
|
|
520
537
|
["gcl_free_p((void **)&<arg_name>)"],
|
|
521
538
|
["<arg_out> = gcl_object_path_encode(<arg_name>)"],
|
|
522
539
|
["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
|
|
523
|
-
StringValidator("^(/[A-Z0-9a-z_]+)*$")
|
|
540
|
+
StringValidator("^(/[A-Z0-9a-z_]+)*$"),
|
|
541
|
+
["const gchar *<arg_name>"],
|
|
542
|
+
[],
|
|
543
|
+
["<arg_in> = g_variant_get_string(<arg_name>, NULL)"],
|
|
524
544
|
),
|
|
525
545
|
"signature": CTypeBase(
|
|
526
546
|
["<const>gchar *<arg_name>"],
|
|
527
547
|
["gcl_free_p((void **)&<arg_name>)"],
|
|
528
548
|
["<arg_out> = gcl_signature_encode(<arg_name>)"],
|
|
529
549
|
["<arg_in> = g_strdup(g_variant_get_string(<arg_name>, NULL))"],
|
|
530
|
-
StringValidator("^([abynqiuxtdsogv\\\\{\\\\}\\\\(\\\\)])+$")
|
|
550
|
+
StringValidator("^([abynqiuxtdsogv\\\\{\\\\}\\\\(\\\\)])+$"),
|
|
551
|
+
["const gchar *<arg_name>"],
|
|
552
|
+
[],
|
|
553
|
+
["<arg_in> = g_variant_get_string(<arg_name>, NULL)"],
|
|
531
554
|
),
|
|
532
555
|
"variant": CTypeBase(
|
|
533
556
|
["GVariant *<arg_name>"],
|
|
@@ -380,6 +380,45 @@ class IdfCtypeRender():
|
|
|
380
380
|
else:
|
|
381
381
|
return [f"<arg_in> = {stru_name}_decode(<arg_name>)"]
|
|
382
382
|
|
|
383
|
+
def const_declare(self):
|
|
384
|
+
"""常量申明,用于方法请求和信号消息结构体顶层成员申明"""
|
|
385
|
+
log.debug(f"Get const_declare info, name: {self.name}, ctype: {self.ctype}")
|
|
386
|
+
match = re.match(f"^({CTYPE_REGEX})$", self.ctype)
|
|
387
|
+
if match:
|
|
388
|
+
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
389
|
+
return ctype_obj.const_declare
|
|
390
|
+
match = re.match(f"^({CTYPE_REGEX})$", self.ctype)
|
|
391
|
+
if match:
|
|
392
|
+
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
393
|
+
return ctype_obj.const_declare
|
|
394
|
+
return self.declare()
|
|
395
|
+
|
|
396
|
+
def const_decode_func(self):
|
|
397
|
+
"""常量反序列化申明,用于方法请求和信号消息结构体顶层成员反序列化"""
|
|
398
|
+
log.debug(f"Get const_declare_func info, name: {self.name}, ctype: {self.ctype}")
|
|
399
|
+
match = re.match(f"^({CTYPE_REGEX})$", self.ctype)
|
|
400
|
+
if match:
|
|
401
|
+
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
402
|
+
return ctype_obj.const_decode_func
|
|
403
|
+
match = re.match(f"^({CTYPE_REGEX})$", self.ctype)
|
|
404
|
+
if match:
|
|
405
|
+
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
406
|
+
return ctype_obj.const_decode_func
|
|
407
|
+
return self.decode_func()
|
|
408
|
+
|
|
409
|
+
def const_free_func(self):
|
|
410
|
+
"""常量释放申明,用于方法请求和信号消息结构体顶层成员反序列化"""
|
|
411
|
+
log.debug(f"Get const_free_func info, name: {self.name}, ctype: {self.ctype}")
|
|
412
|
+
match = re.match(f"^({CTYPE_REGEX})$", self.ctype)
|
|
413
|
+
if match:
|
|
414
|
+
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
415
|
+
return ctype_obj.const_free_func
|
|
416
|
+
match = re.match(f"^({CTYPE_REGEX})$", self.ctype)
|
|
417
|
+
if match:
|
|
418
|
+
ctype_obj = CTYPE_OBJS.get(self.ctype)
|
|
419
|
+
return ctype_obj.const_free_func
|
|
420
|
+
return self.free_func()
|
|
421
|
+
|
|
383
422
|
def odf_load_func(self):
|
|
384
423
|
log.debug(f"Get odf_load function, name: {self.name}, ctype: {self.ctype}")
|
|
385
424
|
# odf不支持gariant
|
|
@@ -11,7 +11,6 @@ static ${intf.alias}_Properties ${properties};
|
|
|
11
11
|
static const ${intf.alias}_Signals *${signal_processer} = NULL;
|
|
12
12
|
|
|
13
13
|
% for prop in intf.properties:
|
|
14
|
-
/* ${prop.description} */
|
|
15
14
|
% if prop.deprecated:
|
|
16
15
|
__attribute__((__deprecated__)) gint ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
17
16
|
${", ".join(prop.declare()).replace("<arg_name>", prop.name).replace("<const>", "const ")}, GError **error)
|
|
@@ -53,17 +52,6 @@ gint ${class_name}_get_${prop.name}(const ${class_name} *object, GVariant **valu
|
|
|
53
52
|
% if len(method.parameters.parameters) > 0:
|
|
54
53
|
<% REQ_PARA = f'const {intf.alias}_{method.name}_Req *req, ' %>\
|
|
55
54
|
% endif
|
|
56
|
-
/*
|
|
57
|
-
* ${method.description}
|
|
58
|
-
*
|
|
59
|
-
* method name: ${method.name}
|
|
60
|
-
% for arg in method.parameters.parameters:
|
|
61
|
-
* @in_${arg.name}: ${arg.description}, signature: ${arg.signature}
|
|
62
|
-
% endfor
|
|
63
|
-
% for arg in method.returns.parameters:
|
|
64
|
-
* @out_${arg.name}: ${arg.description}, signature: ${arg.signature}
|
|
65
|
-
% endfor
|
|
66
|
-
*/
|
|
67
55
|
int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
68
56
|
${REQ_PARA}${RSP_PARA}gint timeout,
|
|
69
57
|
GError **error)
|
|
@@ -85,15 +73,10 @@ int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
|
85
73
|
return gcl_impl.call_method((GclObject *)object, (const GclMethod *)&${method_processer}->${method.name},
|
|
86
74
|
(void *)req, (void **)rsp, timeout, error);
|
|
87
75
|
}
|
|
88
|
-
% endfor
|
|
89
76
|
|
|
90
|
-
static GclObject *_${class_name}_create(const gchar *obj_name, gpointer opaque);
|
|
91
|
-
/*
|
|
92
|
-
* interface: ${intf.name}
|
|
93
|
-
% for c in intf.description.split("\n"):
|
|
94
|
-
* ${c}
|
|
95
77
|
% endfor
|
|
96
|
-
|
|
78
|
+
static GclObject *_${class_name}_create(const gchar *obj_name, gpointer opaque);
|
|
79
|
+
|
|
97
80
|
static GclInterface _${class_name}_interface = {
|
|
98
81
|
.create = _${class_name}_create,
|
|
99
82
|
.is_remote = 1,
|
|
@@ -121,10 +104,6 @@ GclObject *_${class_name}_create(const gchar *obj_name, gpointer opaque)
|
|
|
121
104
|
}
|
|
122
105
|
|
|
123
106
|
% for signal in intf.signals:
|
|
124
|
-
/*
|
|
125
|
-
* Send dbus signal: ${signal.name}
|
|
126
|
-
* ${signal.description}
|
|
127
|
-
*/
|
|
128
107
|
% if signal.deprecated:
|
|
129
108
|
__attribute__((__deprecated__)) guint ${class_name}_Subscribe_${signal.name}(${class_name}_${signal.name}_Signal handler,
|
|
130
109
|
const gchar *bus_name, const gchar *object_path, const gchar *arg0, gpointer user_data)
|
|
@@ -148,7 +127,6 @@ void ${class_name}_Unsubscribe_${signal.name}(guint *id)
|
|
|
148
127
|
}
|
|
149
128
|
|
|
150
129
|
% endfor
|
|
151
|
-
|
|
152
130
|
GclInterface *${class_name}_interface(void)
|
|
153
131
|
{
|
|
154
132
|
return &_${class_name}_interface;
|
|
@@ -14,7 +14,17 @@ typedef ${intf.alias} ${class_name};
|
|
|
14
14
|
typedef ${intf.alias}_Properties ${class_name}_Properties;
|
|
15
15
|
|
|
16
16
|
% for prop in intf.properties:
|
|
17
|
-
/*
|
|
17
|
+
/*
|
|
18
|
+
* property: ${prop.name}
|
|
19
|
+
% if len(prop.description.strip()) > 0:
|
|
20
|
+
*
|
|
21
|
+
% for line in prop.description.split("\n"):
|
|
22
|
+
% if len(line.strip()) > 0:
|
|
23
|
+
* ${line.strip()}
|
|
24
|
+
% endif
|
|
25
|
+
% endfor
|
|
26
|
+
% endif
|
|
27
|
+
*/
|
|
18
28
|
% if prop.deprecated:
|
|
19
29
|
__attribute__((__deprecated__)) gint ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
20
30
|
${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")},
|
|
@@ -37,7 +47,17 @@ gint ${class_name}_get_${prop.name}(const ${class_name} *object, GVariant **valu
|
|
|
37
47
|
% if len(method.parameters.parameters) > 0:
|
|
38
48
|
<% REQ_PARA = f'const {intf.alias}_{method.name}_Req *req, ' %>\
|
|
39
49
|
% endif
|
|
40
|
-
/*
|
|
50
|
+
/*
|
|
51
|
+
* method: ${method.name}
|
|
52
|
+
% if len(method.description.strip()) > 0:
|
|
53
|
+
*
|
|
54
|
+
% for line in method.description.split("\n"):
|
|
55
|
+
% if len(line.strip()) > 0:
|
|
56
|
+
* ${line.strip()}
|
|
57
|
+
% endif
|
|
58
|
+
% endfor
|
|
59
|
+
% endif
|
|
60
|
+
*/
|
|
41
61
|
% if method.deprecated:
|
|
42
62
|
__attribute__((__deprecated__)) int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
43
63
|
${REQ_PARA}${RSP_PARA}gint timeout,
|
|
@@ -50,7 +70,17 @@ int ${class_name}_Call_${method.name}(const ${class_name} *object,
|
|
|
50
70
|
% endfor
|
|
51
71
|
|
|
52
72
|
% for signal in intf.signals:
|
|
53
|
-
/*
|
|
73
|
+
/*
|
|
74
|
+
* signal: ${signal.name}
|
|
75
|
+
% if len(signal.description.strip()) > 0:
|
|
76
|
+
*
|
|
77
|
+
% for line in signal.description.split("\n"):
|
|
78
|
+
% if len(line.strip()) > 0:
|
|
79
|
+
* ${line.strip()}
|
|
80
|
+
% endif
|
|
81
|
+
% endfor
|
|
82
|
+
% endif
|
|
83
|
+
*/
|
|
54
84
|
typedef void (*${class_name}_${signal.name}_Signal)(const ${class_name} *object, const gchar *destination,
|
|
55
85
|
const ${intf.alias}_${signal.name}_Msg *req, gpointer user_data);
|
|
56
86
|
/**/
|
|
@@ -771,11 +771,8 @@ static GDBusAnnotationInfo *${class_name}_prop_${prop.name}_annotations[] =
|
|
|
771
771
|
% endfor
|
|
772
772
|
NULL,
|
|
773
773
|
};
|
|
774
|
-
% endif
|
|
775
774
|
|
|
776
|
-
%
|
|
777
|
-
/* ${c} */
|
|
778
|
-
% endfor
|
|
775
|
+
% endif
|
|
779
776
|
static GDBusPropertyInfo ${class_name}_property_${prop.name} =
|
|
780
777
|
{
|
|
781
778
|
.ref_count = -1,
|
|
@@ -786,9 +783,9 @@ static GDBusPropertyInfo ${class_name}_property_${prop.name} =
|
|
|
786
783
|
.annotations = ${class_name}_prop_${prop.name}_annotations,
|
|
787
784
|
% endif
|
|
788
785
|
};
|
|
786
|
+
|
|
789
787
|
% endif
|
|
790
788
|
% endfor
|
|
791
|
-
|
|
792
789
|
static ${class_name}_Properties _${class_name}_properties =
|
|
793
790
|
{
|
|
794
791
|
<% id = 0 %>\
|
|
@@ -821,7 +818,7 @@ const ${class_name}_Properties *${class_name}_properties_const(void)
|
|
|
821
818
|
% if not method.is_plugin:
|
|
822
819
|
## 方法${method.name}的请求体序列化函数
|
|
823
820
|
/* ${class_name}_${method.name}_Req请求结构体类型序列化(struct转GVariant)函数 */
|
|
824
|
-
|
|
821
|
+
GVariant *${class_name}_${method.name}_Req_encode(${class_name}_${method.name}_Req *value)
|
|
825
822
|
{
|
|
826
823
|
static ${class_name}_${method.name}_Req default_val;
|
|
827
824
|
if (!value) {
|
|
@@ -842,7 +839,7 @@ static GVariant *${class_name}_${method.name}_Req_encode(${class_name}_${method.
|
|
|
842
839
|
|
|
843
840
|
## 方法${method.name}的请求体反序列化函数
|
|
844
841
|
/* ${class_name}_${method.name}_Req结构体类型反序列化(GVariant转struct)函数,返回以NULL结束的指针数组 */
|
|
845
|
-
|
|
842
|
+
${class_name}_${method.name}_Req *${class_name}_${method.name}_Req_decode(GVariant *in)
|
|
846
843
|
{
|
|
847
844
|
GVariantIter iter;
|
|
848
845
|
GVariant *tmp = NULL;
|
|
@@ -855,7 +852,7 @@ static ${class_name}_${method.name}_Req *${class_name}_${method.name}_Req_decode
|
|
|
855
852
|
% for prop in method.parameters.parameters:
|
|
856
853
|
/* process ${prop.name} */
|
|
857
854
|
tmp = g_variant_iter_next_value(&iter);
|
|
858
|
-
% for line in prop.
|
|
855
|
+
% for line in prop.const_decode_func():
|
|
859
856
|
${line.replace("<arg_name>", "tmp").replace("n_<arg_in>", "output->n_" + prop.name).replace("<arg_in>", "output->" + prop.name)};
|
|
860
857
|
% endfor
|
|
861
858
|
g_variant_unref(tmp);
|
|
@@ -872,7 +869,7 @@ void ${class_name}_${method.name}_Req_free(${class_name}_${method.name}_Req **va
|
|
|
872
869
|
return;
|
|
873
870
|
}
|
|
874
871
|
% for prop in method.parameters.parameters:
|
|
875
|
-
% for line in prop.
|
|
872
|
+
% for line in prop.const_free_func():
|
|
876
873
|
${line.replace("<arg_name>", "(*value)->" + prop.name)};
|
|
877
874
|
% endfor
|
|
878
875
|
% endfor
|
|
@@ -882,7 +879,7 @@ void ${class_name}_${method.name}_Req_free(${class_name}_${method.name}_Req **va
|
|
|
882
879
|
|
|
883
880
|
% if not method.is_plugin:
|
|
884
881
|
/* ${class_name}_${method.name}_Rsp请求结构体类型序列化(struct转GVariant)函数 */
|
|
885
|
-
|
|
882
|
+
GVariant *${class_name}_${method.name}_Rsp_encode(${class_name}_${method.name}_Rsp *value)
|
|
886
883
|
{
|
|
887
884
|
static ${class_name}_${method.name}_Rsp default_val;
|
|
888
885
|
if (!value) {
|
|
@@ -903,7 +900,7 @@ static GVariant *${class_name}_${method.name}_Rsp_encode(${class_name}_${method.
|
|
|
903
900
|
|
|
904
901
|
## 方法${method.name}的响应体反序列化函数
|
|
905
902
|
/* ${class_name}_${method.name}_Rsp结构体类型反序列化(GVariant转struct)函数,返回以NULL结束的指针数组 */
|
|
906
|
-
|
|
903
|
+
${class_name}_${method.name}_Rsp *${class_name}_${method.name}_Rsp_decode(GVariant *in)
|
|
907
904
|
{
|
|
908
905
|
GVariantIter iter;
|
|
909
906
|
GVariant *tmp = NULL;
|
|
@@ -1074,7 +1071,7 @@ int ${class_name}_${action.name}_run(const ${class_name} *object${REQ_PARA}${RSP
|
|
|
1074
1071
|
% for signal in intf.signals:
|
|
1075
1072
|
## 方法${method.name}的响应体序列化函数
|
|
1076
1073
|
/* ${class_name}_${signal.name}_Msg请求结构体类型序列化(struct转GVariant)函数 */
|
|
1077
|
-
|
|
1074
|
+
GVariant *${class_name}_${signal.name}_Msg_encode(${class_name}_${signal.name}_Msg *value)
|
|
1078
1075
|
{
|
|
1079
1076
|
static ${class_name}_${signal.name}_Msg default_val;
|
|
1080
1077
|
if (!value) {
|
|
@@ -1095,7 +1092,7 @@ static GVariant *${class_name}_${signal.name}_Msg_encode(${class_name}_${signal.
|
|
|
1095
1092
|
|
|
1096
1093
|
## 方法${signal.name}的响应体反序列化函数
|
|
1097
1094
|
/* ${class_name}_${signal.name}_Msg结构体类型反序列化(GVariant转struct)函数,返回以NULL结束的指针数组 */
|
|
1098
|
-
|
|
1095
|
+
${class_name}_${signal.name}_Msg *${class_name}_${signal.name}_Msg_decode(GVariant *in)
|
|
1099
1096
|
{
|
|
1100
1097
|
GVariantIter iter;
|
|
1101
1098
|
GVariant *tmp = NULL;
|
|
@@ -1108,7 +1105,7 @@ static ${class_name}_${signal.name}_Msg *${class_name}_${signal.name}_Msg_decode
|
|
|
1108
1105
|
% for prop in signal.properties.parameters:
|
|
1109
1106
|
/* process ${prop.name} */
|
|
1110
1107
|
tmp = g_variant_iter_next_value(&iter);
|
|
1111
|
-
% for line in prop.
|
|
1108
|
+
% for line in prop.const_decode_func():
|
|
1112
1109
|
${line.replace("<arg_name>", "tmp").replace("n_<arg_in>", "output->n_" + prop.name).replace("<arg_in>", "output->" + prop.name)};
|
|
1113
1110
|
% endfor
|
|
1114
1111
|
g_variant_unref(tmp);
|
|
@@ -1125,7 +1122,7 @@ void ${class_name}_${signal.name}_Msg_free(${class_name}_${signal.name}_Msg **va
|
|
|
1125
1122
|
}
|
|
1126
1123
|
|
|
1127
1124
|
% for prop in signal.properties.parameters:
|
|
1128
|
-
% for line in prop.
|
|
1125
|
+
% for line in prop.const_free_func():
|
|
1129
1126
|
${line.replace("<arg_name>", "(*value)->" + prop.name)};
|
|
1130
1127
|
% endfor
|
|
1131
1128
|
% endfor
|
|
@@ -10,26 +10,65 @@ extern "C" {
|
|
|
10
10
|
#endif
|
|
11
11
|
|
|
12
12
|
/* Interface ${intf.alias} codegen start */
|
|
13
|
+
|
|
13
14
|
<% class_name = intf.alias %>\
|
|
14
15
|
% for name, stru in intf.structures.items():
|
|
15
|
-
/*
|
|
16
|
+
/*
|
|
17
|
+
* structure: ${name}
|
|
18
|
+
% if len(stru.description.strip()) > 0:
|
|
19
|
+
*
|
|
20
|
+
% for line in stru.description.split("\n"):
|
|
21
|
+
% if len(line.strip()) > 0:
|
|
22
|
+
* ${line.strip()}
|
|
23
|
+
% endif
|
|
24
|
+
% endfor
|
|
25
|
+
% endif
|
|
26
|
+
*/
|
|
16
27
|
typedef struct _${name} ${name};
|
|
17
28
|
% endfor
|
|
18
|
-
|
|
19
29
|
% for name, enum in intf.enumerations.items():
|
|
20
|
-
/*
|
|
21
|
-
|
|
30
|
+
/*
|
|
31
|
+
* enumeration: ${name}
|
|
32
|
+
% if len(enum.description.strip()) > 0:
|
|
33
|
+
*
|
|
34
|
+
% for line in enum.description.split("\n"):
|
|
35
|
+
% if len(line.strip()) > 0:
|
|
36
|
+
* ${line.strip()}
|
|
37
|
+
% endif
|
|
22
38
|
% endfor
|
|
23
|
-
|
|
39
|
+
% endif
|
|
40
|
+
*/
|
|
41
|
+
typedef enum _${name} ${name};
|
|
42
|
+
% endfor
|
|
24
43
|
% for name, dictionary in intf.dictionaries.items():
|
|
25
|
-
/*
|
|
44
|
+
/*
|
|
45
|
+
* dictionary: ${name}
|
|
46
|
+
% if len(dictionary.description.strip()) > 0:
|
|
47
|
+
*
|
|
48
|
+
% for line in dictionary.description.split("\n"):
|
|
49
|
+
% if len(line.strip()) > 0:
|
|
50
|
+
* ${line.strip()}
|
|
51
|
+
% endif
|
|
52
|
+
% endfor
|
|
53
|
+
% endif
|
|
54
|
+
*/
|
|
26
55
|
typedef struct _${name}${dictionary.key} ${name}${dictionary.key};
|
|
27
56
|
typedef struct _${name} ${name};
|
|
28
57
|
% endfor
|
|
29
58
|
|
|
30
59
|
% for name, stru in intf.structures.items():
|
|
31
60
|
% if name != class_name:
|
|
32
|
-
/*
|
|
61
|
+
/*
|
|
62
|
+
* structure: ${name}
|
|
63
|
+
% if len(stru.description.strip()) > 0:
|
|
64
|
+
*
|
|
65
|
+
% for line in stru.description.split("\n"):
|
|
66
|
+
% if len(line.strip()) > 0:
|
|
67
|
+
* ${line.strip()}
|
|
68
|
+
% endif
|
|
69
|
+
% endfor
|
|
70
|
+
% endif
|
|
71
|
+
*/
|
|
33
72
|
struct _${name} {
|
|
34
73
|
% for prop in stru.values.parameters:
|
|
35
74
|
% for dec in prop.declare():
|
|
@@ -42,7 +81,6 @@ struct _${name} {
|
|
|
42
81
|
%endfor
|
|
43
82
|
% for name, enum in intf.enumerations.items():
|
|
44
83
|
## 枚举定义
|
|
45
|
-
/* ${enum.description} */
|
|
46
84
|
enum _${name} {
|
|
47
85
|
% for value in enum.values.parameters:
|
|
48
86
|
${name}_${value.name},
|
|
@@ -54,8 +92,6 @@ const gchar *${name}_as_string(${name} value);
|
|
|
54
92
|
|
|
55
93
|
% endfor
|
|
56
94
|
% for name, dictionary in intf.dictionaries.items():
|
|
57
|
-
|
|
58
|
-
/* ${dictionary.description} */
|
|
59
95
|
struct _${name}${dictionary.key} {
|
|
60
96
|
% for value in dictionary.values.parameters:
|
|
61
97
|
% for line in value.declare():
|
|
@@ -81,7 +117,6 @@ struct _${name} {
|
|
|
81
117
|
${name} *${name}_new(void);
|
|
82
118
|
|
|
83
119
|
% endfor
|
|
84
|
-
|
|
85
120
|
## 定义结构体编解码和释放函数
|
|
86
121
|
% for name, stru in intf.structures.items():
|
|
87
122
|
/* ${name} structure object */
|
|
@@ -97,13 +132,11 @@ ${name} **${name}_decode_v(GVariant *in);
|
|
|
97
132
|
GVariant *${name}_encode_v(${name} * const *value);
|
|
98
133
|
// Clean up the memory of structure array and it's all members, `*value` will to NULL
|
|
99
134
|
void ${name}_free_v(${name} ***value);
|
|
100
|
-
|
|
101
135
|
/* END: 结构体${name}及其数组类型的序列化、反序列化、释放函数 */
|
|
102
136
|
|
|
103
137
|
% endfor
|
|
104
138
|
## 定义枚举编解码函数
|
|
105
139
|
% for name, enum in intf.enumerations.items():
|
|
106
|
-
/* ${enum.description} */
|
|
107
140
|
/* START: 枚举${name}及其数组类型的序列化、反序列化、释放函数 */
|
|
108
141
|
GVariant *${name}_encode(${name} value);
|
|
109
142
|
${name} ${name}_decode(GVariant *in);
|
|
@@ -115,7 +148,6 @@ ${name} *${name}_decode_v(GVariant *in, gsize *n);
|
|
|
115
148
|
% endfor
|
|
116
149
|
## 定义字典编解码和释放函数
|
|
117
150
|
% for name, dictionary in intf.dictionaries.items():
|
|
118
|
-
/* ${dictionary.description} */
|
|
119
151
|
/* START: 字典${name}及其数组类型的序列化、反序列化、释放函数 */
|
|
120
152
|
GVariant *${name}_encode(const ${name} *value);
|
|
121
153
|
${name} *${name}_decode(GVariant *in);
|
|
@@ -127,13 +159,12 @@ void ${name}_free_v(${name} ***value);
|
|
|
127
159
|
/* END: 字典${name}及其数组类型的序列化、反序列化、释放函数 */
|
|
128
160
|
|
|
129
161
|
% endfor
|
|
130
|
-
|
|
131
162
|
### 开始生成方法的请求体、响应体和处理函数
|
|
132
163
|
% for method in intf.fake_methods:
|
|
133
164
|
/* ${method.name}方法的请求体 */
|
|
134
165
|
typedef struct {
|
|
135
166
|
% for arg in method.parameters.parameters:
|
|
136
|
-
% for dec in arg.
|
|
167
|
+
% for dec in arg.const_declare():
|
|
137
168
|
${dec.replace("<arg_name>", arg.name).replace("<const>", "")};
|
|
138
169
|
% endfor
|
|
139
170
|
% endfor
|
|
@@ -149,9 +180,16 @@ typedef struct {
|
|
|
149
180
|
} ${class_name}_${method.name}_Rsp;
|
|
150
181
|
|
|
151
182
|
% if not method.is_plugin:
|
|
152
|
-
typedef int (*${class_name}_${method.name}_Method)(const ${class_name} *object,
|
|
183
|
+
typedef int (*${class_name}_${method.name}_Method)(const ${class_name} *object,
|
|
184
|
+
const ${class_name}_${method.name}_Req *req,
|
|
185
|
+
${class_name}_${method.name}_Rsp **rsp,
|
|
186
|
+
GError **error, gpointer ext_data);
|
|
153
187
|
% endif
|
|
188
|
+
GVariant *${class_name}_${method.name}_Req_encode(${class_name}_${method.name}_Req *value);
|
|
189
|
+
${class_name}_${method.name}_Req *${class_name}_${method.name}_Req_decode(GVariant *in);
|
|
154
190
|
void ${class_name}_${method.name}_Req_free(${class_name}_${method.name}_Req **value);
|
|
191
|
+
GVariant *${class_name}_${method.name}_Rsp_encode(${class_name}_${method.name}_Rsp *value);
|
|
192
|
+
${class_name}_${method.name}_Rsp *${class_name}_${method.name}_Rsp_decode(GVariant *in);
|
|
155
193
|
void ${class_name}_${method.name}_Rsp_free(${class_name}_${method.name}_Rsp **value);
|
|
156
194
|
%endfor
|
|
157
195
|
|
|
@@ -199,11 +237,13 @@ int ${class_name}_${action.name}_run(const ${class_name} *object${REQ_PARA}${RSP
|
|
|
199
237
|
/* ${signal.name}信号的消息体 */
|
|
200
238
|
typedef struct {
|
|
201
239
|
% for arg in signal.properties.parameters:
|
|
202
|
-
% for dec in arg.
|
|
240
|
+
% for dec in arg.const_declare():
|
|
203
241
|
${dec.replace("<arg_name>", arg.name).replace("<const>", "")};
|
|
204
242
|
% endfor
|
|
205
243
|
% endfor
|
|
206
244
|
} ${class_name}_${signal.name}_Msg;
|
|
245
|
+
${class_name}_${signal.name}_Msg *${class_name}_${signal.name}_Msg_decode(GVariant *in);
|
|
246
|
+
GVariant *${class_name}_${signal.name}_Msg_encode(${class_name}_${signal.name}_Msg *value);
|
|
207
247
|
void ${class_name}_${signal.name}_Msg_free(${class_name}_${signal.name}_Msg **value);
|
|
208
248
|
|
|
209
249
|
%endfor
|
|
@@ -222,7 +262,6 @@ typedef struct {
|
|
|
222
262
|
|
|
223
263
|
% for name, stru in intf.structures.items():
|
|
224
264
|
% if name == class_name:
|
|
225
|
-
/* ${stru.description} */
|
|
226
265
|
struct _${name} {
|
|
227
266
|
GclBase _base; /* Notice: property name can't be _base */
|
|
228
267
|
char __reserved__[8]; /* 8bytes reserved space, can't be modified */
|
|
@@ -242,7 +281,6 @@ typedef struct {
|
|
|
242
281
|
GclProperty __reserved__;
|
|
243
282
|
} ${class_name}_Properties;
|
|
244
283
|
|
|
245
|
-
|
|
246
284
|
gboolean ${intf.name.replace(".", "_")}_validate_odf(yaml_document_t *doc, yaml_node_t *node,
|
|
247
285
|
const gchar *object_name, GSList **error_list);
|
|
248
286
|
// 不要使用此函数返回的对象,需要使用${class_name}_properties() 或${class_name}_Cli_properties()
|
|
@@ -33,7 +33,6 @@ ${name} **_load_odf_as_${name}_v(yaml_document_t *doc, yaml_node_t *node);
|
|
|
33
33
|
% for name, stru in intf.structures.items():
|
|
34
34
|
/* ${name} structure object */
|
|
35
35
|
/* START: 结构体${name}及其数组类型的ODF加载函数 */
|
|
36
|
-
|
|
37
36
|
${name} *_load_odf_as_${name}(yaml_document_t *doc, yaml_node_t *node)
|
|
38
37
|
{
|
|
39
38
|
<% cnt = 0 %>\
|
|
@@ -85,7 +84,6 @@ ${name} **_load_odf_as_${name}_v(yaml_document_t *doc, yaml_node_t *node)
|
|
|
85
84
|
% endfor
|
|
86
85
|
## 定义枚举ODF加载函数
|
|
87
86
|
% for name, enum in intf.enumerations.items():
|
|
88
|
-
|
|
89
87
|
${name} _load_odf_as_${name}(yaml_document_t *doc, yaml_node_t *node)
|
|
90
88
|
{
|
|
91
89
|
g_assert(node->type == YAML_SCALAR_NODE);
|
|
@@ -125,7 +123,6 @@ ${name} *_load_odf_as_${name}_v(yaml_document_t *doc, yaml_node_t *node, gsize *
|
|
|
125
123
|
% endfor
|
|
126
124
|
## 定义字典ODF加载函数
|
|
127
125
|
% for name, dictionary in intf.dictionaries.items():
|
|
128
|
-
|
|
129
126
|
${name} *_load_odf_as_${name}(yaml_document_t *doc, yaml_node_t *node)
|
|
130
127
|
{
|
|
131
128
|
GHashTable *prop_table = NULL;
|
|
@@ -190,7 +187,6 @@ static ${class_name}_Properties ${properties};
|
|
|
190
187
|
static const ${class_name}_Signals *${signal_processer} = NULL;
|
|
191
188
|
|
|
192
189
|
% for prop in intf.properties:
|
|
193
|
-
/* ${prop.description} */
|
|
194
190
|
% if prop.deprecated:
|
|
195
191
|
__attribute__((__deprecated__)) void ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
196
192
|
${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")})
|
|
@@ -209,10 +205,6 @@ void ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
|
209
205
|
|
|
210
206
|
% endfor
|
|
211
207
|
% for signal in intf.signals:
|
|
212
|
-
/*
|
|
213
|
-
* Signal: ${signal.name}
|
|
214
|
-
* ${signal.description}
|
|
215
|
-
*/
|
|
216
208
|
<% REQ_PARA = f'' %>\
|
|
217
209
|
% if len(signal.properties.parameters) > 0:
|
|
218
210
|
<% REQ_PARA = f'const {class_name}_{signal.name}_Msg *msg, ' %>\
|
|
@@ -246,12 +238,6 @@ static void _load_from_odf(yaml_document_t *doc, yaml_node_t *node, GclObject *g
|
|
|
246
238
|
property_reference_loaded ref_loaded, gpointer user_data);
|
|
247
239
|
static void _valid_from_odf(yaml_document_t *doc, yaml_node_t *node, const gchar *object_name);
|
|
248
240
|
|
|
249
|
-
/*
|
|
250
|
-
* interface: ${intf.name}
|
|
251
|
-
% for c in intf.description.split("\n"):
|
|
252
|
-
* ${c}
|
|
253
|
-
% endfor
|
|
254
|
-
*/
|
|
255
241
|
static GclInterface _${class_name}_interface = {
|
|
256
242
|
.create = _${intf.alias}_create,
|
|
257
243
|
.validate_odf = ${intf.name.replace(".", "_")}_validate_odf,
|
|
@@ -355,7 +341,6 @@ ${class_name}_Properties *${class_name}_properties(void)
|
|
|
355
341
|
|
|
356
342
|
static void __attribute__((constructor(150))) ${class_name}_register(void)
|
|
357
343
|
{
|
|
358
|
-
|
|
359
344
|
// 从公共库中复制信号处理函数
|
|
360
345
|
${signal_processer} = ${class_name}_signals();
|
|
361
346
|
// 从公共库中复制方法处理函数
|
|
@@ -4,30 +4,47 @@
|
|
|
4
4
|
#include <glib-2.0/glib.h>
|
|
5
5
|
#include <glib-2.0/gio/gio.h>
|
|
6
6
|
#include "gcl_base.h"
|
|
7
|
+
#include "public/${intf.name}.h"
|
|
7
8
|
|
|
8
9
|
#ifdef __cplusplus
|
|
9
10
|
extern "C" {
|
|
10
11
|
#endif
|
|
11
|
-
#include "public/${intf.name}.h"
|
|
12
12
|
<% class_name = intf.alias %>\
|
|
13
13
|
|
|
14
14
|
% for prop in intf.properties:
|
|
15
|
-
/*
|
|
15
|
+
/*
|
|
16
|
+
* property: ${prop.name}
|
|
17
|
+
% if len(prop.description.strip()) > 0:
|
|
18
|
+
*
|
|
19
|
+
% for line in prop.description.split("\n"):
|
|
20
|
+
% if len(line.strip()) > 0:
|
|
21
|
+
* ${line.strip()}
|
|
22
|
+
% endif
|
|
23
|
+
% endfor
|
|
24
|
+
% endif
|
|
25
|
+
*/
|
|
16
26
|
% if prop.deprecated:
|
|
17
|
-
__attribute__((__deprecated__)) void ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
18
|
-
${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
27
|
+
__attribute__((__deprecated__)) void ${class_name}_set_${prop.name}(const ${class_name} *object, ${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
19
28
|
% else:
|
|
20
|
-
void ${class_name}_set_${prop.name}(const ${class_name} *object,
|
|
21
|
-
${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
29
|
+
void ${class_name}_set_${prop.name}(const ${class_name} *object, ${", ".join(prop.declare()).replace("<arg_name>", "value").replace("<const>", "const ")});
|
|
22
30
|
% endif
|
|
23
31
|
% endfor
|
|
24
32
|
|
|
25
33
|
% for signal in intf.signals:
|
|
26
34
|
/*
|
|
27
|
-
* ${signal.
|
|
35
|
+
* signal: ${signal.name}
|
|
36
|
+
% if len(signal.description.strip()) > 0:
|
|
37
|
+
*
|
|
38
|
+
% for line in signal.description.split("\n"):
|
|
39
|
+
% if len(line.strip()) > 0:
|
|
40
|
+
* ${line.strip()}
|
|
41
|
+
% endif
|
|
42
|
+
% endfor
|
|
43
|
+
% endif
|
|
28
44
|
*/
|
|
29
45
|
% if len(signal.properties.parameters) > 0:
|
|
30
|
-
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination,
|
|
46
|
+
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination,
|
|
47
|
+
const ${class_name}_${signal.name}_Msg *msg, GError **error);
|
|
31
48
|
% else:
|
|
32
49
|
gboolean ${class_name}_${signal.name}_Signal(const ${class_name} *object, const gchar *destination, GError **error);
|
|
33
50
|
% endif
|
|
@@ -4,6 +4,7 @@ import yaml
|
|
|
4
4
|
import shutil
|
|
5
5
|
import re
|
|
6
6
|
import json
|
|
7
|
+
from multiprocessing import Pool
|
|
7
8
|
import traceback
|
|
8
9
|
from argparse import ArgumentParser
|
|
9
10
|
from jsonschema import validate, ValidationError
|
|
@@ -34,11 +35,22 @@ class DeployComponent():
|
|
|
34
35
|
package_folder = tools.run(cmd).stdout.strip()
|
|
35
36
|
log.info(f">>>> deploy {self.package_ref}")
|
|
36
37
|
cmd = f"cp -rT {package_folder}/ {self.rootfs_dir}"
|
|
37
|
-
|
|
38
|
+
cnt = 10
|
|
39
|
+
while cnt > 0:
|
|
40
|
+
try:
|
|
41
|
+
cnt -= 1
|
|
42
|
+
tools.exec(cmd)
|
|
43
|
+
return
|
|
44
|
+
except Exception as e:
|
|
45
|
+
if cnt == 0:
|
|
46
|
+
log.warn("Copy failed, msg: " + str(e))
|
|
47
|
+
raise e
|
|
48
|
+
log.info("Copy {self.package_ref} failed, try again")
|
|
38
49
|
|
|
39
50
|
|
|
40
51
|
class BuildComponent():
|
|
41
52
|
def __init__(self, args_parser: ArgumentParser, args=None):
|
|
53
|
+
self.deploy_success = True
|
|
42
54
|
self.options = args_parser.parse_args(args)
|
|
43
55
|
self.options.build_type = self.options.build_type.capitalize()
|
|
44
56
|
if self.options.channel is None or self.options.channel.strip() == "":
|
|
@@ -56,8 +68,9 @@ class BuildComponent():
|
|
|
56
68
|
os.makedirs(self.rootfs_dir, exist_ok=True)
|
|
57
69
|
|
|
58
70
|
self.pkg = None
|
|
71
|
+
self.base_cmd = ""
|
|
59
72
|
self.gen_conaninfo()
|
|
60
|
-
self.base_cmd
|
|
73
|
+
self.base_cmd += f" --user {self.user} --channel {self.channel}"
|
|
61
74
|
self.base_cmd += f" -pr {self.profile} -s build_type={self.build_type} -r " + self.options.remote
|
|
62
75
|
self.base_cmd += f" -pr:b {self.profile_build}"
|
|
63
76
|
if self.options.cov:
|
|
@@ -116,16 +129,26 @@ class BuildComponent():
|
|
|
116
129
|
"@" + self.user + "/" + self.channel
|
|
117
130
|
# 准备部署依赖
|
|
118
131
|
requires = pkg.get("requires")
|
|
132
|
+
deps = []
|
|
119
133
|
if requires is not None:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
134
|
+
if self.options.test:
|
|
135
|
+
for rt in requires.get("test", []):
|
|
136
|
+
deps.append(rt)
|
|
137
|
+
conan = rt.get("conan")
|
|
138
|
+
if conan is not None:
|
|
139
|
+
self.runtime_packages.append(conan)
|
|
124
140
|
for rt in requires.get("compile", []):
|
|
141
|
+
deps.append(rt)
|
|
125
142
|
conan = rt.get("conan")
|
|
126
143
|
if conan is not None:
|
|
127
144
|
self.runtime_packages.append(conan)
|
|
128
145
|
|
|
146
|
+
for dep in deps:
|
|
147
|
+
option = dep.get("option", {})
|
|
148
|
+
conan = dep.get("conan").split("/")[0]
|
|
149
|
+
for k, v in option.items():
|
|
150
|
+
self.base_cmd += f" -o {conan}/*:{k}={v}"
|
|
151
|
+
|
|
129
152
|
# 生成conan构建脚本
|
|
130
153
|
conanfile = os.path.join(cwd, "conanbase.py")
|
|
131
154
|
# 当git未跟踪conanfile.py时生成新的conanfile.py
|
|
@@ -171,6 +194,10 @@ class BuildComponent():
|
|
|
171
194
|
tools.exec(cmd, verbose=True)
|
|
172
195
|
os.chdir(cwd)
|
|
173
196
|
|
|
197
|
+
def _copy_failed(self, result):
|
|
198
|
+
print(result)
|
|
199
|
+
self.deploy_success = False
|
|
200
|
+
|
|
174
201
|
def deploy(self):
|
|
175
202
|
log.success(f"start deplay {self.package} and it's dependencies to ./temp/rootfs")
|
|
176
203
|
# 生成部署deploy命令
|
|
@@ -193,6 +220,7 @@ class BuildComponent():
|
|
|
193
220
|
res = tools.run(cmd).stdout.strip()
|
|
194
221
|
graph = json.loads(res)
|
|
195
222
|
nodes = graph.get("graph", {}).get("nodes", {})
|
|
223
|
+
pool = Pool()
|
|
196
224
|
for id, info in nodes.items():
|
|
197
225
|
ref = info.get("ref")
|
|
198
226
|
id = info.get("package_id")
|
|
@@ -200,7 +228,11 @@ class BuildComponent():
|
|
|
200
228
|
if context != "host":
|
|
201
229
|
continue
|
|
202
230
|
dep = DeployComponent(ref, id, self.rootfs_dir)
|
|
203
|
-
dep.run
|
|
231
|
+
pool.apply_async(dep.run, error_callback=self._copy_failed)
|
|
232
|
+
pool.close()
|
|
233
|
+
pool.join()
|
|
234
|
+
if not self.deploy_success:
|
|
235
|
+
raise Exception("Deploy component failed")
|
|
204
236
|
|
|
205
237
|
# 设置ROOTFS_DIR环境变量,为DT测试提供相对路径
|
|
206
238
|
os.environ["ROOTFS_DIR"] = self.rootfs_dir
|
|
@@ -45,7 +45,7 @@ class LiteBmcConan(ConanFile):
|
|
|
45
45
|
"test": [False, True],
|
|
46
46
|
% if len(pkg.get("options", [])) > 0:
|
|
47
47
|
% for op, ctx in pkg["options"].items():
|
|
48
|
-
"${op}": [${",".join(("\"" + i + "\"") if isinstance(i, str) else str(i) for i in ctx["option"])}],
|
|
48
|
+
"${op}": [${", ".join(("\"" + i + "\"") if isinstance(i, str) else str(i) for i in ctx["option"])}],
|
|
49
49
|
% endfor
|
|
50
50
|
% endif
|
|
51
51
|
}
|
|
@@ -57,7 +57,7 @@ class LiteBmcConan(ConanFile):
|
|
|
57
57
|
"test": False,
|
|
58
58
|
% if len(pkg.get("options", [])) > 0:
|
|
59
59
|
% for op, ctx in pkg["options"].items():
|
|
60
|
-
"${op}": ${("\"" + ctx["default"] + "\"") if isinstance(ctx["default"], str) else str(ctx["default"])}
|
|
60
|
+
"${op}": ${("\"" + ctx["default"] + "\"") if isinstance(ctx["default"], str) else str(ctx["default"])},
|
|
61
61
|
% endfor
|
|
62
62
|
% endif
|
|
63
63
|
}
|
|
@@ -33,6 +33,8 @@ class TestComponent():
|
|
|
33
33
|
for dir in test_src_folder:
|
|
34
34
|
cmd = f"lcov -r {coverage_dir}/cover.info \"{build_folder}/{dir}/*\" -o {coverage_dir}/cover.info"
|
|
35
35
|
tool.exec(cmd)
|
|
36
|
+
cmd = f"lcov -r {coverage_dir}/cover.info \"*/include/*\" -o {coverage_dir}/cover.info"
|
|
37
|
+
tool.exec(cmd)
|
|
36
38
|
cmd = f"genhtml -o {coverage_dir}/html --legend {coverage_dir}/cover.info"
|
|
37
39
|
tool.exec(cmd)
|
|
38
40
|
|
lbkit-0.5.11/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
|