Skip to content

Commit 61f6a44

Browse files
committed
M9.R.15q.6.4: kwin recipe-eval avoid walking 33k /nix/store entries
The M9.R.15q.6.3 kwin recipe walked /nix/store via walkDir to find the wayland-protocols + libdisplay-info nix-stub paths. /nix/store has ~33k entries on the eli-wsl smoke host; the walkDir + per-entry 'extractFilename' + 'in' string check stalled provider-compile for minutes before any cmake action even started. Switch to two narrow walkPattern globs ('/nix/store/*-wayland-protocols-*' and '/nix/store/*-libdisplay-info-*') so the recipe-eval probe only opens entries that already match the prefix. Filters out .drv / .tar.xz / .tar.gz / .patch siblings the glob still picks up.
1 parent fb07bb9 commit 61f6a44

1 file changed

Lines changed: 26 additions & 12 deletions

File tree

recipes/packages/source/kwin/repro.nim

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -445,18 +445,32 @@ package kwinSource:
445445
if dirExists(pShare):
446446
pkgCfgDirs.add(pShare)
447447
# Nix-stub pkg-config dirs (wayland-protocols + libdisplay-info).
448-
for store in walkDir("/nix/store", relative = false):
449-
if store.kind == pcDir:
450-
let n = extractFilename(store.path)
451-
if "wayland-protocols-" in n or "libdisplay-info-" in n:
452-
if not n.endsWith(".drv") and not n.endsWith(".tar.xz") and
453-
not n.endsWith(".tar.gz"):
454-
let pShare = store.path / "share" / "pkgconfig"
455-
if dirExists(pShare):
456-
pkgCfgDirs.add(pShare)
457-
let pLib = store.path / "lib" / "pkgconfig"
458-
if dirExists(pLib):
459-
pkgCfgDirs.add(pLib)
448+
# /nix/store is huge (~33k entries) so walkDir is prohibitively slow;
449+
# walkPattern only opens entries matching the glob.
450+
for store in walkPattern("/nix/store/*-wayland-protocols-*"):
451+
let n = extractFilename(store)
452+
if n.endsWith(".drv") or n.endsWith(".tar.xz") or
453+
n.endsWith(".tar.gz") or n.endsWith(".patch"):
454+
continue
455+
if not dirExists(store): continue
456+
let pShare = store / "share" / "pkgconfig"
457+
if dirExists(pShare):
458+
pkgCfgDirs.add(pShare)
459+
let pLib = store / "lib" / "pkgconfig"
460+
if dirExists(pLib):
461+
pkgCfgDirs.add(pLib)
462+
for store in walkPattern("/nix/store/*-libdisplay-info-*"):
463+
let n = extractFilename(store)
464+
if n.endsWith(".drv") or n.endsWith(".tar.xz") or
465+
n.endsWith(".tar.gz") or n.endsWith(".patch"):
466+
continue
467+
if not dirExists(store): continue
468+
let pShare = store / "share" / "pkgconfig"
469+
if dirExists(pShare):
470+
pkgCfgDirs.add(pShare)
471+
let pLib = store / "lib" / "pkgconfig"
472+
if dirExists(pLib):
473+
pkgCfgDirs.add(pLib)
460474
let pkgCfgPath = pkgCfgDirs.join(":")
461475
let env = @[
462476
("PKG_CONFIG_PATH_FOR_TARGET", pkgCfgPath),

0 commit comments

Comments
 (0)