about summary refs log tree commit diff
path: root/maintainers/scripts/kde/collect-missing-deps.py
blob: f3943338b57fbe26bd6b9d6a6624fe79b4b968a0 (plain) (blame)
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
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p python3
import pathlib

OK_MISSING = {
    # we don't use precompiled QML
    'Qt6QuickCompiler',
    'Qt6QmlCompilerPlusPrivate',
    # usually used for version numbers
    'Git',
    # useless by itself, will warn if something else is not found
    'PkgConfig',
    # license verification
    'ReuseTool',
    # dev only
    'ClangFormat',
    # doesn't exist
    'Qt6X11Extras',
}

OK_MISSING_BY_PACKAGE = {
    "angelfish": {
        "Qt6Feedback",  # we don't have it
    },
    "attica": {
        "Python3",  # only used for license checks
    },
    "discover": {
        "rpm-ostree-1",  # we don't have rpm-ostree (duh)
        "Snapd",  # we don't have snaps and probably never will
    },
    "elisa": {
        "UPNPQT",  # upstream says it's broken
    },
    "extra-cmake-modules": {
        "Sphinx",  # only used for docs, bloats closure size
        "QCollectionGenerator"
    },
    "kio-extras-kf5": {
        "KDSoapWSDiscoveryClient",  # actually vendored on KF5 version
    },
    "kitinerary": {
        "OsmTools",  # used for map data updates, we use prebuilt
    },
    "kosmindoormap": {
        "OsmTools",  # same
        "Protobuf",
    },
    "kpty": {
        "UTEMPTER",  # we don't have it and it probably wouldn't work anyway
    },
    "kpublictransport": {
        "OsmTools",  # same
        "PolyClipping",
        "Protobuf",
    },
    "krfb": {
        "Qt6XkbCommonSupport",  # not real
    },
    "kuserfeedback": {
        "Qt6Svg",  # all used for backend console stuff we don't ship
        "QmlLint",
        "Qt6Charts",
        "FLEX",
        "BISON",
        "Php",
        "PhpUnit",
    },
    "kwin": {
        "display-info",  # newer versions identify as libdisplay-info
    },
    "mlt": {
        "Qt5",  # intentionally disabled
        "SWIG",
    },
    "plasma-desktop": {
        "scim",  # upstream is dead, not packaged in Nixpkgs
    },
    "powerdevil": {
        "DDCUtil",  # cursed, intentionally disabled
    },
    "pulseaudio-qt": {
        "Qt6Qml",  # tests only
        "Qt6Quick",
    },
    "syntax-highlighting": {
        "XercesC",  # only used for extra validation at build time
    }
}

def main():
    here = pathlib.Path(__file__).parent.parent.parent.parent
    logs = (here / "logs").glob("*.log")

    for log in sorted(logs):
        pname = log.stem

        missing = []
        is_in_block = False
        with log.open(errors="replace") as fd:
            for line in fd:
                line = line.strip()
                if line.startswith("--   No package '"):
                    package = line.removeprefix("--   No package '").removesuffix("' found")
                    missing.append(package)
                if line == "-- The following OPTIONAL packages have not been found:" or line == "-- The following RECOMMENDED packages have not been found:":
                    is_in_block = True
                elif line.startswith("--") and is_in_block:
                    is_in_block = False
                elif line.startswith("*") and is_in_block:
                    package = line.removeprefix("* ")
                    missing.append(package)

        missing = {
            package
            for package in missing
            if not any(package.startswith(i) for i in OK_MISSING | OK_MISSING_BY_PACKAGE.get(pname, set()))
        }

        if missing:
            print(pname + ":")
            for line in missing:
                print("  -", line)
            print()

if __name__ == '__main__':
    main()