1#!/usr/bin/env nix-shell
2#!nix-shell -i python3 -p python3
3import pathlib
4
5OK_MISSING = {
6 # we don't use precompiled QML
7 'Qt6QuickCompiler',
8 'Qt6QmlCompilerPlusPrivate',
9 # usually used for version numbers
10 'Git',
11 # useless by itself, will warn if something else is not found
12 'PkgConfig',
13 # license verification
14 'ReuseTool',
15 # dev only
16 'ClangFormat',
17 # doesn't exist
18 'Qt6X11Extras',
19}
20
21OK_MISSING_BY_PACKAGE = {
22 "angelfish": {
23 "Qt6Feedback", # we don't have it
24 },
25 "attica": {
26 "Python3", # only used for license checks
27 },
28 "discover": {
29 "ApkQt", # we don't have APK (duh)
30 "rpm-ostree-1", # we don't have rpm-ostree (duh)
31 "Snapd", # we don't have snaps and probably never will
32 "packagekitqt6", # intentionally disabled
33 },
34 "elisa": {
35 "UPNPQT", # upstream says it's broken
36 },
37 "extra-cmake-modules": {
38 "Sphinx", # only used for docs, bloats closure size
39 "QCollectionGenerator"
40 },
41 "gwenview": {
42 "Tiff", # duplicate?
43 },
44 "kio-extras-kf5": {
45 "KDSoapWSDiscoveryClient", # actually vendored on KF5 version
46 },
47 "kitinerary": {
48 "OsmTools", # used for map data updates, we use prebuilt
49 },
50 "kosmindoormap": {
51 "OsmTools", # same
52 "Protobuf",
53 },
54 "kpty": {
55 "UTEMPTER", # we don't have it and it probably wouldn't work anyway
56 },
57 "kpublictransport": {
58 "OsmTools", # same
59 "PolyClipping",
60 "Protobuf",
61 },
62 "krfb": {
63 "Qt6XkbCommonSupport", # not real
64 },
65 "kuserfeedback": {
66 "Qt6Svg", # all used for backend console stuff we don't ship
67 "QmlLint",
68 "Qt6Charts",
69 "FLEX",
70 "BISON",
71 "Php",
72 "PhpUnit",
73 },
74 "kwin": {
75 "display-info", # newer versions identify as libdisplay-info
76 "Libcap", # used to call setcap at build time and nothing else
77 },
78 "libksysguard": {
79 "Libcap", # used to call setcap at build time and nothing else
80 },
81 "mlt": {
82 "Qt5", # intentionally disabled
83 "SWIG",
84 },
85 "plasma-desktop": {
86 "scim", # upstream is dead, not packaged in Nixpkgs
87 },
88 "poppler-qt6": {
89 "gobject-introspection-1.0", # we don't actually want to build the GTK variant
90 "gdk-pixbuf-2.0",
91 "gtk+-3.0",
92 },
93 "powerdevil": {
94 "DDCUtil", # cursed, intentionally disabled
95 "Libcap", # used to call setcap at build time and nothing else
96 },
97 "print-manager": {
98 "PackageKitQt6", # used for auto-installing drivers which does not work for obvious reasons
99 },
100 "pulseaudio-qt": {
101 "Qt6Qml", # tests only
102 "Qt6Quick",
103 },
104 "skladnik": {
105 "POVRay", # too expensive to rerender all the assets
106 },
107 "syntax-highlighting": {
108 "XercesC", # only used for extra validation at build time
109 }
110}
111
112def main():
113 here = pathlib.Path(__file__).parent.parent.parent.parent
114 logs = (here / "logs").glob("*.log")
115
116 for log in sorted(logs):
117 pname = log.stem
118
119 missing = []
120 is_in_block = False
121 with log.open(errors="replace") as fd:
122 for line in fd:
123 line = line.strip()
124 if line.startswith("-- No package '"):
125 package = line.removeprefix("-- No package '").removesuffix("' found")
126 missing.append(package)
127 if line == "-- The following OPTIONAL packages have not been found:" or line == "-- The following RECOMMENDED packages have not been found:":
128 is_in_block = True
129 elif line.startswith("--") and is_in_block:
130 is_in_block = False
131 elif line.startswith("*") and is_in_block:
132 package = line.removeprefix("* ")
133 missing.append(package)
134
135 missing = {
136 package
137 for package in missing
138 if not any(package.startswith(i) for i in OK_MISSING | OK_MISSING_BY_PACKAGE.get(pname, set()))
139 }
140
141 if missing:
142 print(pname + ":")
143 for line in missing:
144 print(" -", line)
145 print()
146
147if __name__ == '__main__':
148 main()