mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-05-16 21:56:33 +00:00
fix(builds-cacher): enumerate specific OS/arch before ANYOS/ANYARCH
In _enumerateTriplets, the order of `oses` and `arches` was ANYOS/ANYARCH first, specific second. This caused findMatchingPackages to pick the most-generic triplet (e.g. ANYOS-ANYARCH-none) before trying specific OS triplets — and packages that have a wildcard git fallback alongside per-platform binaries would resolve to the git source instead of the binary, even when the client never asked for git as an unpacker. Reverse the order so specific platforms win: - oses: hostTarget.os, posix_2017, posix_2024, ANYOS - arches: arches.concat(['ANYARCH']) Concrete example: serviceman has both posix_2017/*/tar.gz and */*/git in the cache. Pre-fix, findMatchingPackages picks ANYOS-ANYARCH-none (containing only the .git entry). The .git gate in getSortedFormats then correctly excludes git from format candidates, but the chosen triplet has nothing else, so selectPackage falls through to packages[0] = git entry. Post-fix, findMatchingPackages picks posix_2017-ANYARCH-none first (containing [tar.gz, zip]), and selectPackage returns tar.gz.
This commit is contained in:
@@ -742,19 +742,22 @@ BuildsCacher.create = function ({ ALL_TERMS, installers, caches }) {
|
||||
return triplets;
|
||||
}
|
||||
|
||||
// Prefer platform-specific matches over ANYOS/ANYARCH fallbacks.
|
||||
// This ensures e.g. darwin-aarch64-none matches before
|
||||
// ANYOS-ANYARCH-none (.git source URLs from old releases).
|
||||
let oses = [];
|
||||
if (hostTarget.os === 'windows') {
|
||||
oses = ['ANYOS', 'windows'];
|
||||
oses = ['windows', 'ANYOS'];
|
||||
} else if (hostTarget.os === 'android') {
|
||||
oses = ['ANYOS', 'posix_2017', 'posix_2024', 'android', 'linux'];
|
||||
oses = ['android', 'linux', 'posix_2017', 'posix_2024', 'ANYOS'];
|
||||
} else {
|
||||
oses = ['ANYOS', 'posix_2017', 'posix_2024', hostTarget.os];
|
||||
oses = [hostTarget.os, 'posix_2017', 'posix_2024', 'ANYOS'];
|
||||
}
|
||||
|
||||
let waterfall = HostTargets.WATERFALL[hostTarget.os] || {};
|
||||
let arches = waterfall[hostTarget.arch] ||
|
||||
HostTargets.WATERFALL.ANYOS[hostTarget.arch] || [hostTarget.arch];
|
||||
arches = ['ANYARCH'].concat(arches);
|
||||
arches = arches.concat(['ANYARCH']);
|
||||
let libcs = waterfall[hostTarget.libc] ||
|
||||
HostTargets.WATERFALL.ANYOS[hostTarget.libc] || [hostTarget.libc];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user