Skip to content

Instantly share code, notes, and snippets.

@mmilata
Created April 7, 2020 22:13
#!/usr/bin/env python3
import re
import subprocess
import tempfile
call_package_re = re.compile(r"([^ ]*) = libsForQt5\.callPackage \.\./([^ ]*)")
stdenv_re = re.compile(r"^([ ]*in )?stdenv.mkDerivation", re.MULTILINE)
script = """
set -e
pushd {d}
nix-build '<nixpkgs>' -A {attr}
for E in result/bin/*; do
echo MKD_STARTING_BINARY
timeout -k 2 1 $E
done
"""
with open("pkgs/top-level/all-packages.nix") as allf:
for line in allf:
m = call_package_re.search(line)
if m is None:
continue
attr = m[1]
fname = "pkgs/" + m[2]
if not fname.endswith(".nix"):
fname += "/default.nix"
with open(fname) as df:
contents = df.read()
if stdenv_re.search(contents) is None:
continue
if "broken = true" in contents or "wrapQtAppsHook" in contents:
continue
#print("{}:\t{}".format(attr, fname))
with tempfile.TemporaryDirectory(suffix="mkD") as tmp:
result = subprocess.run(script.format(d=tmp, attr=attr), shell=True, capture_output=True)
hits = result.stderr.count(b"qt.qpa.plugin: Could not find the Qt platform plugin")
total = result.stdout.count(b"MKD_STARTING_BINARY")
if hits > 0:
print("{}\t{}/{}:\t{}".format(attr, hits, total, fname))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment