Repository navigation
Expand file tree
/
Copy pathcompiler.py
More file actions
606 lines (538 loc) · 22.5 KB
/
Copy pathcompiler.py
File metadata and controls
606 lines (538 loc) · 22.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
# SPDX-License-Identifier: BSD-3-Clause
"""ALSATPLG Topology2 compiler integration."""
from __future__ import annotations
import os
import re
import shutil
import subprocess
import tempfile
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
from .model import (
GraphViewModel,
debug_log_command,
debug_log_line,
resolve_sof_and_workspace_roots,
)
from .serializer import generate_compilable_conf
DEFAULT_ABI_CONF = """Object.Base.manifest.1 {
\tname "sof_manifest"
\tObject.Base.data.1 {
\t\tname "SOF ABI"
\t\tbytes\t"0x03,0x00,0x1d,0x00,0x01,0x00"
\t}
}
"""
@dataclass
class CompileDiagnostic:
"""Structured diagnostic parsed from alsatplg compilation output."""
severity: str # "error" or "warning"
raw_line: str
message: str
conf_file: Optional[str] = None
line_no: Optional[int] = None
col_no: Optional[int] = None
symbol_or_attr: Optional[str] = None
target_kind: str = "root" # "node", "container", "edge", "define", "root"
target_id: Optional[str] = None
@dataclass
class CompileResult:
success: bool
tplg_path: str
conf_path: str
pipeline_ids: List[int]
command: str
stdout: str
stderr: str
size_bytes: int = 0
diagnostics: List[CompileDiagnostic] = field(default_factory=list)
_ALSA_PREFIX_RE = re.compile(
r"^ALSA\s+lib\s+[^:]+:\d+:\([^)]*\)\s*(?:\[[^\]]*\]\s*)?",
re.IGNORECASE,
)
_FILE_LOC_RE = re.compile(
r"(?P<file>_toplevel_|[A-Za-z0-9_./\-]+\.conf):(?P<line>\d+)(?::(?P<col>\d+))?:?\s*(?P<reason>.*)"
)
_NOT_A_TYPE_RE = re.compile(
r"['\"]?(?P<sym>[A-Za-z0-9_.\-]+)['\"]?\s+is\s+not\s+a\s+(?:string|integer|real|compound|boolean|number)",
re.IGNORECASE,
)
_MANDATORY_ATTR_RE = re.compile(
r"Mandatory\s+attribute\s+['\"]?(?P<attr>[A-Za-z0-9_.\-]+)['\"]?\s+not\s+set(?:\s+for\s+class\s+['\"]?(?P<cls>[A-Za-z0-9_.\-]+)['\"]?)?",
re.IGNORECASE,
)
_INVALID_ATTR_RE = re.compile(
r"(?:Unknown|Invalid)\s+(?:field|attribute|key|compound|type|value(?:\s+for)?)\s+['\"]?(?P<attr>[A-Za-z0-9_.\-]+)['\"]?",
re.IGNORECASE,
)
_OBJECT_REF_RE = re.compile(
r"(?:Failed\s+to\s+update\s+attributes\s+for\s+object|error\s+getting\s+widget\s+name\s+for|Error\s+building\s+object|No\s+Class\s+definition\s+found\s+for)\s+['\"]?(?P<obj>[A-Za-z0-9_.\-]+)['\"]?",
re.IGNORECASE,
)
_ERROR_LINE_RE = re.compile(
r"\[error[^\]]*\]|\berror[:\s]|\bUnable\s+(?:to|not)\b|\bFailed\s+to\b|\bError\s+building\b|\bInvalid\b|\bUnknown\b|\bMandatory\s+attribute\b|\bNo\s+Class\s+definition\b|\bUnexpected\s+char\b",
re.IGNORECASE,
)
_WARN_LINE_RE = re.compile(
r"\[warn[^\]]*\]|\bwarning[:\s]|\bwarn[:\s]",
re.IGNORECASE,
)
def classify_log_line(line: str) -> Optional[str]:
"""Return 'error', 'warning', or None for a single compiler/console line."""
s = line.strip()
if not s or s.startswith("$ "):
return None
if _ERROR_LINE_RE.search(s):
return "error"
if _WARN_LINE_RE.search(s):
return "warning"
return None
def _extract_key_from_conf_line(line_text: str) -> Optional[str]:
"""Extract the leading configuration key from a .conf line if present."""
s = line_text.split("#", 1)[0].strip()
if not s or s in ("{", "}", "[", "]") or s.startswith("<"):
return None
m = re.match(r"^([A-Za-z0-9_.\-]+)", s)
return m.group(1) if m else None
def _match_object_hint_to_vm(
obj_hint: str,
vm: Optional[GraphViewModel],
) -> Tuple[str, Optional[str]]:
"""Map an alsatplg object identifier (e.g. 'Widget.gain.99', 'gain.1.1', 'Base.route.0') to (target_kind, target_id)."""
if not vm or not obj_hint:
return ("root", None)
clean = obj_hint.strip("'\"")
if clean.startswith("Object."):
clean = clean[len("Object."):]
# 1. Exact node ID match
if clean in vm.nodes:
return ("node", clean)
# 2. Widget.<class>.<inst> or <class>.<pid>.<inst>
w_clean = clean[len("Widget."):] if clean.startswith("Widget.") else clean
if w_clean in vm.nodes:
return ("node", w_clean)
parts = w_clean.split(".")
if len(parts) >= 2:
wclass = parts[0]
winst = parts[-1]
for nid, n in vm.nodes.items():
if n.class_name == wclass and (n.instance_id == winst or nid.endswith(f".{winst}")):
return ("node", nid)
for nid, n in vm.nodes.items():
if n.class_name == wclass:
return ("node", nid)
# 3. Class.Widget.<class>
if clean.startswith("Class.Widget."):
wclass = clean[len("Class.Widget."):]
for nid, n in vm.nodes.items():
if n.class_name == wclass:
return ("node", nid)
# 4. Pipeline.<class>.<pid> or pipeline.<pid>
if clean.lower().startswith("pipeline."):
pparts = clean.split(".")
if pparts[-1].isdigit() and int(pparts[-1]) in vm.containers:
return ("container", pparts[-1])
# 5. Base.route.<idx>
if clean.startswith("Base.route"):
rparts = clean.split(".")
if rparts[-1].isdigit():
idx = int(rparts[-1])
if 0 <= idx < len(vm.edges):
return ("edge", vm.edges[idx].id)
if vm.edges:
return ("edge", vm.edges[-1].id)
# 6. Define variable match
def_node = vm.root_config.get_child("Define (Active Variables)")
if def_node and def_node.get_child(clean) is not None:
return ("define", clean)
return ("root", None)
def _inspect_conf_line_context(
conf_file: str,
line_no: int,
vm: Optional[GraphViewModel],
hint_symbol: Optional[str] = None,
) -> Tuple[str, Optional[str], Optional[str]]:
"""Inspect `conf_file` around 1-based `line_no` to determine (target_kind, target_id, symbol_or_attr)."""
if not conf_file or not os.path.isfile(conf_file) or line_no <= 0:
return ("root", None, hint_symbol)
try:
with open(conf_file, "r", encoding="utf-8", errors="replace") as f:
lines = f.splitlines()
except Exception:
return ("root", None, hint_symbol)
idx = min(len(lines) - 1, max(0, line_no - 1))
# ALSA's _snd_config_load_with_include often reports the line immediately after a failed parse_value
key_curr = _extract_key_from_conf_line(lines[idx])
key_prev = _extract_key_from_conf_line(lines[idx - 1]) if idx > 0 else None
chosen_idx = idx
chosen_key = hint_symbol or key_curr or key_prev
if hint_symbol and idx > 0 and key_prev == hint_symbol:
chosen_idx = idx - 1
chosen_key = key_prev
elif key_curr is None and key_prev is not None:
chosen_idx = idx - 1
chosen_key = key_prev
# Walk upward from chosen_idx to find the enclosing top-level block header (indent 0)
enclosing_header: Optional[str] = None
block_start_idx = chosen_idx
for i in range(chosen_idx, -1, -1):
raw = lines[i]
stripped = raw.split("#", 1)[0].strip()
if not stripped:
continue
if not raw[0].isspace() and ("{" in stripped or "[" in stripped):
enclosing_header = stripped.split("{", 1)[0].split("[", 1)[0].strip()
block_start_idx = i
break
# If no hint_symbol was given and we're in a Define block where ALSA reported line N+1,
# check if line N-1 has a type mismatch (e.g. integer Define quoted as string)
if enclosing_header == "Define":
if not hint_symbol and idx > 0 and key_prev:
prev_text = lines[idx - 1].strip()
# If previous line in Define has a quoted number like '52', prefer key_prev
if re.search(r"['\"]\d+['\"]", prev_text):
chosen_key = key_prev
return ("define", chosen_key, chosen_key)
if enclosing_header and enclosing_header.startswith("Object.Widget."):
# Check for `index <pid>` inside this block
block_end = min(len(lines), block_start_idx + 40)
pid_val: Optional[int] = None
for j in range(block_start_idx, block_end):
m_idx = re.match(r"^\s*index\s+(\d+)", lines[j])
if m_idx:
pid_val = int(m_idx.group(1))
break
if j > block_start_idx and lines[j].strip().startswith("}"):
break
w_tail = enclosing_header[len("Object.Widget."):]
w_parts = w_tail.split(".")
wclass = w_parts[0]
winst = w_parts[1] if len(w_parts) > 1 else "1"
if vm and pid_val is not None:
cand_id = f"{wclass}.{pid_val}.{winst}"
if cand_id in vm.nodes:
return ("node", cand_id, chosen_key)
tk, tid = _match_object_hint_to_vm(enclosing_header, vm)
return (tk, tid, chosen_key)
if enclosing_header and enclosing_header.startswith("Object.Pipeline."):
tk, tid = _match_object_hint_to_vm(enclosing_header, vm)
return (tk, tid, chosen_key)
if enclosing_header and enclosing_header.startswith("Object.Base.route"):
# Look around chosen_idx for source / sink
src_val: Optional[str] = None
snk_val: Optional[str] = None
for j in range(max(block_start_idx, chosen_idx - 5), min(len(lines), chosen_idx + 6)):
m_src = re.match(r"^\s*source\s+['\"]?([^'\"]+)['\"]?", lines[j].strip())
if m_src:
src_val = m_src.group(1).strip()
m_snk = re.match(r"^\s*sink\s+['\"]?([^'\"]+)['\"]?", lines[j].strip())
if m_snk:
snk_val = m_snk.group(1).strip()
if vm:
for e in vm.edges:
if (src_val and e.source_node == src_val) or (snk_val and e.sink_node == snk_val):
return ("edge", e.id, chosen_key or "sink")
if src_val and src_val in vm.nodes:
return ("node", src_val, chosen_key)
if snk_val and snk_val in vm.nodes:
return ("node", snk_val, chosen_key)
return ("edge", vm.edges[-1].id if (vm and vm.edges) else None, chosen_key)
if chosen_key and vm:
tk, tid = _match_object_hint_to_vm(chosen_key, vm)
if tk != "root":
return (tk, tid, chosen_key)
return ("root", None, chosen_key)
def parse_compile_diagnostics(
stdout: str,
stderr: str,
conf_path: str,
vm: Optional[GraphViewModel] = None,
topology2_root: Optional[str] = None,
) -> List[CompileDiagnostic]:
"""Parse alsatplg stdout/stderr into structured CompileDiagnostic objects mapped to GraphViewModel."""
combined_lines = []
for chunk in (stdout, stderr):
if chunk:
combined_lines.extend(chunk.splitlines())
diags: List[CompileDiagnostic] = []
for raw in combined_lines:
sev = classify_log_line(raw)
if not sev:
continue
clean_msg = _ALSA_PREFIX_RE.sub("", raw.strip()).strip()
conf_file: Optional[str] = None
line_no: Optional[int] = None
col_no: Optional[int] = None
symbol_or_attr: Optional[str] = None
target_kind = "root"
target_id: Optional[str] = None
# 1. File:Line:Col pattern
m_loc = _FILE_LOC_RE.search(clean_msg)
if m_loc:
f_tok = m_loc.group("file")
if f_tok == "_toplevel_":
conf_file = conf_path
elif topology2_root and os.path.isfile(os.path.join(topology2_root, f_tok)):
conf_file = os.path.join(topology2_root, f_tok)
else:
conf_file = f_tok
line_no = int(m_loc.group("line"))
if m_loc.group("col"):
col_no = int(m_loc.group("col"))
# 2. Semantic symbol/attribute/object patterns
m_type = _NOT_A_TYPE_RE.search(clean_msg)
if m_type:
symbol_or_attr = m_type.group("sym")
m_mand = _MANDATORY_ATTR_RE.search(clean_msg)
if m_mand:
symbol_or_attr = m_mand.group("attr")
if m_mand.group("cls"):
target_kind, target_id = _match_object_hint_to_vm(
f"Class.Widget.{m_mand.group('cls')}", vm
)
m_inv = _INVALID_ATTR_RE.search(clean_msg)
if m_inv and not symbol_or_attr:
symbol_or_attr = m_inv.group("attr")
m_obj = _OBJECT_REF_RE.search(clean_msg)
if m_obj:
obj_tok = m_obj.group("obj")
tk, tid = _match_object_hint_to_vm(obj_tok, vm)
if tk != "root":
target_kind, target_id = tk, tid
elif not symbol_or_attr:
symbol_or_attr = obj_tok
# 3. Direct symbol match against VM Define variables or node IDs
if symbol_or_attr and target_kind == "root":
tk, tid = _match_object_hint_to_vm(symbol_or_attr, vm)
if tk != "root":
target_kind, target_id = tk, tid
# 4. If we have a .conf file and line number, inspect the .conf context
if conf_file and line_no is not None:
# Check if previous diagnostic already extracted a symbol_or_attr
prev_sym = symbol_or_attr or (diags[-1].symbol_or_attr if diags else None)
tk, tid, sym = _inspect_conf_line_context(conf_file, line_no, vm, hint_symbol=prev_sym)
if target_kind == "root" and tk != "root":
target_kind, target_id = tk, tid
if not symbol_or_attr and sym:
symbol_or_attr = sym
diags.append(
CompileDiagnostic(
severity=sev,
raw_line=raw.strip(),
message=clean_msg,
conf_file=conf_file,
line_no=line_no,
col_no=col_no,
symbol_or_attr=symbol_or_attr,
target_kind=target_kind,
target_id=target_id,
)
)
# 5. Propagate shared context across multi-line error cascades
if len(diags) > 1:
best_kind = next((d.target_kind for d in reversed(diags) if d.target_kind != "root"), "root")
best_id = next((d.target_id for d in reversed(diags) if d.target_id is not None), None)
best_sym = next((d.symbol_or_attr for d in diags if d.symbol_or_attr is not None), None)
best_file = next((d.conf_file for d in diags if d.conf_file is not None), None)
best_line = next((d.line_no for d in diags if d.line_no is not None), None)
best_col = next((d.col_no for d in diags if d.col_no is not None), None)
for d in diags:
if best_kind != "root":
d.target_kind = best_kind
if best_id is not None:
d.target_id = best_id
if not d.symbol_or_attr and best_sym:
d.symbol_or_attr = best_sym
if not d.conf_file and best_file:
d.conf_file = best_file
if d.line_no is None and best_line is not None:
d.line_no = best_line
d.col_no = best_col
return diags
class TopologyCompiler:
"""Compiles a GraphViewModel into a binary .tplg using alsatplg -p."""
def __init__(self, topology2_root: str, build_dir: Optional[str] = None):
self.topology2_root = os.path.abspath(topology2_root)
self.build_dir = build_dir or os.path.join(tempfile.gettempdir(), "sof_tplg2_gui_build")
os.makedirs(self.build_dir, exist_ok=True)
self.alsatplg_bin = self._find_alsatplg()
self.target_platform: str = "mtl"
self.target_harness: str = "hda_analog"
self.extra_platform_conf: str = ""
def _find_alsatplg(self) -> str:
# Check ALSATPLG env var, workspace tools/bin/alsatplg, then PATH
_, workspace_root = resolve_sof_and_workspace_roots(self.topology2_root)
candidates = [
os.environ.get("ALSATPLG", ""),
os.path.join(workspace_root, "tools", "bin", "alsatplg"),
os.path.join(workspace_root, "alsa-utils", "topology", "alsatplg"),
shutil.which("alsatplg") or "",
]
for c in candidates:
if c and os.path.isfile(c) and os.access(c, os.X_OK):
return c
return "alsatplg"
@staticmethod
def _format_abi_conf_from_bytes_str(bytes_str: str) -> str:
cleaned = ",".join(part.strip() for part in (bytes_str or "").split(",") if part.strip())
return (
"Object.Base.manifest.1 {\n"
"\tname \"sof_manifest\"\n"
"\tObject.Base.data.1 {\n"
"\t\tname \"SOF ABI\"\n"
f"\t\tbytes\t\"{cleaned}\"\n"
"\t}\n"
"}\n"
)
def _ensure_abi_conf(self, vm: Optional[GraphViewModel] = None) -> str:
# Preserve binary SOF ABI bytes when recompiling a decoded or versioned GraphViewModel
if vm is not None and vm.root_config is not None:
manifest_node = vm.root_config.get_child("Object.Base.manifest")
if manifest_node is not None:
bytes_str = str(manifest_node.get_scalar("sof_abi_bytes", "") or "").strip()
if bytes_str:
os.makedirs(self.build_dir, exist_ok=True)
bin_abi_path = os.path.join(self.build_dir, "abi_binary.conf")
with open(bin_abi_path, "w", encoding="utf-8") as f:
f.write(self._format_abi_conf_from_bytes_str(bytes_str))
return bin_abi_path
abi_path = os.path.join(self.build_dir, "abi.conf")
if os.path.isfile(abi_path):
return abi_path
get_abi = os.path.join(self.topology2_root, "get_abi.sh")
sof_root, _ = resolve_sof_and_workspace_roots(self.topology2_root)
tplg_repo_root = os.path.abspath(os.path.join(self.topology2_root, ".."))
abi_source = ""
if os.path.isfile(os.path.join(tplg_repo_root, "include", "kernel", "abi.h")):
abi_source = tplg_repo_root
elif sof_root and os.path.isdir(os.path.join(sof_root, "src")):
abi_source = sof_root
if os.path.isfile(get_abi) and abi_source:
try:
res = subprocess.run(
[get_abi, abi_source, "ipc4"],
capture_output=True,
text=True,
check=True,
timeout=5,
)
if res.stdout.strip():
with open(abi_path, "w", encoding="utf-8") as f:
f.write(res.stdout)
return abi_path
except Exception:
pass
with open(abi_path, "w", encoding="utf-8") as f:
f.write(DEFAULT_ABI_CONF)
return abi_path
def compile_graph(
self,
vm: GraphViewModel,
extra_defines: str = "",
prefer_full_topology: bool = False,
output_tplg_path: Optional[str] = None,
) -> CompileResult:
"""Serialize vm to .conf, prepend abi.conf, and compile to .tplg with alsatplg -p."""
os.makedirs(self.build_dir, exist_ok=True)
abi_path = self._ensure_abi_conf(vm)
with open(abi_path, "r", encoding="utf-8") as f:
abi_text = f.read()
body_text, defines_str, tb_pipes = generate_compilable_conf(
vm,
self.topology2_root,
target_platform=self.target_platform,
target_harness=self.target_harness,
extra_platform_conf=self.extra_platform_conf,
prefer_full_topology=prefer_full_topology,
)
if extra_defines.strip():
defines_str = f"{defines_str},{extra_defines.strip()}" if defines_str else extra_defines.strip()
safe_name = re.sub(r"[^A-Za-z0-9_\-]", "_", vm.title) or "custom_topology"
conf_path = os.path.join(self.build_dir, f"{safe_name}.conf")
tplg_path = os.path.abspath(output_tplg_path) if output_tplg_path else os.path.join(self.build_dir, f"{safe_name}.tplg")
with open(conf_path, "w", encoding="utf-8") as f:
f.write(abi_text + "\n" + body_text)
debug_log_line(
"COMPILER:CONF",
f"Generated compilable .conf for '{vm.title}' (view_kind={vm.view_kind}, dirty={vm.dirty}, "
f"graph_modified={getattr(vm, 'graph_structure_modified', False)}, pipes={tb_pipes}) -> {conf_path} ({len(body_text)} B)",
)
cmd = [
self.alsatplg_bin,
"-I",
self.topology2_root,
]
if defines_str:
cmd.extend(["-D", defines_str])
cmd.extend(["-p", "-c", conf_path, "-o", tplg_path])
env = os.environ.copy()
env["ALSA_CONFIG_DIR"] = self.topology2_root
cmd_str = f"ALSA_CONFIG_DIR={self.topology2_root} " + " ".join(
f'"{a}"' if (" " in a or "," in a) else a for a in cmd
)
try:
proc = subprocess.run(
cmd,
env=env,
cwd=self.topology2_root,
capture_output=True,
text=True,
errors="replace",
timeout=30,
)
ok = proc.returncode == 0 and os.path.isfile(tplg_path)
sz = os.path.getsize(tplg_path) if ok else 0
debug_log_command(
"ALSATPLG",
cmd_str,
returncode=proc.returncode,
stdout=proc.stdout,
stderr=proc.stderr,
extra=f"tplg={tplg_path} ({sz} B), pipes={tb_pipes}",
)
diags = parse_compile_diagnostics(
proc.stdout,
proc.stderr,
conf_path,
vm=vm,
topology2_root=self.topology2_root,
)
return CompileResult(
success=ok,
tplg_path=tplg_path,
conf_path=conf_path,
pipeline_ids=tb_pipes,
command=cmd_str,
stdout=proc.stdout,
stderr=proc.stderr,
size_bytes=sz,
diagnostics=diags,
)
except Exception as exc:
err_s = str(exc)
debug_log_command(
"ALSATPLG",
cmd_str,
returncode=-1,
stdout="",
stderr=err_s,
extra="EXCEPTION",
)
diags = parse_compile_diagnostics(
"",
err_s,
conf_path,
vm=vm,
topology2_root=self.topology2_root,
)
return CompileResult(
success=False,
tplg_path=tplg_path,
conf_path=conf_path,
pipeline_ids=tb_pipes,
command=cmd_str,
stdout="",
stderr=err_s,
size_bytes=0,
diagnostics=diags,
)