@ruelya/grok-build 1.0.2 → 1.0.3-rev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/BUILD_INFO.txt +2 -2
- package/bin/install.mjs +31 -3
- package/package.json +3 -3
package/artifacts/BUILD_INFO.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
version=1.0.
|
|
2
|
-
release=https://github.com/Ruelya/grok-build-rev/releases/download/v1.0.
|
|
1
|
+
version=1.0.3-rev
|
|
2
|
+
release=https://github.com/Ruelya/grok-build-rev/releases/download/v1.0.3-rev
|
package/bin/install.mjs
CHANGED
|
@@ -73,10 +73,21 @@ function runVersion(exe) {
|
|
|
73
73
|
shell: false,
|
|
74
74
|
windowsHide: true,
|
|
75
75
|
});
|
|
76
|
+
// SIGILL / crash → status null + signal; treat as unusable (e.g. neoverse-v2
|
|
77
|
+
// binary on Neoverse-N1 Ampere).
|
|
78
|
+
if (r.error || r.signal || (typeof r.status === "number" && r.status !== 0)) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
76
81
|
const out = ((r.stdout || "") + (r.stderr || "")).trim();
|
|
77
82
|
return out.split(/\r?\n/)[0] || null;
|
|
78
83
|
}
|
|
79
84
|
|
|
85
|
+
/** True when an on-disk binary exists but cannot even print --version. */
|
|
86
|
+
function isBrokenBinary(exe) {
|
|
87
|
+
if (!existsSync(exe) || (fileSize(exe) || 0) < 1_000_000) return false;
|
|
88
|
+
return runVersion(exe) == null;
|
|
89
|
+
}
|
|
90
|
+
|
|
80
91
|
function fileSize(p) {
|
|
81
92
|
try {
|
|
82
93
|
return statSync(p).size;
|
|
@@ -273,14 +284,31 @@ async function resolveSourceBinary() {
|
|
|
273
284
|
);
|
|
274
285
|
}
|
|
275
286
|
|
|
276
|
-
|
|
287
|
+
// Versioned cache so upgrading 1.0.2 → 1.0.3 never reuses a bad binary
|
|
288
|
+
// (e.g. neoverse-v2 SIGILL on Ampere Neoverse-N1).
|
|
289
|
+
const ver = String(pkg.version || "unknown").replace(/[^\w.-]+/g, "_");
|
|
290
|
+
const cacheDir = join(PKG_ROOT, "artifacts", "cache", ver, t.key);
|
|
277
291
|
mkdirSync(cacheDir, { recursive: true });
|
|
278
292
|
const dest = join(cacheDir, t.exeName);
|
|
279
|
-
|
|
280
|
-
|
|
293
|
+
const needFetch =
|
|
294
|
+
!existsSync(dest) ||
|
|
295
|
+
(fileSize(dest) || 0) < 1_000_000 ||
|
|
296
|
+
isBrokenBinary(dest);
|
|
297
|
+
if (needFetch) {
|
|
281
298
|
console.log(`Downloading ${url} …`);
|
|
282
299
|
await download(url, dest);
|
|
283
300
|
}
|
|
301
|
+
// Refuse to install a still-broken download (wrong arch / CPU baseline).
|
|
302
|
+
if (isBrokenBinary(dest)) {
|
|
303
|
+
throw new Error(
|
|
304
|
+
[
|
|
305
|
+
`Downloaded binary cannot run on this CPU (Illegal instruction / crash).`,
|
|
306
|
+
` url: ${url}`,
|
|
307
|
+
` tip: need a portable linux-arm64 build (target-cpu=generic, not neoverse-v2).`,
|
|
308
|
+
` reinstall: npm i -g @ruelya/grok-build@latest && npx grok-build install`,
|
|
309
|
+
].join("\n")
|
|
310
|
+
);
|
|
311
|
+
}
|
|
284
312
|
return { path: dest, source: "download", url };
|
|
285
313
|
}
|
|
286
314
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruelya/grok-build",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Grok Build fork (rev). Thin
|
|
3
|
+
"version": "1.0.3-rev",
|
|
4
|
+
"description": "Grok Build fork. Product version tracks upstream (currently 1.0.3-rev). Thin installer downloads from GitHub Releases.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"grok": "bin/grok.mjs",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"access": "public",
|
|
49
49
|
"registry": "https://registry.npmjs.org/"
|
|
50
50
|
},
|
|
51
|
-
"forkReleaseBase": "https://github.com/Ruelya/grok-build-rev/releases/download/v1.0.
|
|
51
|
+
"forkReleaseBase": "https://github.com/Ruelya/grok-build-rev/releases/download/v1.0.3-rev"
|
|
52
52
|
}
|