Files
RedBear-OS/recipes/core/uutils/source/util/gnu-json-result.py
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

41 lines
1.0 KiB
Python

"""
Extract the GNU logs into a JSON file.
"""
import json
import re
import sys
from pathlib import Path
out = {}
if len(sys.argv) != 2:
print("Usage: python gnu-json-result.py <gnu_test_directory>")
sys.exit(1)
test_dir = Path(sys.argv[1])
if not test_dir.is_dir():
print(f"Directory {test_dir} does not exist.")
sys.exit(1)
# Test all the logs from the test execution
for filepath in test_dir.glob("**/*.log"):
path = Path(filepath)
current = out
for key in path.parent.relative_to(test_dir).parts:
if key not in current:
current[key] = {}
current = current[key]
try:
with open(path, errors="ignore") as f:
content = f.read()
result = re.search(
r"(PASS|FAIL|SKIP|ERROR) [^ ]+ \(exit status: \d+\)$", content
)
if result:
current[path.name] = result.group(1)
except Exception as e:
print(f"Error processing file {path}: {e}", file=sys.stderr)
print(json.dumps(out, indent=2, sort_keys=True))