ff4ff35918
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.
46 lines
1.1 KiB
Python
Executable File
46 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
from collections import defaultdict
|
|
import itertools
|
|
import sys
|
|
import xml.etree.ElementTree as ET
|
|
|
|
FDO_XMLNS = "{http://www.freedesktop.org/standards/shared-mime-info}"
|
|
|
|
|
|
def test_case(fdo_xml: str) -> int:
|
|
|
|
with open(fdo_xml, "rb") as f:
|
|
tree = ET.parse(f)
|
|
|
|
errors = 0
|
|
|
|
types = defaultdict(set)
|
|
for elem in itertools.chain(
|
|
tree.findall(f"{FDO_XMLNS}mime-type"),
|
|
tree.findall(f"{FDO_XMLNS}mime-type/{FDO_XMLNS}alias"),
|
|
tree.findall(f"{FDO_XMLNS}mime-type/{FDO_XMLNS}sub-class-of"),
|
|
):
|
|
type_ = elem.attrib["type"]
|
|
types[type_.lower()].add(type_)
|
|
assert types
|
|
|
|
for type_, spellings in types.items():
|
|
if len(spellings) != 1:
|
|
print(
|
|
f"{fdo_xml}: multiple spellings differing only by case "
|
|
f"for {', '.join(sorted(spellings))}",
|
|
file=sys.stderr,
|
|
)
|
|
errors += 1
|
|
|
|
return errors
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) != 2:
|
|
print(f"Usage: {__file__} FREEDESKTOP_ORG_XML", file=sys.stderr)
|
|
sys.exit(2)
|
|
|
|
sys.exit(test_case(sys.argv[1]) and 1 or 0)
|