Skip to content

Commit ad332f9

Browse files
committed
feat(audit): accept bin/foo.exe as a match for provides: - bin/foo
On windows/* targets, make install produces `bin/foo.exe` instead of `bin/foo`. Recipes that target multiple platforms shouldn't have to enumerate both forms in `provides:` — extend the lookup to also accept the `.exe` suffix as a fallback. This is the brewkit hook @jhheider pointed at on #346 (audit/audit.ts line 46). It unblocks the jq Windows pilot (pkgxdev/pantry#12987) which would otherwise fail the `provides: - bin/jq` audit on its windows/x86-64 target (the actual binary is `bin/jq.exe`). Implementation: just expand the search list. Cost is one extra stat per provided binary on non-Windows installs (no measurable impact); zero false-positive risk because `.exe` files are unconventional on POSIX systems. No platform check at audit time — the audit runs over whatever's in the cellar, doesn't need to know what target was built for. If `foo.exe` exists, that's a real PE binary and counts as providing `foo`.
1 parent a4f0663 commit ad332f9

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

audit/audit.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,19 @@ async function audit_provides(pkg: Package) {
4646

4747
for (const provide of await pantry.project(pkg).provides()) {
4848
const name = moustaches.apply(provide, versionMap)
49-
const bin = path.join('bin', name)
50-
const sbin = path.join('sbin', name)
51-
if (!bin.isExecutableFile() && !sbin.isExecutableFile()) {
49+
// Windows targets ship binaries with `.exe` suffix. Recipes can
50+
// keep `provides: - bin/foo` without enumerating both — we look
51+
// for the unsuffixed name first (Linux/macOS), then fall back to
52+
// `foo.exe` (windows/*). Cost: one extra stat per provide on
53+
// non-Windows; zero false positives since `.exe` files are
54+
// unconventional on POSIX.
55+
const candidates = [
56+
path.join('bin', name),
57+
path.join('sbin', name),
58+
path.join('bin', name + '.exe'),
59+
path.join('sbin', name + '.exe'),
60+
]
61+
if (!candidates.some(p => p.isExecutableFile())) {
5262
missing.push([pkg.project, name])
5363
}
5464
}

0 commit comments

Comments
 (0)