@adea-ai/app-framework-release-tools 0.2.0 → 0.3.0
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/dist/cli.js +1118 -292
- package/dist/index.js +487 -212
- package/dist/release-tools-source.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -18,12 +18,15 @@ var __export = (target, all) => {
|
|
|
18
18
|
// src/index.ts
|
|
19
19
|
var exports_src = {};
|
|
20
20
|
__export(exports_src, {
|
|
21
|
+
createDailyNativeReceipt: () => createDailyNativeReceipt,
|
|
21
22
|
createGitHubPromotionProvider: () => createGitHubPromotionProvider,
|
|
22
23
|
createGitHubReleasePublisher: () => createGitHubReleasePublisher,
|
|
23
24
|
createMacosDmg: () => createMacosDmg,
|
|
25
|
+
desktopDailyProfile: () => desktopDailyProfile,
|
|
24
26
|
fileIdentity: () => fileIdentity2,
|
|
25
27
|
finalizeReleasePleaseDraft: () => finalizeReleasePleaseDraft,
|
|
26
28
|
inspectStagedStep: () => inspectStagedStep,
|
|
29
|
+
planDailyReleaseMatrix: () => planDailyReleaseMatrix,
|
|
27
30
|
planQualificationRun: () => planQualificationRun2,
|
|
28
31
|
planReleaseAssets: () => planReleaseAssets2,
|
|
29
32
|
publishFrameworkPackage: () => publishFrameworkPackage,
|
|
@@ -40,15 +43,39 @@ __export(exports_src, {
|
|
|
40
43
|
stageBuildStep: () => stageBuildStep,
|
|
41
44
|
stagePlatformArtifacts: () => stagePlatformArtifacts,
|
|
42
45
|
stageReleaseDescriptors: () => stageReleaseDescriptors,
|
|
46
|
+
verifyDailyReleaseMatrix: () => verifyDailyReleaseMatrix,
|
|
43
47
|
verifyImage: () => verifyImage,
|
|
44
48
|
writeDescriptors: () => writeDescriptors
|
|
45
49
|
});
|
|
46
50
|
|
|
47
51
|
// src/cli.ts
|
|
48
|
-
import { Effect as
|
|
52
|
+
import { Effect as Effect29 } from "effect";
|
|
49
53
|
|
|
50
54
|
// src/cli-commands.ts
|
|
51
|
-
import { Effect as
|
|
55
|
+
import { Effect as Effect28 } from "effect";
|
|
56
|
+
|
|
57
|
+
// ../../src/installer/hosted-runner.ts
|
|
58
|
+
import { isAbsolute } from "path";
|
|
59
|
+
var JOB_NUMBER = /^[1-9]\d{0,19}$/;
|
|
60
|
+
function isHostedRunner(env) {
|
|
61
|
+
if (env.CI !== "true")
|
|
62
|
+
return false;
|
|
63
|
+
if (env.GITHUB_ACTIONS === "true")
|
|
64
|
+
return env.RUNNER_ENVIRONMENT === "github-hosted";
|
|
65
|
+
if (env.FRAMEWORK_DISPOSABLE_RUNNER !== "true")
|
|
66
|
+
return false;
|
|
67
|
+
if (env.GITLAB_CI === "true")
|
|
68
|
+
return JOB_NUMBER.test(env.CI_JOB_ID ?? "");
|
|
69
|
+
return env.CIRCLECI === "true" && JOB_NUMBER.test(env.CIRCLE_BUILD_NUM ?? "");
|
|
70
|
+
}
|
|
71
|
+
function assertHostedRunner(env, subject) {
|
|
72
|
+
if (!isHostedRunner(env))
|
|
73
|
+
throw new Error(`${subject} requires a disposable hosted runner`);
|
|
74
|
+
}
|
|
75
|
+
function runnerTemp(env) {
|
|
76
|
+
const path = env.GITHUB_ACTIONS === "true" ? env.RUNNER_TEMP : env.TMPDIR;
|
|
77
|
+
return path && isAbsolute(path) ? path : undefined;
|
|
78
|
+
}
|
|
52
79
|
|
|
53
80
|
// ../../src/cli/cli-runner.ts
|
|
54
81
|
var MAX_ERROR_LENGTH = 400;
|
|
@@ -201,29 +228,6 @@ function sidecarBundlePath(name, platform) {
|
|
|
201
228
|
return `Resources/app/${SIDECAR_DIRECTORY}/${sidecarFileName(name, platform)}`;
|
|
202
229
|
}
|
|
203
230
|
|
|
204
|
-
// ../../src/installer/hosted-runner.ts
|
|
205
|
-
import { isAbsolute } from "path";
|
|
206
|
-
var JOB_NUMBER = /^[1-9]\d{0,19}$/;
|
|
207
|
-
function isHostedRunner(env) {
|
|
208
|
-
if (env.CI !== "true")
|
|
209
|
-
return false;
|
|
210
|
-
if (env.GITHUB_ACTIONS === "true")
|
|
211
|
-
return env.RUNNER_ENVIRONMENT === "github-hosted";
|
|
212
|
-
if (env.FRAMEWORK_DISPOSABLE_RUNNER !== "true")
|
|
213
|
-
return false;
|
|
214
|
-
if (env.GITLAB_CI === "true")
|
|
215
|
-
return JOB_NUMBER.test(env.CI_JOB_ID ?? "");
|
|
216
|
-
return env.CIRCLECI === "true" && JOB_NUMBER.test(env.CIRCLE_BUILD_NUM ?? "");
|
|
217
|
-
}
|
|
218
|
-
function assertHostedRunner(env, subject) {
|
|
219
|
-
if (!isHostedRunner(env))
|
|
220
|
-
throw new Error(`${subject} requires a disposable hosted runner`);
|
|
221
|
-
}
|
|
222
|
-
function runnerTemp(env) {
|
|
223
|
-
const path = env.GITHUB_ACTIONS === "true" ? env.RUNNER_TEMP : env.TMPDIR;
|
|
224
|
-
return path && isAbsolute(path) ? path : undefined;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
231
|
// ../../src/installer/installer-layout.ts
|
|
228
232
|
function assertInstallerContext(env, platform, host, arch) {
|
|
229
233
|
assertHostedRunner(env, "Installer execution");
|
|
@@ -1905,6 +1909,9 @@ var RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-dev\.\d+)?$/;
|
|
|
1905
1909
|
function isReleaseVersion(value) {
|
|
1906
1910
|
return typeof value === "string" && value.length <= MAX_RELEASE_VERSION_LENGTH && RELEASE_VERSION.test(value);
|
|
1907
1911
|
}
|
|
1912
|
+
function isReleaseTag(value) {
|
|
1913
|
+
return typeof value === "string" && value.startsWith("v") && isReleaseVersion(value.slice(1));
|
|
1914
|
+
}
|
|
1908
1915
|
|
|
1909
1916
|
// ../../src/release/release-promotion.ts
|
|
1910
1917
|
function order(a, b) {
|
|
@@ -3278,6 +3285,264 @@ var stageReleaseDescriptorsEffect = (options) => Effect15.gen(function* () {
|
|
|
3278
3285
|
});
|
|
3279
3286
|
var writeDescriptors = (directory, signed) => runReleaseLibrary(provideLibraryPorts()(writeDescriptorsEffect(directory, signed)));
|
|
3280
3287
|
var stageReleaseDescriptors = (options) => runReleaseLibrary(provideLibraryPorts({ run: planGitHubRun(options.env, options.run) })(stageReleaseDescriptorsEffect(options)));
|
|
3288
|
+
// src/library/daily-matrix.ts
|
|
3289
|
+
import { join as join8 } from "path";
|
|
3290
|
+
import { Effect as Effect16 } from "effect";
|
|
3291
|
+
|
|
3292
|
+
// src/library/daily-native-evidence.ts
|
|
3293
|
+
var digest = (value) => typeof value === "string" && /^sha256:[a-f0-9]{64}$/.test(value);
|
|
3294
|
+
var record = (value, keys) => isRecord(value) && hasExactOwnKeys(value, keys);
|
|
3295
|
+
function assertDailyIdentity(identity) {
|
|
3296
|
+
if (!isReleaseTag(identity.tag) || !isGitSha(identity.sourceSha) || identity.workflowSha !== identity.sourceSha || typeof identity.runId !== "string" || !/^[1-9]\d{0,19}$/.test(identity.runId) || !Number.isSafeInteger(identity.runAttempt) || identity.runAttempt <= 0)
|
|
3297
|
+
throw new Error("Invalid exact Daily identity");
|
|
3298
|
+
}
|
|
3299
|
+
function validArtifact(value) {
|
|
3300
|
+
return record(value, ["name", "size", "digest"]) && typeof value.name === "string" && typeof value.size === "number" && Number.isSafeInteger(value.size) && value.size > 0 && digest(value.digest);
|
|
3301
|
+
}
|
|
3302
|
+
function originMatches(value, payloadName) {
|
|
3303
|
+
if (record(value, ["kind", "sourceSha"]))
|
|
3304
|
+
return value.kind === "published-installer" && isGitSha(value.sourceSha);
|
|
3305
|
+
return record(value, ["kind", "sourceSha", "payload"]) && value.kind === "private-from-verified-payload" && isGitSha(value.sourceSha) && validArtifact(value.payload) && value.payload.name === payloadName;
|
|
3306
|
+
}
|
|
3307
|
+
function observationsMatch(value, { identity, check, baselineNames }) {
|
|
3308
|
+
const version = identity.tag.slice(1);
|
|
3309
|
+
if (!record(value, check.format === "command" ? ["install", "command"] : ["install", "launch", "upgrade"]) || !record(value.install, ["version"]) || value.install.version !== version)
|
|
3310
|
+
return false;
|
|
3311
|
+
if (check.format === "command") {
|
|
3312
|
+
const cmd = value.command;
|
|
3313
|
+
return record(cmd, ["version", "probesPassed", "serviceStarted", "serviceStopped"]) && cmd.version === version && cmd.probesPassed === true && cmd.serviceStarted === true && cmd.serviceStopped === (check.platform === "windows-x64" ? "process-tree" : "sigterm");
|
|
3314
|
+
}
|
|
3315
|
+
const { launch, upgrade } = value;
|
|
3316
|
+
return record(launch, ["version", "ready"]) && launch.version === version && launch.ready === true && record(upgrade, [
|
|
3317
|
+
"baselineTag",
|
|
3318
|
+
"baselineAsset",
|
|
3319
|
+
"baselineOrigin",
|
|
3320
|
+
"baselineVersion",
|
|
3321
|
+
"upgradedVersion",
|
|
3322
|
+
"ready",
|
|
3323
|
+
"fixtureBefore",
|
|
3324
|
+
"fixtureAfter"
|
|
3325
|
+
]) && isReleaseTag(upgrade.baselineTag) && versionLessThan(upgrade.baselineTag, identity.tag) && validArtifact(upgrade.baselineAsset) && upgrade.baselineAsset.name === baselineNames(upgrade.baselineTag).installer && originMatches(upgrade.baselineOrigin, baselineNames(upgrade.baselineTag).payload) && upgrade.baselineVersion === upgrade.baselineTag.slice(1) && upgrade.upgradedVersion === version && upgrade.ready === true && digest(upgrade.fixtureBefore) && upgrade.fixtureAfter === upgrade.fixtureBefore;
|
|
3326
|
+
}
|
|
3327
|
+
function validateDailyNativeEvidence(input, schema, context) {
|
|
3328
|
+
const { appId, identity, check, assets } = context;
|
|
3329
|
+
const [os, arch] = platformTargets[check.platform];
|
|
3330
|
+
if (!record(input, [
|
|
3331
|
+
"schema",
|
|
3332
|
+
"appId",
|
|
3333
|
+
"profile",
|
|
3334
|
+
"tag",
|
|
3335
|
+
"sourceSha",
|
|
3336
|
+
"workflowSha",
|
|
3337
|
+
"runId",
|
|
3338
|
+
"runAttempt",
|
|
3339
|
+
"check",
|
|
3340
|
+
"platform",
|
|
3341
|
+
"format",
|
|
3342
|
+
"host",
|
|
3343
|
+
"assets",
|
|
3344
|
+
"observations"
|
|
3345
|
+
]) || input.schema !== schema || input.appId !== appId || input.profile !== "desktop-v1" || input.tag !== identity.tag || input.sourceSha !== identity.sourceSha || input.workflowSha !== identity.workflowSha || input.runId !== identity.runId || input.runAttempt !== identity.runAttempt || input.check !== check.name || input.platform !== check.platform || input.format !== check.format || !record(input.host, ["os", "arch"]) || input.host.os !== os || input.host.arch !== arch || !Array.isArray(input.assets) || input.assets.length !== assets.length)
|
|
3346
|
+
throw new Error(`Native receipt identity or result mismatch: ${check.name}`);
|
|
3347
|
+
for (const expected of assets) {
|
|
3348
|
+
const matches = input.assets.filter((item) => validArtifact(item) && item.name === expected.name);
|
|
3349
|
+
if (matches.length !== 1 || matches[0].size !== expected.size || matches[0].digest !== expected.digest)
|
|
3350
|
+
throw new Error(`Native receipt does not qualify staged bytes: ${check.name} / ${expected.name}`);
|
|
3351
|
+
}
|
|
3352
|
+
if (!observationsMatch(input.observations, context))
|
|
3353
|
+
throw new Error(`Missing or invalid native observations: ${check.name}`);
|
|
3354
|
+
return { host: { os, arch }, observations: input.observations };
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3357
|
+
// src/library/daily-matrix.ts
|
|
3358
|
+
var desktopDailyProfile = "desktop-v1";
|
|
3359
|
+
var platforms = [
|
|
3360
|
+
"macos-arm64",
|
|
3361
|
+
"windows-x64",
|
|
3362
|
+
"linux-x64"
|
|
3363
|
+
];
|
|
3364
|
+
var receiptLimit = 64 * 1024;
|
|
3365
|
+
function requireThat(ok, message) {
|
|
3366
|
+
if (!ok)
|
|
3367
|
+
throw new Error(message);
|
|
3368
|
+
}
|
|
3369
|
+
function planDailyReleaseMatrix(config, tag) {
|
|
3370
|
+
requireThat(isRecord(config) && config.dailyReleaseProfile === desktopDailyProfile && typeof config.appId === "string", "Missing supported Daily release profile");
|
|
3371
|
+
const parsed = parseReleaseConfig(config);
|
|
3372
|
+
const requirements = parsed.requirements(tag);
|
|
3373
|
+
const checks = [];
|
|
3374
|
+
for (const platform of platforms) {
|
|
3375
|
+
const pair = requirements.platforms[platform];
|
|
3376
|
+
requireThat(pair?.length === 2, `Expected installer and updater archive for ${platform}`);
|
|
3377
|
+
const [installer, archive] = pair;
|
|
3378
|
+
const suffix = platform === "macos-arm64" ? ".dmg" : platform === "windows-x64" ? "-Setup.zip" : "-Setup.tar.gz";
|
|
3379
|
+
requireThat(installer.endsWith(suffix) && archive.endsWith(".tar.zst"), `Unexpected desktop installer or updater format for ${platform}`);
|
|
3380
|
+
const format = platform === "macos-arm64" ? "dmg" : platform === "windows-x64" ? "windows-setup" : "portable-linux";
|
|
3381
|
+
checks.push({ name: `installer-${platform}`, platform, format, assets: pair });
|
|
3382
|
+
for (const command of parsed.commandArtifacts) {
|
|
3383
|
+
const name = requirements.commandArtifacts?.[command.kind]?.[platform];
|
|
3384
|
+
requireThat(name, `Missing command archive for ${platform}`);
|
|
3385
|
+
checks.push({
|
|
3386
|
+
name: `command-${command.kind}-${platform}`,
|
|
3387
|
+
platform,
|
|
3388
|
+
format: "command",
|
|
3389
|
+
assets: [name]
|
|
3390
|
+
});
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
const linux = "linux-x64";
|
|
3394
|
+
const base = requirements.platforms[linux][1].slice(0, -".tar.zst".length);
|
|
3395
|
+
checks.push({ name: "deb-linux-x64", platform: linux, format: "deb", assets: [base + ".deb"] }, {
|
|
3396
|
+
name: "appimage-linux-x64",
|
|
3397
|
+
platform: linux,
|
|
3398
|
+
format: "appimage",
|
|
3399
|
+
assets: [base + ".AppImage"]
|
|
3400
|
+
});
|
|
3401
|
+
const names = checks.flatMap((check) => check.assets);
|
|
3402
|
+
discoveryPolicies(config, tag);
|
|
3403
|
+
const all = [...names, ...requirements.releaseAssets];
|
|
3404
|
+
requireThat(new Set(all).size === all.length, "Daily release assets are not unique");
|
|
3405
|
+
return { appId: config.appId, profile: desktopDailyProfile, assets: all, checks };
|
|
3406
|
+
}
|
|
3407
|
+
function priorDailyInstallerNames(config, tag, check) {
|
|
3408
|
+
const plan = planDailyReleaseMatrix(config, tag);
|
|
3409
|
+
return {
|
|
3410
|
+
installer: plan.checks.find((entry) => entry.name === check.name)?.assets[0],
|
|
3411
|
+
payload: plan.checks.find((entry) => entry.name === `installer-${check.platform}`)?.assets[1]
|
|
3412
|
+
};
|
|
3413
|
+
}
|
|
3414
|
+
function exactDirectory(root, names) {
|
|
3415
|
+
return Effect16.gen(function* () {
|
|
3416
|
+
const fs = yield* ReleaseFs;
|
|
3417
|
+
const stat = yield* step(() => fs.lstat(root));
|
|
3418
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
3419
|
+
return yield* fail("Expected real matrix input directory");
|
|
3420
|
+
const entries = yield* step(() => fs.readdir(root, { withFileTypes: true }));
|
|
3421
|
+
const expected = new Set(names);
|
|
3422
|
+
if (entries.length !== expected.size || entries.some((e) => !e.isFile() || !expected.has(e.name)))
|
|
3423
|
+
return yield* fail("Matrix directory must contain exactly the required regular files");
|
|
3424
|
+
});
|
|
3425
|
+
}
|
|
3426
|
+
function readNativeReceipt(path, label) {
|
|
3427
|
+
return Effect16.gen(function* () {
|
|
3428
|
+
const fs = yield* ReleaseFs;
|
|
3429
|
+
const stat = yield* step(() => fs.lstat(path));
|
|
3430
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size < 1 || stat.size > receiptLimit)
|
|
3431
|
+
return yield* fail(`Invalid native receipt size or type: ${label}`);
|
|
3432
|
+
const { file, before } = yield* Effect16.acquireRelease(step(() => openUnchangedFile(path, stat, "Native receipt changed before opening")), ({ file: opened }) => Effect16.promise(() => opened.close().catch(() => {
|
|
3433
|
+
return;
|
|
3434
|
+
})));
|
|
3435
|
+
const data = yield* step(async () => {
|
|
3436
|
+
const bytes = Buffer.alloc(before.size);
|
|
3437
|
+
let offset = 0;
|
|
3438
|
+
while (offset < bytes.length) {
|
|
3439
|
+
const { bytesRead } = await file.read(bytes, offset, bytes.length - offset, offset);
|
|
3440
|
+
if (!bytesRead)
|
|
3441
|
+
throw new Error("Native receipt changed during read");
|
|
3442
|
+
offset += bytesRead;
|
|
3443
|
+
}
|
|
3444
|
+
const after = await file.stat();
|
|
3445
|
+
if (!sameFile(before, after) || before.ctimeMs !== after.ctimeMs)
|
|
3446
|
+
throw new Error("Native receipt changed during read");
|
|
3447
|
+
return bytes.toString("utf8");
|
|
3448
|
+
});
|
|
3449
|
+
return yield* attempt(() => {
|
|
3450
|
+
try {
|
|
3451
|
+
return JSON.parse(data);
|
|
3452
|
+
} catch {
|
|
3453
|
+
throw new Error(`Invalid native receipt JSON: ${label}`);
|
|
3454
|
+
}
|
|
3455
|
+
});
|
|
3456
|
+
}).pipe(Effect16.scoped);
|
|
3457
|
+
}
|
|
3458
|
+
var verifyDailyReleaseMatrixEffect = (options) => Effect16.gen(function* () {
|
|
3459
|
+
const { config, identity, artifacts, receipts } = options;
|
|
3460
|
+
const { tag } = identity;
|
|
3461
|
+
yield* attempt(() => assertDailyIdentity(identity));
|
|
3462
|
+
const matrix = yield* attempt(() => planDailyReleaseMatrix(config, tag));
|
|
3463
|
+
yield* exactDirectory(artifacts, matrix.assets);
|
|
3464
|
+
yield* exactDirectory(receipts, matrix.checks.map((c) => c.name + ".json"));
|
|
3465
|
+
const inventory = new Map;
|
|
3466
|
+
for (const name of matrix.assets)
|
|
3467
|
+
inventory.set(name, yield* fileIdentityEffect(join8(artifacts, name), name));
|
|
3468
|
+
for (const check of matrix.checks) {
|
|
3469
|
+
const r = yield* readNativeReceipt(join8(receipts, check.name + ".json"), check.name);
|
|
3470
|
+
yield* attempt(() => validateDailyNativeEvidence(r, "framework/daily-native-receipt/v2", {
|
|
3471
|
+
appId: matrix.appId,
|
|
3472
|
+
identity,
|
|
3473
|
+
check,
|
|
3474
|
+
assets: check.assets.map((name) => inventory.get(name)),
|
|
3475
|
+
baselineNames: (priorTag) => priorDailyInstallerNames(config, priorTag, check)
|
|
3476
|
+
}));
|
|
3477
|
+
}
|
|
3478
|
+
return {
|
|
3479
|
+
profile: matrix.profile,
|
|
3480
|
+
appId: matrix.appId,
|
|
3481
|
+
identity,
|
|
3482
|
+
assets: [...inventory.values()]
|
|
3483
|
+
};
|
|
3484
|
+
});
|
|
3485
|
+
function verifyDailyReleaseMatrix(options) {
|
|
3486
|
+
return runReleaseLibrary(provideLibraryPorts()(verifyDailyReleaseMatrixEffect(options)));
|
|
3487
|
+
}
|
|
3488
|
+
// src/library/daily-native-receipt.ts
|
|
3489
|
+
import { join as join9 } from "path";
|
|
3490
|
+
import { Effect as Effect17 } from "effect";
|
|
3491
|
+
var createDailyNativeReceiptEffect = (options, worker) => Effect17.gen(function* () {
|
|
3492
|
+
const { config, identity, artifacts, checkName, report } = options;
|
|
3493
|
+
yield* attempt(() => assertDailyIdentity(identity));
|
|
3494
|
+
const matrix = yield* attempt(() => planDailyReleaseMatrix(config, identity.tag));
|
|
3495
|
+
const check = matrix.checks.find(({ name }) => name === checkName);
|
|
3496
|
+
if (!check)
|
|
3497
|
+
return yield* fail("Unknown Daily native check");
|
|
3498
|
+
const [os, arch] = platformTargets[check.platform];
|
|
3499
|
+
if (worker.os !== os || worker.arch !== arch)
|
|
3500
|
+
return yield* fail(`Daily native check requires ${check.platform}`);
|
|
3501
|
+
const fs = yield* ReleaseFs;
|
|
3502
|
+
const dir = yield* step(() => fs.lstat(artifacts));
|
|
3503
|
+
if (!dir.isDirectory() || dir.isSymbolicLink())
|
|
3504
|
+
return yield* fail("Expected real native artifact directory");
|
|
3505
|
+
const assets = yield* Effect17.forEach(check.assets, (name) => fileIdentityEffect(join9(artifacts, name), name));
|
|
3506
|
+
const evidence = yield* attempt(() => validateDailyNativeEvidence(report, "framework/daily-native-job/v1", {
|
|
3507
|
+
appId: matrix.appId,
|
|
3508
|
+
identity,
|
|
3509
|
+
check,
|
|
3510
|
+
assets,
|
|
3511
|
+
baselineNames: (tag) => priorDailyInstallerNames(config, tag, check)
|
|
3512
|
+
}));
|
|
3513
|
+
if ("upgrade" in evidence.observations) {
|
|
3514
|
+
if (!options.baselineArtifacts)
|
|
3515
|
+
return yield* fail("Daily desktop check requires the exact baseline installer");
|
|
3516
|
+
const baselineDirectory = options.baselineArtifacts;
|
|
3517
|
+
const info = yield* step(() => fs.lstat(baselineDirectory));
|
|
3518
|
+
if (!info.isDirectory() || info.isSymbolicLink())
|
|
3519
|
+
return yield* fail("Expected real native baseline directory");
|
|
3520
|
+
const { baselineAsset, baselineOrigin } = evidence.observations.upgrade;
|
|
3521
|
+
const proofFiles = baselineOrigin.kind === "private-from-verified-payload" ? [baselineAsset, baselineOrigin.payload] : [baselineAsset];
|
|
3522
|
+
for (const expected of proofFiles) {
|
|
3523
|
+
const observed = yield* fileIdentityEffect(join9(baselineDirectory, expected.name), expected.name);
|
|
3524
|
+
if (observed.size !== expected.size || observed.digest !== expected.digest)
|
|
3525
|
+
return yield* fail("Daily desktop baseline installer or prior payload differs from native observations");
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return {
|
|
3529
|
+
...identity,
|
|
3530
|
+
...evidence,
|
|
3531
|
+
schema: "framework/daily-native-receipt/v2",
|
|
3532
|
+
appId: matrix.appId,
|
|
3533
|
+
profile: matrix.profile,
|
|
3534
|
+
check: check.name,
|
|
3535
|
+
platform: check.platform,
|
|
3536
|
+
format: check.format,
|
|
3537
|
+
assets
|
|
3538
|
+
};
|
|
3539
|
+
});
|
|
3540
|
+
function createDailyNativeReceipt(options) {
|
|
3541
|
+
return runReleaseLibrary(provideLibraryPorts()(createDailyNativeReceiptEffect(options, {
|
|
3542
|
+
os: process.platform,
|
|
3543
|
+
arch: process.arch
|
|
3544
|
+
})));
|
|
3545
|
+
}
|
|
3281
3546
|
// src/library/macos-dmg.ts
|
|
3282
3547
|
import { execFileSync } from "child_process";
|
|
3283
3548
|
import {
|
|
@@ -3289,8 +3554,8 @@ import {
|
|
|
3289
3554
|
rmSync,
|
|
3290
3555
|
symlinkSync
|
|
3291
3556
|
} from "fs";
|
|
3292
|
-
import { basename as basename4, dirname, join as
|
|
3293
|
-
import { Context as Context2, Effect as
|
|
3557
|
+
import { basename as basename4, dirname, join as join10, resolve as resolve6 } from "path";
|
|
3558
|
+
import { Context as Context2, Effect as Effect18 } from "effect";
|
|
3294
3559
|
|
|
3295
3560
|
// ../../src/release/macos-dmg.ts
|
|
3296
3561
|
var MIB = 1024 * 1024;
|
|
@@ -3321,7 +3586,7 @@ function treeSize(root) {
|
|
|
3321
3586
|
logicalBytes += info.size;
|
|
3322
3587
|
else if (info.isDirectory())
|
|
3323
3588
|
for (const name of readdirSync(path))
|
|
3324
|
-
pending.push(
|
|
3589
|
+
pending.push(join10(path, name));
|
|
3325
3590
|
else if (!info.isSymbolicLink())
|
|
3326
3591
|
throw new Error("Unsupported disk image entry");
|
|
3327
3592
|
if (!Number.isSafeInteger(logicalBytes))
|
|
@@ -3329,16 +3594,16 @@ function treeSize(root) {
|
|
|
3329
3594
|
}
|
|
3330
3595
|
return { logicalBytes, entries };
|
|
3331
3596
|
}
|
|
3332
|
-
var verifyImageEffect = (image) =>
|
|
3597
|
+
var verifyImageEffect = (image) => Effect18.gen(function* () {
|
|
3333
3598
|
const host = yield* MacosHost;
|
|
3334
3599
|
for (let tries = 1;; tries++) {
|
|
3335
|
-
const verified = yield* attempt(() => host.run("/usr/bin/hdiutil", ["verify", image])).pipe(
|
|
3600
|
+
const verified = yield* attempt(() => host.run("/usr/bin/hdiutil", ["verify", image])).pipe(Effect18.as(true), Effect18.catchIf(() => tries < 6, () => Effect18.succeed(false)));
|
|
3336
3601
|
if (verified)
|
|
3337
3602
|
return;
|
|
3338
3603
|
host.wait(5000 * 2 ** (tries - 1));
|
|
3339
3604
|
}
|
|
3340
3605
|
});
|
|
3341
|
-
var createMacosDmgEffect = (options) =>
|
|
3606
|
+
var createMacosDmgEffect = (options) => Effect18.gen(function* () {
|
|
3342
3607
|
const host = yield* MacosHost;
|
|
3343
3608
|
if (host.platform !== "darwin")
|
|
3344
3609
|
return yield* fail("Disk image creation requires macOS");
|
|
@@ -3347,11 +3612,11 @@ var createMacosDmgEffect = (options) => Effect16.gen(function* () {
|
|
|
3347
3612
|
const info = yield* attempt(() => lstatSync(app));
|
|
3348
3613
|
if (!app.endsWith(".app") || !info.isDirectory() || info.isSymbolicLink() || !output.endsWith(".dmg"))
|
|
3349
3614
|
return yield* fail("Invalid disk image paths");
|
|
3350
|
-
const staging = yield*
|
|
3351
|
-
const payload =
|
|
3615
|
+
const staging = yield* Effect18.acquireRelease(attempt(() => mkdtempSync(join10(dirname(output), ".framework-dmg-"))), (path) => Effect18.sync(() => rmSync(path, { recursive: true, force: true })));
|
|
3616
|
+
const payload = join10(staging, "payload"), image = join10(staging, "result.dmg");
|
|
3352
3617
|
yield* attempt(() => mkdirSync(payload));
|
|
3353
|
-
yield* attempt(() => host.run("/usr/bin/ditto", [app,
|
|
3354
|
-
yield* attempt(() => symlinkSync("/Applications",
|
|
3618
|
+
yield* attempt(() => host.run("/usr/bin/ditto", [app, join10(payload, basename4(app))]));
|
|
3619
|
+
yield* attempt(() => symlinkSync("/Applications", join10(payload, "Applications")));
|
|
3355
3620
|
const capacityMiB = yield* attempt(() => dmgCapacityMiB(treeSize(payload)));
|
|
3356
3621
|
yield* attempt(() => host.run("/usr/bin/hdiutil", [
|
|
3357
3622
|
"create",
|
|
@@ -3368,31 +3633,31 @@ var createMacosDmgEffect = (options) => Effect16.gen(function* () {
|
|
|
3368
3633
|
yield* verifyImageEffect(image);
|
|
3369
3634
|
yield* attempt(() => linkSync(image, output));
|
|
3370
3635
|
return { capacityMiB };
|
|
3371
|
-
}).pipe(
|
|
3636
|
+
}).pipe(Effect18.scoped);
|
|
3372
3637
|
function verifyImage(image, io = liveHost) {
|
|
3373
|
-
runReleaseLibrarySync(verifyImageEffect(image).pipe(
|
|
3638
|
+
runReleaseLibrarySync(verifyImageEffect(image).pipe(Effect18.provideService(MacosHost, {
|
|
3374
3639
|
run: (command, args) => io.run(command, args),
|
|
3375
3640
|
wait: (milliseconds) => io.wait(milliseconds),
|
|
3376
3641
|
platform: process.platform
|
|
3377
3642
|
})));
|
|
3378
3643
|
}
|
|
3379
3644
|
function createMacosDmg(options) {
|
|
3380
|
-
return runReleaseLibrarySync(createMacosDmgEffect(options).pipe(
|
|
3645
|
+
return runReleaseLibrarySync(createMacosDmgEffect(options).pipe(Effect18.provideService(MacosHost, liveHost)));
|
|
3381
3646
|
}
|
|
3382
3647
|
// src/library/qualification-run.ts
|
|
3383
|
-
import { Effect as
|
|
3648
|
+
import { Effect as Effect21 } from "effect";
|
|
3384
3649
|
|
|
3385
3650
|
// src/library/local-release.ts
|
|
3386
3651
|
import { createHash as createHash8 } from "crypto";
|
|
3387
3652
|
import { constants as constants3 } from "fs";
|
|
3388
|
-
import { dirname as dirname2, join as
|
|
3389
|
-
import { Cause as Cause2, Effect as
|
|
3653
|
+
import { dirname as dirname2, join as join12, resolve as resolve8 } from "path";
|
|
3654
|
+
import { Cause as Cause2, Effect as Effect20, Exit as Exit3 } from "effect";
|
|
3390
3655
|
|
|
3391
3656
|
// ../../src/native/native-rename.ts
|
|
3392
3657
|
import { randomUUID } from "crypto";
|
|
3393
3658
|
import { mkdir as mkdir3, readFile as readFile5, rm as rm3, writeFile as writeFile3 } from "fs/promises";
|
|
3394
3659
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
3395
|
-
import { join as
|
|
3660
|
+
import { join as join11 } from "path";
|
|
3396
3661
|
|
|
3397
3662
|
// ../../src/native/canonical-path.ts
|
|
3398
3663
|
import { isAbsolute as isAbsolute2, resolve as resolve7 } from "path";
|
|
@@ -3471,8 +3736,8 @@ async function probeDirectoryExchange(parent, exchange = exchangeDirectories) {
|
|
|
3471
3736
|
if (!isCanonicalPath(parent))
|
|
3472
3737
|
throw new Error("Invalid directory exchange probe parent");
|
|
3473
3738
|
const id = randomUUID();
|
|
3474
|
-
const first =
|
|
3475
|
-
const second =
|
|
3739
|
+
const first = join11(parent, `.framework-exchange-probe-${id}-a`);
|
|
3740
|
+
const second = join11(parent, `.framework-exchange-probe-${id}-b`);
|
|
3476
3741
|
const marker = "exchange-probe";
|
|
3477
3742
|
const firstValue = `${id}:first`;
|
|
3478
3743
|
const secondValue = `${id}:second`;
|
|
@@ -3483,12 +3748,12 @@ async function probeDirectoryExchange(parent, exchange = exchangeDirectories) {
|
|
|
3483
3748
|
firstCreated = true;
|
|
3484
3749
|
await mkdir3(second, { mode: 448 });
|
|
3485
3750
|
secondCreated = true;
|
|
3486
|
-
await writeFile3(
|
|
3487
|
-
await writeFile3(
|
|
3751
|
+
await writeFile3(join11(first, marker), firstValue, { flag: "wx", mode: 384 });
|
|
3752
|
+
await writeFile3(join11(second, marker), secondValue, { flag: "wx", mode: 384 });
|
|
3488
3753
|
exchange(first, second);
|
|
3489
3754
|
const [firstAfter, secondAfter] = await Promise.all([
|
|
3490
|
-
readFile5(
|
|
3491
|
-
readFile5(
|
|
3755
|
+
readFile5(join11(first, marker), "utf8"),
|
|
3756
|
+
readFile5(join11(second, marker), "utf8")
|
|
3492
3757
|
]);
|
|
3493
3758
|
if (firstAfter !== secondValue || secondAfter !== firstValue)
|
|
3494
3759
|
throw new Error("Directory exchange did not exchange both probe trees");
|
|
@@ -3554,7 +3819,7 @@ function createFeedReleaseCutProvider(options) {
|
|
|
3554
3819
|
|
|
3555
3820
|
// src/library/feed-state.ts
|
|
3556
3821
|
import { createHash as createHash7 } from "crypto";
|
|
3557
|
-
import { Effect as
|
|
3822
|
+
import { Effect as Effect19 } from "effect";
|
|
3558
3823
|
|
|
3559
3824
|
// ../../src/shared/discard-stream.ts
|
|
3560
3825
|
function discardStream(stream) {
|
|
@@ -3714,11 +3979,11 @@ var json = (bytes) => {
|
|
|
3714
3979
|
throw new Error("Invalid release feed response");
|
|
3715
3980
|
}
|
|
3716
3981
|
};
|
|
3717
|
-
var feedObject = (feed, path, maximum) =>
|
|
3982
|
+
var feedObject = (feed, path, maximum) => Effect19.gen(function* () {
|
|
3718
3983
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
3719
3984
|
return yield* step(() => readFeedObject(feed, path, fetch2, maximum));
|
|
3720
3985
|
});
|
|
3721
|
-
var readFeedLedgerEffect = (feed) =>
|
|
3986
|
+
var readFeedLedgerEffect = (feed) => Effect19.gen(function* () {
|
|
3722
3987
|
const bytes = yield* feedObject(feed, "index.json", MAX_LEDGER_BYTES);
|
|
3723
3988
|
const ledger = bytes ? yield* attempt(() => parseReleaseLedger(json(bytes), feed.app)) : null;
|
|
3724
3989
|
if (ledger && ledger.releases.length > 0)
|
|
@@ -3730,7 +3995,7 @@ var readFeedLedgerEffect = (feed) => Effect17.gen(function* () {
|
|
|
3730
3995
|
}
|
|
3731
3996
|
return ledger ?? { schema: 1, app: feed.app, releases: [] };
|
|
3732
3997
|
});
|
|
3733
|
-
var readFeedReleaseEffect = (feed, tag) =>
|
|
3998
|
+
var readFeedReleaseEffect = (feed, tag) => Effect19.gen(function* () {
|
|
3734
3999
|
const bytes = yield* feedObject(feed, `${tag}/release.json`, MAX_RELEASE_BYTES);
|
|
3735
4000
|
if (!bytes)
|
|
3736
4001
|
return null;
|
|
@@ -3780,10 +4045,10 @@ class ReleaseFeedSnapshotChanged extends Error {
|
|
|
3780
4045
|
var snapshotChanged = step(async () => {
|
|
3781
4046
|
throw new ReleaseFeedSnapshotChanged;
|
|
3782
4047
|
});
|
|
3783
|
-
var verifyFeedReleaseEffect = (options) =>
|
|
4048
|
+
var verifyFeedReleaseEffect = (options) => Effect19.gen(function* () {
|
|
3784
4049
|
const { config, feed, tag } = options;
|
|
3785
4050
|
const { fetch: fetcher } = yield* ReleaseFetch;
|
|
3786
|
-
const ledger = yield* readFeedLedgerEffect(feed).pipe(
|
|
4051
|
+
const ledger = yield* readFeedLedgerEffect(feed).pipe(Effect19.catchIf(() => options.expectedLedger !== undefined, () => snapshotChanged));
|
|
3787
4052
|
if (options.expectedLedger && JSON.stringify(ledger) !== JSON.stringify(options.expectedLedger))
|
|
3788
4053
|
return yield* snapshotChanged;
|
|
3789
4054
|
const release = yield* readFeedReleaseEffect(feed, tag);
|
|
@@ -3846,13 +4111,13 @@ var timestamp2 = (value) => {
|
|
|
3846
4111
|
throw new Error("Invalid release clock");
|
|
3847
4112
|
return new Date(value).toISOString();
|
|
3848
4113
|
};
|
|
3849
|
-
var exactFiles = (directory, names) =>
|
|
4114
|
+
var exactFiles = (directory, names) => Effect20.gen(function* () {
|
|
3850
4115
|
const fs = yield* ReleaseFs;
|
|
3851
4116
|
const entries = yield* step(() => fs.readdir(directory, { withFileTypes: true }));
|
|
3852
4117
|
if (entries.length !== names.length || entries.some((entry) => !entry.isFile() || !names.includes(entry.name)))
|
|
3853
4118
|
return yield* fail("Staged directory does not hold exactly the platform release files");
|
|
3854
4119
|
});
|
|
3855
|
-
var promised2 =
|
|
4120
|
+
var promised2 = Effect20.gen(function* () {
|
|
3856
4121
|
const fs = yield* ReleaseFs;
|
|
3857
4122
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
3858
4123
|
const { run: git } = yield* ReleaseGit;
|
|
@@ -3862,7 +4127,7 @@ var promised2 = Effect18.gen(function* () {
|
|
|
3862
4127
|
run: (effect) => runReleaseLibrary(provideLibraryPorts({ fs, fetch: fetch2, git })(effect))
|
|
3863
4128
|
};
|
|
3864
4129
|
});
|
|
3865
|
-
var runLocalReleaseCutEffect = (options) =>
|
|
4130
|
+
var runLocalReleaseCutEffect = (options) => Effect20.gen(function* () {
|
|
3866
4131
|
const { kind, platform } = options;
|
|
3867
4132
|
const parsed = parseReleaseConfig(options.config);
|
|
3868
4133
|
const provenance = yield* resolveLocalProvenanceEffect({
|
|
@@ -3887,7 +4152,7 @@ var runLocalReleaseCutEffect = (options) => Effect18.gen(function* () {
|
|
|
3887
4152
|
}));
|
|
3888
4153
|
return { ...result, version: result.tag.slice(1), platform };
|
|
3889
4154
|
});
|
|
3890
|
-
var localTagProvenanceEffect = (options) =>
|
|
4155
|
+
var localTagProvenanceEffect = (options) => Effect20.gen(function* () {
|
|
3891
4156
|
const parsed = parseReleaseConfig(options.config);
|
|
3892
4157
|
parsed.requirements(options.tag);
|
|
3893
4158
|
const provenance = yield* resolveLocalProvenanceEffect({
|
|
@@ -3898,7 +4163,7 @@ var localTagProvenanceEffect = (options) => Effect18.gen(function* () {
|
|
|
3898
4163
|
return yield* fail("Release tag does not belong to the source version");
|
|
3899
4164
|
return { repository: provenance.repository };
|
|
3900
4165
|
});
|
|
3901
|
-
var stageLocalDescriptorsEffect = (options) =>
|
|
4166
|
+
var stageLocalDescriptorsEffect = (options) => Effect20.gen(function* () {
|
|
3902
4167
|
const { tag, platform } = options;
|
|
3903
4168
|
const local = localConfig(options.config);
|
|
3904
4169
|
if (!/^[1-9]\d{0,19}$/.test(options.runId) || !isGitSha(options.sourceSha))
|
|
@@ -3907,7 +4172,7 @@ var stageLocalDescriptorsEffect = (options) => Effect18.gen(function* () {
|
|
|
3907
4172
|
const payloads = platformPayloads(local.requirements(tag), platform);
|
|
3908
4173
|
const directory = resolve8(options.directory);
|
|
3909
4174
|
yield* exactFiles(directory, payloads);
|
|
3910
|
-
const assets = yield*
|
|
4175
|
+
const assets = yield* Effect20.forEach(payloads, (name) => fileIdentityEffect(join12(directory, name), name), { concurrency: "unbounded" });
|
|
3911
4176
|
const signed = signDiscoveryDescriptors({
|
|
3912
4177
|
policies: discoveryPolicies(local.config, tag).filter((policy) => policy.platform === platform),
|
|
3913
4178
|
assets,
|
|
@@ -3925,7 +4190,7 @@ var stageLocalDescriptorsEffect = (options) => Effect18.gen(function* () {
|
|
|
3925
4190
|
privateKey: options.privateKey
|
|
3926
4191
|
});
|
|
3927
4192
|
for (const asset of assets)
|
|
3928
|
-
if (JSON.stringify(yield* fileIdentityEffect(
|
|
4193
|
+
if (JSON.stringify(yield* fileIdentityEffect(join12(directory, asset.name), asset.name)) !== JSON.stringify(asset))
|
|
3929
4194
|
return yield* fail("Staged payload changed before signing");
|
|
3930
4195
|
yield* writeDescriptorsEffect(directory, signed);
|
|
3931
4196
|
return signed.map((value) => value.name);
|
|
@@ -3949,18 +4214,18 @@ var describe = (key, bytes, cacheControl) => ({
|
|
|
3949
4214
|
contentType: "application/json",
|
|
3950
4215
|
cacheControl
|
|
3951
4216
|
});
|
|
3952
|
-
var writeStagedTree = (out, feed, assets, documents) =>
|
|
4217
|
+
var writeStagedTree = (out, feed, assets, documents) => Effect20.gen(function* () {
|
|
3953
4218
|
const fs = yield* ReleaseFs;
|
|
3954
4219
|
const root = resolve8(out);
|
|
3955
|
-
const exists = yield* step(() => fs.lstat(root)).pipe(
|
|
4220
|
+
const exists = yield* step(() => fs.lstat(root)).pipe(Effect20.as(true), Effect20.catchIf((failure) => errorCode(failure.original) === "ENOENT", () => Effect20.succeed(false)));
|
|
3956
4221
|
if (exists)
|
|
3957
4222
|
return yield* fail("Release output directory already exists");
|
|
3958
4223
|
yield* step(() => fs.mkdir(dirname2(root), { recursive: true, mode: 448 }));
|
|
3959
|
-
const staging = yield* step(() => fs.mkdtemp(
|
|
3960
|
-
const exit = yield*
|
|
4224
|
+
const staging = yield* step(() => fs.mkdtemp(join12(dirname2(root), ".release-staging-")));
|
|
4225
|
+
const exit = yield* Effect20.exit(Effect20.gen(function* () {
|
|
3961
4226
|
const objects = [];
|
|
3962
4227
|
for (const { key, path, artifact } of assets) {
|
|
3963
|
-
const target =
|
|
4228
|
+
const target = join12(staging, key);
|
|
3964
4229
|
yield* step(() => fs.mkdir(dirname2(target), { recursive: true, mode: 448 }));
|
|
3965
4230
|
yield* step(() => fs.copyFile(path, target, constants3.COPYFILE_EXCL));
|
|
3966
4231
|
if (JSON.stringify(yield* fileIdentityEffect(target, artifact.name)) !== JSON.stringify(artifact))
|
|
@@ -3974,13 +4239,13 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
|
|
|
3974
4239
|
});
|
|
3975
4240
|
}
|
|
3976
4241
|
for (const { key, bytes } of documents) {
|
|
3977
|
-
const target =
|
|
4242
|
+
const target = join12(staging, key);
|
|
3978
4243
|
yield* step(() => fs.mkdir(dirname2(target), { recursive: true, mode: 448 }));
|
|
3979
4244
|
yield* step(() => fs.writeFile(target, bytes, { flag: "wx", mode: 384 }));
|
|
3980
4245
|
objects.push(describe(key, bytes, MUTABLE));
|
|
3981
4246
|
}
|
|
3982
4247
|
const plan = { schema: 1, base: feed.base, objects };
|
|
3983
|
-
yield* step(() => fs.writeFile(
|
|
4248
|
+
yield* step(() => fs.writeFile(join12(staging, UPLOAD_PLAN), jsonBytes(plan), { flag: "wx", mode: 384 }));
|
|
3984
4249
|
yield* attempt(() => renameExclusive(staging, root));
|
|
3985
4250
|
return plan;
|
|
3986
4251
|
}));
|
|
@@ -3988,10 +4253,10 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
|
|
|
3988
4253
|
return exit.value;
|
|
3989
4254
|
const error = Cause2.squash(exit.cause);
|
|
3990
4255
|
const original = error instanceof ReleaseFailure ? error.original ?? error : error;
|
|
3991
|
-
const cleanup = yield*
|
|
4256
|
+
const cleanup = yield* Effect20.exit(step(() => fs.rm(staging, { recursive: true, force: true })));
|
|
3992
4257
|
if (Exit3.isFailure(cleanup)) {
|
|
3993
4258
|
const cleanupError = Cause2.squash(cleanup.cause);
|
|
3994
|
-
return yield*
|
|
4259
|
+
return yield* Effect20.fail(new ReleaseFailure({
|
|
3995
4260
|
reason: "cleanup",
|
|
3996
4261
|
message: "Release staging failed and its private temporary tree could not be removed",
|
|
3997
4262
|
original: new AggregateError([
|
|
@@ -4000,8 +4265,8 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
|
|
|
4000
4265
|
], "Release staging failed and its private temporary tree could not be removed", { cause: original })
|
|
4001
4266
|
}));
|
|
4002
4267
|
}
|
|
4003
|
-
return yield*
|
|
4004
|
-
}).pipe(
|
|
4268
|
+
return yield* Effect20.failCause(exit.cause);
|
|
4269
|
+
}).pipe(Effect20.uninterruptible);
|
|
4005
4270
|
function releaseDocuments(feed, ledger, release) {
|
|
4006
4271
|
return [
|
|
4007
4272
|
{ key: feedReleaseKey(feed, release.tag), bytes: jsonBytes(release) },
|
|
@@ -4018,7 +4283,7 @@ function releaseDocuments(feed, ledger, release) {
|
|
|
4018
4283
|
}))
|
|
4019
4284
|
];
|
|
4020
4285
|
}
|
|
4021
|
-
var stageLocalReleaseEffect = (options) =>
|
|
4286
|
+
var stageLocalReleaseEffect = (options) => Effect20.gen(function* () {
|
|
4022
4287
|
const fs = yield* ReleaseFs;
|
|
4023
4288
|
const { tag, sourceSha, platform } = options;
|
|
4024
4289
|
const local = localConfig(options.config);
|
|
@@ -4028,12 +4293,12 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
4028
4293
|
const directory = resolve8(options.directory);
|
|
4029
4294
|
const names = [...payloads, ...policies.map((policy) => policy.name)];
|
|
4030
4295
|
yield* exactFiles(directory, names);
|
|
4031
|
-
const staged = yield*
|
|
4296
|
+
const staged = yield* Effect20.forEach(names, (name) => fileIdentityEffect(join12(directory, name), name), { concurrency: "unbounded" });
|
|
4032
4297
|
for (const policy of policies) {
|
|
4033
4298
|
const artifact = staged.find((asset) => asset.name === policy.name);
|
|
4034
4299
|
if (artifact.size > 65536)
|
|
4035
4300
|
return yield* fail("Signed descriptor is too large");
|
|
4036
|
-
const bytes = yield* step(() => fs.readFile(
|
|
4301
|
+
const bytes = yield* step(() => fs.readFile(join12(directory, policy.name)));
|
|
4037
4302
|
if ("sha256:" + createHash8("sha256").update(bytes).digest("hex") !== artifact.digest)
|
|
4038
4303
|
return yield* fail("Signed descriptor changed");
|
|
4039
4304
|
let parsed;
|
|
@@ -4055,7 +4320,7 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
4055
4320
|
if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.sourceSha !== sourceSha || verified.descriptor.workflowSha !== sourceSha || verified.descriptor.asset.name !== payload.name || verified.descriptor.asset.size !== payload.size || "sha256:" + verified.descriptor.asset.sha256 !== payload.digest)
|
|
4056
4321
|
return yield* fail(`Untrusted signed descriptor: ${policy.name}`);
|
|
4057
4322
|
}
|
|
4058
|
-
const [ledger, remote] = yield*
|
|
4323
|
+
const [ledger, remote] = yield* Effect20.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, tag)], { concurrency: "unbounded" });
|
|
4059
4324
|
const entry = ledger.releases.find((item) => item.tag === tag);
|
|
4060
4325
|
if (Boolean(entry) !== Boolean(remote) || entry && remote && (entry.kind !== remote.channel || Date.parse(entry.publishedAt) !== Date.parse(remote.publishedAt)))
|
|
4061
4326
|
return yield* fail("Inconsistent feed release; reconcile publication before retrying");
|
|
@@ -4073,7 +4338,7 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
4073
4338
|
merged.push({ name: artifact.name, size: artifact.size, sha256: artifact.digest.slice(7) });
|
|
4074
4339
|
uploads.push({
|
|
4075
4340
|
key: feedAssetKey(feed, tag, artifact.name),
|
|
4076
|
-
path:
|
|
4341
|
+
path: join12(directory, artifact.name),
|
|
4077
4342
|
artifact
|
|
4078
4343
|
});
|
|
4079
4344
|
}
|
|
@@ -4106,7 +4371,7 @@ function stablePlatforms(config) {
|
|
|
4106
4371
|
throw new Error("Invalid stablePlatforms in the release configuration");
|
|
4107
4372
|
return value;
|
|
4108
4373
|
}
|
|
4109
|
-
var verifyLocalReleaseEffect = (options) =>
|
|
4374
|
+
var verifyLocalReleaseEffect = (options) => Effect20.gen(function* () {
|
|
4110
4375
|
const local = localConfig(options.config);
|
|
4111
4376
|
const { release, platforms } = yield* verifyFeedReleaseEffect({
|
|
4112
4377
|
config: local.config,
|
|
@@ -4122,7 +4387,7 @@ var verifyLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
4122
4387
|
missing: Object.keys(platformTargets).filter((platform) => !platforms.includes(platform))
|
|
4123
4388
|
};
|
|
4124
4389
|
});
|
|
4125
|
-
var runLocalPromotionEffect = (options) =>
|
|
4390
|
+
var runLocalPromotionEffect = (options) => Effect20.gen(function* () {
|
|
4126
4391
|
const local = localConfig(options.config);
|
|
4127
4392
|
const feed = local.feed;
|
|
4128
4393
|
const required = stablePlatforms(local.config);
|
|
@@ -4180,7 +4445,7 @@ var runLocalPromotionEffect = (options) => Effect18.gen(function* () {
|
|
|
4180
4445
|
const verification = qualified.get(selected.tag);
|
|
4181
4446
|
const absent = Object.keys(platformTargets).filter((name) => !verification?.platforms.includes(name));
|
|
4182
4447
|
const entry = ledger.releases.find((item) => item.tag === selected.tag);
|
|
4183
|
-
const [currentLedger, remote] = await run(
|
|
4448
|
+
const [currentLedger, remote] = await run(Effect20.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, selected.tag)], {
|
|
4184
4449
|
concurrency: "unbounded"
|
|
4185
4450
|
}));
|
|
4186
4451
|
if (!entry || !remote || !verification || entry.kind === "dev" || JSON.stringify(currentLedger) !== JSON.stringify(ledger) || JSON.stringify(remote) !== JSON.stringify(verification.release))
|
|
@@ -4219,7 +4484,7 @@ var runLocalPromotionEffect = (options) => Effect18.gen(function* () {
|
|
|
4219
4484
|
|
|
4220
4485
|
// src/library/qualification-run.ts
|
|
4221
4486
|
var REFUSAL = "Qualification requires a GitHub release-assets run, a GitLab tag pipeline or a CircleCI tag workflow";
|
|
4222
|
-
var tagRun = (options) =>
|
|
4487
|
+
var tagRun = (options) => Effect21.gen(function* () {
|
|
4223
4488
|
const { tag, sha, runId } = options;
|
|
4224
4489
|
if (options.tagName !== tag || !isGitSha(sha) || !/^[1-9]\d{0,19}$/.test(runId ?? "") || !/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65)
|
|
4225
4490
|
return yield* fail(REFUSAL);
|
|
@@ -4233,7 +4498,7 @@ var tagRun = (options) => Effect19.gen(function* () {
|
|
|
4233
4498
|
runAttempt: 1
|
|
4234
4499
|
};
|
|
4235
4500
|
});
|
|
4236
|
-
var planQualificationRunEffect = (options) =>
|
|
4501
|
+
var planQualificationRunEffect = (options) => Effect21.gen(function* () {
|
|
4237
4502
|
const { env, config, tag } = options;
|
|
4238
4503
|
if (env.GITHUB_ACTIONS === "true") {
|
|
4239
4504
|
const plan = yield* planReleaseAssetsEffect({ env, config, tag });
|
|
@@ -4266,8 +4531,8 @@ var planQualificationRun2 = (options) => runReleaseLibrary(provideLibraryPorts({
|
|
|
4266
4531
|
...options.git ? { git: options.git } : {}
|
|
4267
4532
|
})(planQualificationRunEffect(options)));
|
|
4268
4533
|
// src/library/retained-build.ts
|
|
4269
|
-
import { Effect as
|
|
4270
|
-
var id = (value) =>
|
|
4534
|
+
import { Effect as Effect22 } from "effect";
|
|
4535
|
+
var id = (value) => Effect22.gen(function* () {
|
|
4271
4536
|
if (typeof value === "number" && !Number.isSafeInteger(value))
|
|
4272
4537
|
return yield* fail("Invalid GitHub identity");
|
|
4273
4538
|
const text = String(value);
|
|
@@ -4275,7 +4540,7 @@ var id = (value) => Effect20.gen(function* () {
|
|
|
4275
4540
|
return yield* fail("Invalid GitHub identity");
|
|
4276
4541
|
return text;
|
|
4277
4542
|
});
|
|
4278
|
-
var selectRetainedReleaseBuildEffect = (options) =>
|
|
4543
|
+
var selectRetainedReleaseBuildEffect = (options) => Effect22.gen(function* () {
|
|
4279
4544
|
const { env, config, tag, platform } = options;
|
|
4280
4545
|
if (!["macos-arm64", "windows-x64", "linux-x64"].includes(platform) || !isRecord(config) || typeof config.appName !== "string" || env.RELEASE_TAG !== tag)
|
|
4281
4546
|
return yield* fail("Invalid retained build context");
|
|
@@ -4394,9 +4659,9 @@ var selectRetainedReleaseBuildEffect = (options) => Effect20.gen(function* () {
|
|
|
4394
4659
|
var selectRetainedReleaseBuild = (options) => runReleaseLibrary(provideLibraryPorts({ run: planGitHubRun(options.env, options.run) })(selectRetainedReleaseBuildEffect(options)));
|
|
4395
4660
|
// src/library/staging.ts
|
|
4396
4661
|
import { createHash as createHash9 } from "crypto";
|
|
4397
|
-
import { join as
|
|
4398
|
-
import { Effect as
|
|
4399
|
-
var copyHashed = (input, output, size) =>
|
|
4662
|
+
import { join as join13, resolve as resolve9 } from "path";
|
|
4663
|
+
import { Effect as Effect23 } from "effect";
|
|
4664
|
+
var copyHashed = (input, output, size) => Effect23.tryPromise({
|
|
4400
4665
|
try: async (signal) => {
|
|
4401
4666
|
const hash = createHash9("sha256");
|
|
4402
4667
|
let copied = 0;
|
|
@@ -4425,15 +4690,14 @@ var copyHashed = (input, output, size) => Effect21.tryPromise({
|
|
|
4425
4690
|
original: error
|
|
4426
4691
|
})
|
|
4427
4692
|
});
|
|
4428
|
-
var
|
|
4693
|
+
var stageExpectedFilesEffect = (options) => Effect23.gen(function* () {
|
|
4429
4694
|
const fs = yield* ReleaseFs;
|
|
4430
|
-
const
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
return yield* fail("Platform staging sources do not match release configuration");
|
|
4695
|
+
const { expected } = options;
|
|
4696
|
+
if (!expected.length || new Set(expected).size !== expected.length || expected.some((name) => !/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(name)) || Object.keys(options.sources).length !== expected.length || expected.some((name) => !Object.hasOwn(options.sources, name)))
|
|
4697
|
+
return yield* fail("Staging sources do not match expected filenames");
|
|
4434
4698
|
const directory = resolve9(options.directory);
|
|
4435
4699
|
const created = [];
|
|
4436
|
-
const stage =
|
|
4700
|
+
const stage = Effect23.forEach(expected, (name) => Effect23.gen(function* () {
|
|
4437
4701
|
const sourcePath = options.sources[name];
|
|
4438
4702
|
if (typeof sourcePath !== "string" || !sourcePath)
|
|
4439
4703
|
return yield* fail("Invalid staging source");
|
|
@@ -4444,7 +4708,7 @@ var stagePlatformArtifactsEffect = (options) => Effect21.gen(function* () {
|
|
|
4444
4708
|
const before = yield* step(() => input.stat());
|
|
4445
4709
|
if (!before.isFile() || before.dev !== sourceInfo.dev || before.ino !== sourceInfo.ino || before.size !== sourceInfo.size)
|
|
4446
4710
|
return yield* fail("Staging source changed");
|
|
4447
|
-
const target =
|
|
4711
|
+
const target = join13(directory, name);
|
|
4448
4712
|
const output = yield* scopedHandle(() => fs.open(target, "wx"));
|
|
4449
4713
|
created.push(target);
|
|
4450
4714
|
const copied = yield* copyHashed(input, output, before.size);
|
|
@@ -4453,13 +4717,20 @@ var stagePlatformArtifactsEffect = (options) => Effect21.gen(function* () {
|
|
|
4453
4717
|
if (copied.size !== before.size || after.size !== before.size || after.mtimeMs !== before.mtimeMs || after.dev !== before.dev || after.ino !== before.ino)
|
|
4454
4718
|
return yield* fail("Staging source changed");
|
|
4455
4719
|
return { name, size: copied.size, digest: copied.digest };
|
|
4456
|
-
}).pipe(
|
|
4457
|
-
return yield* stage.pipe(
|
|
4720
|
+
}).pipe(Effect23.scoped), { concurrency: 1 });
|
|
4721
|
+
return yield* stage.pipe(Effect23.onError(() => Effect23.promise(() => Promise.all(created.map((path) => fs.rm(path, { force: true }).catch(() => {}))))));
|
|
4722
|
+
});
|
|
4723
|
+
var stagePlatformArtifactsEffect = (options) => Effect23.gen(function* () {
|
|
4724
|
+
const requirements = parseReleaseConfig(options.config).requirements(options.tag);
|
|
4725
|
+
const expected = platformPayloads(requirements, options.platform);
|
|
4726
|
+
if (!expected.length || Object.keys(options.sources).length !== expected.length || expected.some((name) => !Object.hasOwn(options.sources, name)))
|
|
4727
|
+
return yield* fail("Platform staging sources do not match release configuration");
|
|
4728
|
+
return yield* stageExpectedFilesEffect({ ...options, expected });
|
|
4458
4729
|
});
|
|
4459
4730
|
var stagePlatformArtifacts = (options) => runReleaseLibrary(provideLibraryPorts()(stagePlatformArtifactsEffect(options)));
|
|
4460
4731
|
// src/library/steps.ts
|
|
4461
|
-
import { join as
|
|
4462
|
-
import { Effect as
|
|
4732
|
+
import { join as join33 } from "path";
|
|
4733
|
+
import { Effect as Effect24 } from "effect";
|
|
4463
4734
|
|
|
4464
4735
|
// ../../src/installer/installer-archive-members.ts
|
|
4465
4736
|
import { createHash as createHash10 } from "crypto";
|
|
@@ -4588,11 +4859,11 @@ async function assertEmbeddedArchive(path, size, archive) {
|
|
|
4588
4859
|
// ../../src/installer/installer-identity.ts
|
|
4589
4860
|
import { lstat as lstat8, mkdtemp as mkdtemp4, readdir as readdir6, realpath } from "fs/promises";
|
|
4590
4861
|
import { tmpdir as tmpdir4 } from "os";
|
|
4591
|
-
import { basename as basename5, join as
|
|
4862
|
+
import { basename as basename5, join as join15, resolve as resolve10, win32 } from "path";
|
|
4592
4863
|
|
|
4593
4864
|
// ../../src/installer/installer-image-mount.ts
|
|
4594
4865
|
import { lstat as lstat7, mkdir as mkdir4, mkdtemp as mkdtemp3, readdir as readdir5, rm as rm4, stat } from "fs/promises";
|
|
4595
|
-
import { dirname as dirname3, join as
|
|
4866
|
+
import { dirname as dirname3, join as join14 } from "path";
|
|
4596
4867
|
var FAILED_ATTACH_PROBES = 5;
|
|
4597
4868
|
var FAILED_ATTACH_PROBE_INTERVAL_MS = 500;
|
|
4598
4869
|
async function containsMountAt(path, expectedDevice) {
|
|
@@ -4602,7 +4873,7 @@ async function containsMountAt(path, expectedDevice) {
|
|
|
4602
4873
|
if (info.dev !== expectedDevice)
|
|
4603
4874
|
return true;
|
|
4604
4875
|
for (const name of await readdir5(path)) {
|
|
4605
|
-
const child =
|
|
4876
|
+
const child = join14(path, name), childInfo = await lstat7(child);
|
|
4606
4877
|
if (!childInfo.isDirectory() || childInfo.isSymbolicLink())
|
|
4607
4878
|
continue;
|
|
4608
4879
|
if (childInfo.dev !== info.dev || await containsMountAt(child, info.dev))
|
|
@@ -4796,8 +5067,8 @@ async function withInstallerImageRetries(options) {
|
|
|
4796
5067
|
};
|
|
4797
5068
|
const priorErrors = () => failedAttempts.map((attempt) => attempt.error);
|
|
4798
5069
|
for (let attempt = 1;attempt <= maximumAttempts; attempt++) {
|
|
4799
|
-
const directory = await mkdtemp3(
|
|
4800
|
-
const mount =
|
|
5070
|
+
const directory = await mkdtemp3(join14(options.parent, options.prefix));
|
|
5071
|
+
const mount = join14(directory, "mount");
|
|
4801
5072
|
const io = options.createIo?.(directory, mount) ?? defaultInstallerImageMountIo(options.run);
|
|
4802
5073
|
let lifecycleStarted = false;
|
|
4803
5074
|
try {
|
|
@@ -4997,7 +5268,7 @@ async function verifyInstallerPayload(options) {
|
|
|
4997
5268
|
if (!Number.isSafeInteger(before.archive.size + 256 * 1024 * 1024))
|
|
4998
5269
|
throw new Error("Installer archive exceeds bound");
|
|
4999
5270
|
const env = environment(parent);
|
|
5000
|
-
const temporary = await mkdtemp4(
|
|
5271
|
+
const temporary = await mkdtemp4(join15(tmpdir4(), "framework-installer-inspect-"));
|
|
5001
5272
|
const cleanupIo = defaultInstallerImageMountIo(command);
|
|
5002
5273
|
try {
|
|
5003
5274
|
if (options.platform === "macos-arm64") {
|
|
@@ -5011,21 +5282,21 @@ async function verifyInstallerPayload(options) {
|
|
|
5011
5282
|
const apps = (await readdir6(mount)).filter((name) => name.endsWith(".app"));
|
|
5012
5283
|
if (apps.length !== 1)
|
|
5013
5284
|
throw new Error("Installer application is missing or ambiguous");
|
|
5014
|
-
const resources =
|
|
5015
|
-
const actualRoot = await realpath(mount), actualApp = await realpath(
|
|
5285
|
+
const resources = join15(mount, apps[0], "Contents", "Resources");
|
|
5286
|
+
const actualRoot = await realpath(mount), actualApp = await realpath(join15(mount, apps[0])), actualResources = await realpath(resources);
|
|
5016
5287
|
if (!isWithin(actualRoot, actualApp) || !isWithin(actualApp, actualResources))
|
|
5017
5288
|
throw new Error("Installer resources escape mounted image");
|
|
5018
|
-
const plist =
|
|
5289
|
+
const plist = join15(actualApp, "Contents", "Info.plist"), plistInfo = await lstat8(plist);
|
|
5019
5290
|
if (!plistInfo.isFile() || plistInfo.isSymbolicLink() || plistInfo.size < 1 || plistInfo.size > 1024 * 1024)
|
|
5020
5291
|
throw new Error("Invalid installer property list");
|
|
5021
5292
|
const executable = (await command(["/usr/libexec/PlistBuddy", "-c", "Print :CFBundleExecutable", plist], env)).trim();
|
|
5022
5293
|
if (!executable || executable === "." || executable === ".." || /[\\/]/.test(executable))
|
|
5023
5294
|
throw new Error("Invalid installer executable name");
|
|
5024
|
-
await assertInstallerExecutable(
|
|
5295
|
+
await assertInstallerExecutable(join15(actualApp, "Contents", "MacOS", executable), options.platform);
|
|
5025
5296
|
const archives = (await readdir6(actualResources)).filter((name) => name.endsWith(".tar.zst"));
|
|
5026
5297
|
if (archives.length !== 1)
|
|
5027
5298
|
throw new Error("Installer archive is missing or ambiguous");
|
|
5028
|
-
const embedded = await identity(
|
|
5299
|
+
const embedded = await identity(join15(actualResources, archives[0]));
|
|
5029
5300
|
if (embedded.size !== before.archive.size || embedded.digest !== before.archive.digest)
|
|
5030
5301
|
throw new Error("Installer archive differs from release archive");
|
|
5031
5302
|
}
|
|
@@ -5043,7 +5314,7 @@ async function verifyInstallerPayload(options) {
|
|
|
5043
5314
|
const matches = names.filter((name) => candidates.includes(normalizeArchiveMember(name)));
|
|
5044
5315
|
if (matches.length !== 1)
|
|
5045
5316
|
throw new Error("Installer archive is missing or ambiguous");
|
|
5046
|
-
const extracted =
|
|
5317
|
+
const extracted = join15(temporary, "member");
|
|
5047
5318
|
const count = await extractArchiveMember({
|
|
5048
5319
|
tar,
|
|
5049
5320
|
archive: installerPath,
|
|
@@ -5054,7 +5325,7 @@ async function verifyInstallerPayload(options) {
|
|
|
5054
5325
|
});
|
|
5055
5326
|
if (options.platform === "windows-x64") {
|
|
5056
5327
|
const setup = findArchiveMember(names, `${options.appName}-Setup.exe`, options.platform, "Installer executable is missing or ambiguous");
|
|
5057
|
-
const executable =
|
|
5328
|
+
const executable = join15(temporary, "setup.exe");
|
|
5058
5329
|
await extractArchiveMember({
|
|
5059
5330
|
tar,
|
|
5060
5331
|
archive: installerPath,
|
|
@@ -5091,18 +5362,18 @@ async function verifyInstallerPayload(options) {
|
|
|
5091
5362
|
|
|
5092
5363
|
// ../../src/installer/installer-qualification-command.ts
|
|
5093
5364
|
import { lstat as lstat18, writeFile as writeFile9 } from "fs/promises";
|
|
5094
|
-
import { join as
|
|
5365
|
+
import { join as join30, resolve as resolve13 } from "path";
|
|
5095
5366
|
|
|
5096
5367
|
// ../../src/installer/installer-observation.ts
|
|
5097
5368
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
5098
5369
|
import { chmod as chmod2, mkdir as mkdir9, readFile as readFile9, realpath as realpath8, writeFile as writeFile8 } from "fs/promises";
|
|
5099
5370
|
import { createServer } from "net";
|
|
5100
|
-
import { delimiter, dirname as dirname12, join as
|
|
5371
|
+
import { delimiter, dirname as dirname12, join as join29 } from "path";
|
|
5101
5372
|
|
|
5102
5373
|
// ../../src/installer/installer-ci-bootstrap.ts
|
|
5103
5374
|
import { randomBytes } from "crypto";
|
|
5104
5375
|
import { lstat as lstat9, mkdir as mkdir5, mkdtemp as mkdtemp5, realpath as realpath2, rm as rm5, writeFile as writeFile4 } from "fs/promises";
|
|
5105
|
-
import { dirname as dirname4, isAbsolute as isAbsolute4, join as
|
|
5376
|
+
import { dirname as dirname4, isAbsolute as isAbsolute4, join as join16, relative as relative5, sep as sep3 } from "path";
|
|
5106
5377
|
import { fileURLToPath } from "url";
|
|
5107
5378
|
var bootstrapModules = [
|
|
5108
5379
|
"app/value-guards.js",
|
|
@@ -5129,23 +5400,23 @@ async function prepareInstallerCiBootstrap(env = process.env) {
|
|
|
5129
5400
|
if (/\s/.test(parent) || !(await lstat9(parent)).isDirectory())
|
|
5130
5401
|
throw new Error("Runner temp cannot represent a Bun preload path");
|
|
5131
5402
|
const source = dirname4(dirname4(fileURLToPath(import.meta.url)));
|
|
5132
|
-
const directory = await mkdtemp5(
|
|
5403
|
+
const directory = await mkdtemp5(join16(parent, "framework-ci-"));
|
|
5133
5404
|
try {
|
|
5134
5405
|
for (const name of bootstrapModules) {
|
|
5135
|
-
const contents = await readBoundedFile(
|
|
5136
|
-
await mkdir5(dirname4(
|
|
5137
|
-
await writeFile4(
|
|
5406
|
+
const contents = await readBoundedFile(join16(source, name), 2 * 1024 * 1024, "installer bootstrap module");
|
|
5407
|
+
await mkdir5(dirname4(join16(directory, name)), { recursive: true, mode: 448 });
|
|
5408
|
+
await writeFile4(join16(directory, name), contents, { flag: "wx", mode: 384 });
|
|
5138
5409
|
}
|
|
5139
|
-
await writeFile4(
|
|
5410
|
+
await writeFile4(join16(directory, "package.json"), `{"type":"module"}
|
|
5140
5411
|
`, {
|
|
5141
5412
|
flag: "wx",
|
|
5142
5413
|
mode: 384
|
|
5143
5414
|
});
|
|
5144
|
-
const worker =
|
|
5415
|
+
const worker = join16(directory, "installer/installer-ci-worker.js");
|
|
5145
5416
|
return {
|
|
5146
5417
|
directory,
|
|
5147
5418
|
worker,
|
|
5148
|
-
preflight:
|
|
5419
|
+
preflight: join16(directory, "installer/installer-ci-preflight.js"),
|
|
5149
5420
|
bunOptions: `--preload=${worker}`
|
|
5150
5421
|
};
|
|
5151
5422
|
} catch (error) {
|
|
@@ -5160,7 +5431,7 @@ async function preflightInstallerRuntime(options) {
|
|
|
5160
5431
|
throw new Error("Runtime preflight requires a disposable hosted runner");
|
|
5161
5432
|
const tempRoot = await realpath2(temp), bootstrapRoot = await realpath2(bootstrap.directory);
|
|
5162
5433
|
const relativeBootstrap = relative5(tempRoot, bootstrapRoot);
|
|
5163
|
-
if (!relativeBootstrap || relativeBootstrap === ".." || relativeBootstrap.startsWith(".." + sep3) || isAbsolute4(relativeBootstrap) || /\s/.test(bootstrapRoot) || bootstrap.worker !==
|
|
5434
|
+
if (!relativeBootstrap || relativeBootstrap === ".." || relativeBootstrap.startsWith(".." + sep3) || isAbsolute4(relativeBootstrap) || /\s/.test(bootstrapRoot) || bootstrap.worker !== join16(bootstrapRoot, "installer/installer-ci-worker.js") || bootstrap.preflight !== join16(bootstrapRoot, "installer/installer-ci-preflight.js") || bootstrap.bunOptions !== `--preload=${bootstrap.worker}`)
|
|
5164
5435
|
throw new Error("Invalid installer bootstrap location");
|
|
5165
5436
|
await runInstallerPreflight({
|
|
5166
5437
|
env,
|
|
@@ -5180,7 +5451,7 @@ async function runInstallerPreflight(options) {
|
|
|
5180
5451
|
const info = await lstat9(runtime);
|
|
5181
5452
|
if (!info.isFile() || info.isSymbolicLink() || info.size < 4096)
|
|
5182
5453
|
throw new Error("Invalid candidate Bun runtime");
|
|
5183
|
-
const temporary = await mkdtemp5(
|
|
5454
|
+
const temporary = await mkdtemp5(join16(options.parent, "framework-preflight-"));
|
|
5184
5455
|
try {
|
|
5185
5456
|
const clean = {};
|
|
5186
5457
|
for (const key of [
|
|
@@ -5205,11 +5476,11 @@ async function runInstallerPreflight(options) {
|
|
|
5205
5476
|
BUN_OPTIONS: `--preload=${worker}`,
|
|
5206
5477
|
FRAMEWORK_CI_WORKER_ENTRY: preflight,
|
|
5207
5478
|
FRAMEWORK_CI_NONCE: nonce,
|
|
5208
|
-
FRAMEWORK_CI_ACK:
|
|
5209
|
-
FRAMEWORK_CI_PERMIT:
|
|
5479
|
+
FRAMEWORK_CI_ACK: join16(temporary, "ack"),
|
|
5480
|
+
FRAMEWORK_CI_PERMIT: join16(temporary, "permit"),
|
|
5210
5481
|
FRAMEWORK_CI_ORIGIN: "http://127.0.0.1:48999",
|
|
5211
|
-
FRAMEWORK_CI_OBSERVATION:
|
|
5212
|
-
FRAMEWORK_CI_UNEXPECTED:
|
|
5482
|
+
FRAMEWORK_CI_OBSERVATION: join16(temporary, "observation"),
|
|
5483
|
+
FRAMEWORK_CI_UNEXPECTED: join16(temporary, "unexpected"),
|
|
5213
5484
|
FRAMEWORK_CI_EXPECTED_READS: JSON.stringify([
|
|
5214
5485
|
"https://example.invalid/framework-ci-sentinel"
|
|
5215
5486
|
])
|
|
@@ -5244,7 +5515,7 @@ async function runInstallerPreflight(options) {
|
|
|
5244
5515
|
if (status !== 0 || !stdout.includes("framework installer preload preflight passed"))
|
|
5245
5516
|
throw new Error("Candidate Bun runtime failed installer preflight");
|
|
5246
5517
|
try {
|
|
5247
|
-
await lstat9(
|
|
5518
|
+
await lstat9(join16(temporary, "unexpected"));
|
|
5248
5519
|
throw new Error("Runtime preflight recorded unexpected activity");
|
|
5249
5520
|
} catch (error) {
|
|
5250
5521
|
if (errorCode(error) !== "ENOENT")
|
|
@@ -5257,7 +5528,7 @@ async function runInstallerPreflight(options) {
|
|
|
5257
5528
|
|
|
5258
5529
|
// ../../src/installer/installer-extraction.ts
|
|
5259
5530
|
import { chmod, lstat as lstat10, mkdir as mkdir6, mkdtemp as mkdtemp6, readdir as readdir7, realpath as realpath3 } from "fs/promises";
|
|
5260
|
-
import { join as
|
|
5531
|
+
import { join as join17, resolve as resolve11, win32 as win322 } from "path";
|
|
5261
5532
|
async function run(cmd, env) {
|
|
5262
5533
|
return runInstallerCommand(cmd, env, {
|
|
5263
5534
|
outputLimit: 8 * 1024 * 1024,
|
|
@@ -5265,7 +5536,7 @@ async function run(cmd, env) {
|
|
|
5265
5536
|
failureMessage: "Installer preparation command failed"
|
|
5266
5537
|
});
|
|
5267
5538
|
}
|
|
5268
|
-
async function
|
|
5539
|
+
async function digest2(path) {
|
|
5269
5540
|
const info = await lstat10(path);
|
|
5270
5541
|
if (!info.isFile() || info.isSymbolicLink() || !Number.isSafeInteger(info.size) || info.size < 1)
|
|
5271
5542
|
throw new Error("Invalid extracted file");
|
|
@@ -5309,10 +5580,10 @@ async function prepareInstallerExecution(options) {
|
|
|
5309
5580
|
archive: sourceArchive,
|
|
5310
5581
|
env
|
|
5311
5582
|
});
|
|
5312
|
-
const directory = await mkdtemp6(
|
|
5583
|
+
const directory = await mkdtemp6(join17(parent, "framework-installer-"));
|
|
5313
5584
|
const imageIo = defaultInstallerImageMountIo(run);
|
|
5314
5585
|
try {
|
|
5315
|
-
const profile =
|
|
5586
|
+
const profile = join17(directory, "profile"), incoming = join17(directory, "incoming");
|
|
5316
5587
|
await mkdir6(profile, { mode: 448 });
|
|
5317
5588
|
await mkdir6(incoming, { mode: 448 });
|
|
5318
5589
|
const clean = cleanEnv(env);
|
|
@@ -5328,31 +5599,31 @@ async function prepareInstallerExecution(options) {
|
|
|
5328
5599
|
const appName = `${options.appName}.app`, apps = (await readdir7(mount)).filter((name) => name.endsWith(".app"));
|
|
5329
5600
|
if (apps.length !== 1 || apps[0] !== appName)
|
|
5330
5601
|
throw new Error("Unexpected installer application");
|
|
5331
|
-
const sourceApp = await realpath3(
|
|
5602
|
+
const sourceApp = await realpath3(join17(mount, appName)), mountRoot = await realpath3(mount);
|
|
5332
5603
|
if (!isWithin(mountRoot, sourceApp))
|
|
5333
5604
|
throw new Error("Installer application escapes image");
|
|
5334
|
-
const app =
|
|
5605
|
+
const app = join17(incoming, appName);
|
|
5335
5606
|
await run(["/usr/bin/ditto", sourceApp, app], clean);
|
|
5336
|
-
const actualApp = await realpath3(app), resources = await realpath3(
|
|
5607
|
+
const actualApp = await realpath3(app), resources = await realpath3(join17(actualApp, "Contents", "Resources"));
|
|
5337
5608
|
if (!isWithin(await realpath3(incoming), actualApp) || !isWithin(actualApp, resources))
|
|
5338
5609
|
throw new Error("Copied installer escapes profile");
|
|
5339
|
-
const plist =
|
|
5610
|
+
const plist = join17(actualApp, "Contents", "Info.plist"), plistInfo = await lstat10(plist);
|
|
5340
5611
|
if (!plistInfo.isFile() || plistInfo.isSymbolicLink() || plistInfo.size < 1 || plistInfo.size > 1024 * 1024)
|
|
5341
5612
|
throw new Error("Invalid installer property list");
|
|
5342
5613
|
const name = (await run(["/usr/libexec/PlistBuddy", "-c", "Print :CFBundleExecutable", plist], clean)).trim();
|
|
5343
5614
|
if (!name || name === "." || name === ".." || /[\\/]/.test(name))
|
|
5344
5615
|
throw new Error("Invalid installer executable");
|
|
5345
|
-
const appExecutable =
|
|
5346
|
-
const sourceExecutable =
|
|
5616
|
+
const appExecutable = join17(actualApp, "Contents", "MacOS", name);
|
|
5617
|
+
const sourceExecutable = join17(sourceApp, "Contents", "MacOS", name);
|
|
5347
5618
|
if (!isWithin(actualApp, await realpath3(appExecutable)) || !isWithin(sourceApp, await realpath3(sourceExecutable)))
|
|
5348
5619
|
throw new Error("Installer executable escapes application");
|
|
5349
5620
|
await assertInstallerExecutable(appExecutable, options.platform);
|
|
5350
|
-
if (JSON.stringify(await
|
|
5621
|
+
if (JSON.stringify(await digest2(sourceExecutable)) !== JSON.stringify(await digest2(appExecutable)))
|
|
5351
5622
|
throw new Error("Copied installer executable differs");
|
|
5352
5623
|
const archives = (await readdir7(resources)).filter((value) => value.endsWith(".tar.zst"));
|
|
5353
5624
|
if (archives.length !== 1)
|
|
5354
5625
|
throw new Error("Missing installer archive");
|
|
5355
|
-
const embedded = await
|
|
5626
|
+
const embedded = await digest2(join17(resources, archives[0]));
|
|
5356
5627
|
if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
|
|
5357
5628
|
throw new Error("Copied installer archive differs");
|
|
5358
5629
|
return executable;
|
|
@@ -5367,9 +5638,9 @@ async function prepareInstallerExecution(options) {
|
|
|
5367
5638
|
assertInstallerLayout(options.platform, options.appName, names);
|
|
5368
5639
|
const find = (name) => findArchiveMember(names, name, options.platform, "Installer member missing or ambiguous");
|
|
5369
5640
|
if (options.platform === "windows-x64") {
|
|
5370
|
-
const subdirectory =
|
|
5641
|
+
const subdirectory = join17(incoming, ".installer");
|
|
5371
5642
|
await mkdir6(subdirectory);
|
|
5372
|
-
executable =
|
|
5643
|
+
executable = join17(incoming, `${options.appName}-Setup.exe`);
|
|
5373
5644
|
await extractArchiveMember({
|
|
5374
5645
|
tar,
|
|
5375
5646
|
archive: sourceInstaller,
|
|
@@ -5383,11 +5654,11 @@ async function prepareInstallerExecution(options) {
|
|
|
5383
5654
|
tar,
|
|
5384
5655
|
archive: sourceInstaller,
|
|
5385
5656
|
member: find(`.installer/${options.appName}-Setup.metadata.json`),
|
|
5386
|
-
destination:
|
|
5657
|
+
destination: join17(subdirectory, `${options.appName}-Setup.metadata.json`),
|
|
5387
5658
|
maximum: 1024 * 1024,
|
|
5388
5659
|
env: clean
|
|
5389
5660
|
});
|
|
5390
|
-
const embeddedPath =
|
|
5661
|
+
const embeddedPath = join17(subdirectory, `${options.appName}-Setup.tar.zst`);
|
|
5391
5662
|
await extractArchiveMember({
|
|
5392
5663
|
tar,
|
|
5393
5664
|
archive: sourceInstaller,
|
|
@@ -5396,11 +5667,11 @@ async function prepareInstallerExecution(options) {
|
|
|
5396
5667
|
maximum: verified.archive.size,
|
|
5397
5668
|
env: clean
|
|
5398
5669
|
});
|
|
5399
|
-
const embedded = await
|
|
5670
|
+
const embedded = await digest2(embeddedPath);
|
|
5400
5671
|
if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
|
|
5401
5672
|
throw new Error("Copied installer archive differs");
|
|
5402
5673
|
} else {
|
|
5403
|
-
executable =
|
|
5674
|
+
executable = join17(incoming, "installer");
|
|
5404
5675
|
await extractArchiveMember({
|
|
5405
5676
|
tar,
|
|
5406
5677
|
archive: sourceInstaller,
|
|
@@ -5459,7 +5730,7 @@ function assertInstallerRendererObservation(value, offline = false) {
|
|
|
5459
5730
|
import { createHash as createHash11 } from "crypto";
|
|
5460
5731
|
import { lstat as lstat11, open as open6, realpath as realpath4, rm as rm6 } from "fs/promises";
|
|
5461
5732
|
import { once } from "events";
|
|
5462
|
-
import { join as
|
|
5733
|
+
import { join as join18, resolve as resolve12 } from "path";
|
|
5463
5734
|
import { createZstdDecompress } from "zlib";
|
|
5464
5735
|
import { Parser } from "tar";
|
|
5465
5736
|
function cleanEnv2(parent, forceLocal) {
|
|
@@ -5630,7 +5901,7 @@ async function verifyInstalledPayload(options) {
|
|
|
5630
5901
|
const member = members.get(path);
|
|
5631
5902
|
if (!member || member.count !== 1)
|
|
5632
5903
|
throw new Error("Archive member missing or ambiguous");
|
|
5633
|
-
const current = await installed(
|
|
5904
|
+
const current = await installed(join18(root, name), root, limit);
|
|
5634
5905
|
if (member.size !== current.size || member.digest !== current.digest)
|
|
5635
5906
|
throw new Error(`Installed file differs from archive: ${name}`);
|
|
5636
5907
|
if (name === "Resources/version.json") {
|
|
@@ -5665,7 +5936,7 @@ async function extractCandidateRuntime(options) {
|
|
|
5665
5936
|
const prefix = options.platform === "macos-arm64" ? `${options.appName}.app/Contents/MacOS` : `${options.appName.replaceAll(" ", "")}/bin`, suffix = options.platform === "windows-x64" ? ".exe" : "";
|
|
5666
5937
|
const expected = `${prefix}/bun${suffix}`;
|
|
5667
5938
|
const member = findArchiveMember(entries, expected, options.platform, "Runtime archive member missing or ambiguous");
|
|
5668
|
-
const destination =
|
|
5939
|
+
const destination = join18(profile, `candidate-bun${suffix}`), output = await open6(destination, "wx", 448);
|
|
5669
5940
|
const spawn = () => Bun.spawn({
|
|
5670
5941
|
cmd: ["tar", "--zstd", "-xOf", archive, "--", member],
|
|
5671
5942
|
env: tarEnv,
|
|
@@ -5872,7 +6143,7 @@ async function windowsRunningExecutable(pid) {
|
|
|
5872
6143
|
|
|
5873
6144
|
// ../../src/updates/install/update-swap-stage.ts
|
|
5874
6145
|
import { lstat as lstat17, mkdtemp as mkdtemp8, readFile as readFile8, realpath as realpath7, rm as rm8 } from "fs/promises";
|
|
5875
|
-
import { join as
|
|
6146
|
+
import { join as join28 } from "path";
|
|
5876
6147
|
|
|
5877
6148
|
// ../../src/updates/install/update-handoff-plan.ts
|
|
5878
6149
|
import { basename as basename6 } from "path";
|
|
@@ -5914,7 +6185,7 @@ function planUpdateHandoff(options) {
|
|
|
5914
6185
|
import { createHash as createHash12 } from "crypto";
|
|
5915
6186
|
import { constants as constants4 } from "fs";
|
|
5916
6187
|
import { lstat as lstat12, mkdir as mkdir7, mkdtemp as mkdtemp7, open as open7, readFile as readFile6, realpath as realpath6, rm as rm7, symlink } from "fs/promises";
|
|
5917
|
-
import { isAbsolute as isAbsolute5, join as
|
|
6188
|
+
import { isAbsolute as isAbsolute5, join as join19 } from "path";
|
|
5918
6189
|
import { Transform } from "stream";
|
|
5919
6190
|
import { pipeline } from "stream/promises";
|
|
5920
6191
|
import { createZstdDecompress as createZstdDecompress2 } from "zlib";
|
|
@@ -5960,8 +6231,8 @@ async function extractVerifiedUpdate(options) {
|
|
|
5960
6231
|
const parent = await realpath6(options.directory);
|
|
5961
6232
|
if (!(await lstat12(parent)).isDirectory())
|
|
5962
6233
|
throw new Error("Invalid update staging directory");
|
|
5963
|
-
directory = await mkdtemp7(
|
|
5964
|
-
const payloadRoot =
|
|
6234
|
+
directory = await mkdtemp7(join19(parent, "framework-update-extract-"));
|
|
6235
|
+
const payloadRoot = join19(directory, "payload"), decompressed = join19(directory, "payload.tar");
|
|
5965
6236
|
await mkdir7(payloadRoot, { mode: 448 });
|
|
5966
6237
|
const entries = [], links = [], seen = new Set, fold = platform === "windows-x64";
|
|
5967
6238
|
let invalid = false;
|
|
@@ -6079,14 +6350,14 @@ async function extractVerifiedUpdate(options) {
|
|
|
6079
6350
|
if (invalid)
|
|
6080
6351
|
throw new Error("Unsafe or unsupported update archive entry");
|
|
6081
6352
|
if (links.length) {
|
|
6082
|
-
const bin =
|
|
6083
|
-
for (const path of [
|
|
6353
|
+
const bin = join19(payloadRoot, archiveRoot, "bin"), cef = join19(bin, "cef");
|
|
6354
|
+
for (const path of [join19(payloadRoot, archiveRoot), bin, cef]) {
|
|
6084
6355
|
const value = await lstat12(path);
|
|
6085
6356
|
if (!value.isDirectory() || value.isSymbolicLink())
|
|
6086
6357
|
throw new Error("Invalid CEF link directory");
|
|
6087
6358
|
}
|
|
6088
6359
|
for (const link of links) {
|
|
6089
|
-
const destination =
|
|
6360
|
+
const destination = join19(payloadRoot, link.path), target = join19(bin, link.target), value = await lstat12(target);
|
|
6090
6361
|
if (!value.isFile() || value.isSymbolicLink())
|
|
6091
6362
|
throw new Error("Invalid CEF link target");
|
|
6092
6363
|
await symlink(link.target, destination);
|
|
@@ -6094,12 +6365,12 @@ async function extractVerifiedUpdate(options) {
|
|
|
6094
6365
|
}
|
|
6095
6366
|
await rm7(decompressed);
|
|
6096
6367
|
assertPayloadLayout({ platform, renderer, appName, entries, sidecars });
|
|
6097
|
-
const prefix = platform === "macos-arm64" ?
|
|
6098
|
-
const resources =
|
|
6368
|
+
const prefix = platform === "macos-arm64" ? join19(`${appName}.app`, "Contents") : appName.replaceAll(" ", "");
|
|
6369
|
+
const resources = join19(payloadRoot, prefix, "Resources");
|
|
6099
6370
|
const bin = platform === "macos-arm64" ? "MacOS" : "bin", suffix = platform === "windows-x64" ? ".exe" : "";
|
|
6100
6371
|
const executables = [
|
|
6101
|
-
|
|
6102
|
-
|
|
6372
|
+
join19(bin, `launcher${suffix}`),
|
|
6373
|
+
join19(bin, `bun${suffix}`),
|
|
6103
6374
|
...sidecars.map((name) => sidecarBundlePath(name, platform))
|
|
6104
6375
|
];
|
|
6105
6376
|
const critical = [
|
|
@@ -6109,21 +6380,21 @@ async function extractVerifiedUpdate(options) {
|
|
|
6109
6380
|
"Resources/app/client/index.html"
|
|
6110
6381
|
];
|
|
6111
6382
|
for (const path of critical) {
|
|
6112
|
-
const item = await lstat12(
|
|
6383
|
+
const item = await lstat12(join19(payloadRoot, prefix, path));
|
|
6113
6384
|
if (!item.isFile() || item.isSymbolicLink() || item.size < 1 || platform !== "windows-x64" && process.platform !== "win32" && executables.includes(path) && !(item.mode & 64))
|
|
6114
6385
|
throw new Error("Invalid critical update file");
|
|
6115
6386
|
}
|
|
6116
6387
|
for (const name of ["version.json", "build.json"]) {
|
|
6117
|
-
const metadata = await lstat12(
|
|
6388
|
+
const metadata = await lstat12(join19(resources, name));
|
|
6118
6389
|
if (!metadata.isFile() || metadata.isSymbolicLink() || metadata.size < 1 || metadata.size > 1048576)
|
|
6119
6390
|
throw new Error("Invalid update metadata");
|
|
6120
6391
|
}
|
|
6121
|
-
if (JSON.parse(await readFile6(
|
|
6392
|
+
if (JSON.parse(await readFile6(join19(resources, "version.json"), "utf8")).version !== descriptor.version)
|
|
6122
6393
|
throw new Error("Update version mismatch");
|
|
6123
|
-
assertBuildMetadata(JSON.parse(await readFile6(
|
|
6394
|
+
assertBuildMetadata(JSON.parse(await readFile6(join19(resources, "build.json"), "utf8")), renderer);
|
|
6124
6395
|
return {
|
|
6125
6396
|
directory,
|
|
6126
|
-
payload:
|
|
6397
|
+
payload: join19(payloadRoot, platform === "macos-arm64" ? `${appName}.app` : prefix)
|
|
6127
6398
|
};
|
|
6128
6399
|
} catch (error) {
|
|
6129
6400
|
if (directory)
|
|
@@ -6138,16 +6409,16 @@ async function extractVerifiedUpdate(options) {
|
|
|
6138
6409
|
import { createHash as createHash13 } from "crypto";
|
|
6139
6410
|
import { constants as constants7 } from "fs";
|
|
6140
6411
|
import { lstat as lstat13, open as open10, readdir as readdir8, readFile as readFile7, readlink as readlink2 } from "fs/promises";
|
|
6141
|
-
import { basename as basename8, dirname as dirname6, join as
|
|
6412
|
+
import { basename as basename8, dirname as dirname6, join as join22 } from "path";
|
|
6142
6413
|
|
|
6143
6414
|
// ../../src/updates/update-state-store.ts
|
|
6144
6415
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
6145
6416
|
import { constants as constants6 } from "fs";
|
|
6146
6417
|
import { open as open9, rename, unlink, writeFile as writeFile5 } from "fs/promises";
|
|
6147
|
-
import { join as
|
|
6418
|
+
import { join as join21 } from "path";
|
|
6148
6419
|
|
|
6149
6420
|
// ../../src/updates/locks/update-lock.ts
|
|
6150
|
-
import { basename as basename7, dirname as dirname5, join as
|
|
6421
|
+
import { basename as basename7, dirname as dirname5, join as join20 } from "path";
|
|
6151
6422
|
|
|
6152
6423
|
// ../../src/updates/locks/native-file-lock.ts
|
|
6153
6424
|
import { constants as constants5 } from "fs";
|
|
@@ -6315,7 +6586,7 @@ async function tryAcquireWindows(path, mode) {
|
|
|
6315
6586
|
function updateLockPath(target) {
|
|
6316
6587
|
if (!isCanonicalPath(target))
|
|
6317
6588
|
throw new Error("Invalid update lock target");
|
|
6318
|
-
return
|
|
6589
|
+
return join20(dirname5(target), `.${basename7(target)}.framework-update.lock`);
|
|
6319
6590
|
}
|
|
6320
6591
|
async function tryAcquireUpdateLock(target) {
|
|
6321
6592
|
return tryAcquireNativeFileLock(updateLockPath(target), "exclusive");
|
|
@@ -6380,7 +6651,7 @@ function parseState(value) {
|
|
|
6380
6651
|
return Object.freeze(record);
|
|
6381
6652
|
}
|
|
6382
6653
|
async function readUpdateStageState(staging) {
|
|
6383
|
-
const text = await readSmallStateFile(
|
|
6654
|
+
const text = await readSmallStateFile(join21(staging, "state.json"), 4096, "Invalid update staging state");
|
|
6384
6655
|
return text === undefined ? undefined : parseState(JSON.parse(text));
|
|
6385
6656
|
}
|
|
6386
6657
|
async function writeUpdateStageState(staging, state) {
|
|
@@ -6389,8 +6660,8 @@ async function writeUpdateStageState(staging, state) {
|
|
|
6389
6660
|
async function replaceUpdateStageState(staging, state, durable) {
|
|
6390
6661
|
if (typeof state.generation !== "string" || !isUuid(state.generation))
|
|
6391
6662
|
throw new Error("Invalid update staging state");
|
|
6392
|
-
const path =
|
|
6393
|
-
const temporary =
|
|
6663
|
+
const path = join21(staging, "state.json");
|
|
6664
|
+
const temporary = join21(staging, `.state-${state.generation}-${randomUUID2()}.tmp`);
|
|
6394
6665
|
const contents = JSON.stringify(state) + `
|
|
6395
6666
|
`;
|
|
6396
6667
|
let renamed = false;
|
|
@@ -6428,10 +6699,10 @@ async function withUpdateLock(target, operation) {
|
|
|
6428
6699
|
function updateStagingFor(target) {
|
|
6429
6700
|
if (!isCanonicalPath(target))
|
|
6430
6701
|
throw new Error("Invalid update target");
|
|
6431
|
-
return
|
|
6702
|
+
return join22(dirname6(target), `.${basename8(target)}.framework-update`);
|
|
6432
6703
|
}
|
|
6433
6704
|
async function readUpdateTreeVersion(tree) {
|
|
6434
|
-
const versionPath =
|
|
6705
|
+
const versionPath = join22(tree, ...process.platform === "darwin" ? ["Contents", "Resources"] : ["Resources"], "version.json");
|
|
6435
6706
|
try {
|
|
6436
6707
|
const value = JSON.parse(await readFile7(versionPath, "utf8"));
|
|
6437
6708
|
if (typeof value !== "object" || value === null || typeof value.version !== "string")
|
|
@@ -6525,7 +6796,7 @@ async function readUpdateTreeDigest(tree, options = {}) {
|
|
|
6525
6796
|
if (before.isDirectory()) {
|
|
6526
6797
|
const names = (await limit(() => readdir8(path))).map((name) => ({ name, bytes: Buffer.from(name, "utf8") })).toSorted((left, right) => Buffer.compare(left.bytes, right.bytes)).map(({ name }) => name);
|
|
6527
6798
|
const children = await Promise.all(names.map(async (name) => {
|
|
6528
|
-
const childPath =
|
|
6799
|
+
const childPath = join22(path, name);
|
|
6529
6800
|
return list(childPath, relative ? `${relative}/${name}` : name, await limit(() => lstat13(childPath, { bigint: true })));
|
|
6530
6801
|
}));
|
|
6531
6802
|
return [{ kind: "directory", path, relative, before }, ...children.flat()];
|
|
@@ -6668,8 +6939,8 @@ async function swapUpdateTreeWhileLocked(options, exchangeOperation = exchangeDi
|
|
|
6668
6939
|
const { target, staging } = options;
|
|
6669
6940
|
if (dirname6(staging) !== dirname6(target) || staging === target)
|
|
6670
6941
|
throw new Error("Invalid update swap context");
|
|
6671
|
-
const candidate =
|
|
6672
|
-
const legacyOld =
|
|
6942
|
+
const candidate = join22(staging, "candidate");
|
|
6943
|
+
const legacyOld = join22(staging, "old");
|
|
6673
6944
|
if (await pathExists(legacyOld))
|
|
6674
6945
|
throw new Error("A legacy update tree requires recovery before another swap");
|
|
6675
6946
|
await assertDirectory(target);
|
|
@@ -6699,10 +6970,10 @@ async function swapUpdateTreeWhileLocked(options, exchangeOperation = exchangeDi
|
|
|
6699
6970
|
|
|
6700
6971
|
// ../../src/updates/retention/retirement-inventory.ts
|
|
6701
6972
|
import { lstat as lstat15, readdir as readdir10 } from "fs/promises";
|
|
6702
|
-
import { basename as basename12, dirname as dirname10, join as
|
|
6973
|
+
import { basename as basename12, dirname as dirname10, join as join26 } from "path";
|
|
6703
6974
|
|
|
6704
6975
|
// ../../src/updates/retention/update-retention-marker.ts
|
|
6705
|
-
import { basename as basename9, dirname as dirname7, join as
|
|
6976
|
+
import { basename as basename9, dirname as dirname7, join as join23 } from "path";
|
|
6706
6977
|
var LOWERCASE_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
6707
6978
|
var IDENTITY_COMPONENT = /^[1-9]\d{0,19}$/;
|
|
6708
6979
|
function assertCanonicalTarget(target) {
|
|
@@ -6721,28 +6992,28 @@ function isTreeIdentity(value) {
|
|
|
6721
6992
|
function updateRetentionIntentPath(target, generation) {
|
|
6722
6993
|
assertCanonicalTarget(target);
|
|
6723
6994
|
assertGeneration(generation);
|
|
6724
|
-
return
|
|
6995
|
+
return join23(dirname7(target), `.${basename9(target)}.framework-prune-${generation}.json`);
|
|
6725
6996
|
}
|
|
6726
6997
|
|
|
6727
6998
|
// ../../src/updates/retention/retention-prune-progress.ts
|
|
6728
|
-
import { basename as basename11, dirname as dirname9, join as
|
|
6999
|
+
import { basename as basename11, dirname as dirname9, join as join25 } from "path";
|
|
6729
7000
|
|
|
6730
7001
|
// ../../src/updates/retention/retirement-records.ts
|
|
6731
7002
|
import { lstat as lstat14, readdir as readdir9, writeFile as writeFile6 } from "fs/promises";
|
|
6732
|
-
import { basename as basename10, dirname as dirname8, join as
|
|
7003
|
+
import { basename as basename10, dirname as dirname8, join as join24 } from "path";
|
|
6733
7004
|
function updateRetirementPaths(target, generation) {
|
|
6734
7005
|
if (!isCanonicalPath(target) || !isUuid(generation))
|
|
6735
7006
|
throw new Error("Invalid update retirement identity");
|
|
6736
7007
|
const prefix = `.${basename10(target)}.framework-retired-${generation}`;
|
|
6737
|
-
const container =
|
|
7008
|
+
const container = join24(dirname8(target), prefix);
|
|
6738
7009
|
return Object.freeze({
|
|
6739
7010
|
container,
|
|
6740
|
-
tree:
|
|
6741
|
-
healthReceipt:
|
|
7011
|
+
tree: join24(container, "tree"),
|
|
7012
|
+
healthReceipt: join24(container, "healthy.json"),
|
|
6742
7013
|
healthTemporaryPrefix: ".healthy-",
|
|
6743
|
-
claim:
|
|
7014
|
+
claim: join24(dirname8(target), `${prefix}.claim.json`),
|
|
6744
7015
|
claimTemporaryPrefix: `${prefix}.claim-`,
|
|
6745
|
-
cleanupMarker:
|
|
7016
|
+
cleanupMarker: join24(dirname8(target), `.${basename10(target)}.framework-update-cleanup.json`),
|
|
6746
7017
|
cleanupMarkerTemporaryPrefix: `.${basename10(target)}.framework-update-cleanup-`
|
|
6747
7018
|
});
|
|
6748
7019
|
}
|
|
@@ -6846,10 +7117,10 @@ async function assertNoUpdateRetentionPruneArtifactsWhileLocked(target) {
|
|
|
6846
7117
|
|
|
6847
7118
|
// ../../src/updates/retention/update-retirement.ts
|
|
6848
7119
|
import { lstat as lstat16, mkdir as mkdir8, readdir as readdir11, rmdir, unlink as unlink2, writeFile as writeFile7 } from "fs/promises";
|
|
6849
|
-
import { basename as basename13, dirname as dirname11, join as
|
|
7120
|
+
import { basename as basename13, dirname as dirname11, join as join27 } from "path";
|
|
6850
7121
|
async function reconcileRetirementCleanupMarkerWhileLocked(options) {
|
|
6851
7122
|
const { target, staging, currentVersion } = options;
|
|
6852
|
-
const markerPath =
|
|
7123
|
+
const markerPath = join27(dirname11(target), `.${basename13(target)}.framework-update-cleanup.json`);
|
|
6853
7124
|
const markerInfo = await pathInfo(markerPath);
|
|
6854
7125
|
if (!markerInfo)
|
|
6855
7126
|
return "none";
|
|
@@ -6890,7 +7161,7 @@ async function assertInstalledVersion(options) {
|
|
|
6890
7161
|
const info = await lstat17(options.target);
|
|
6891
7162
|
if (!info.isDirectory() || info.isSymbolicLink() || await realpath7(options.target) !== options.target)
|
|
6892
7163
|
throw new Error("Invalid update install target");
|
|
6893
|
-
const versionFile =
|
|
7164
|
+
const versionFile = join28(options.target, ...options.platform === "macos-arm64" ? ["Contents", "Resources"] : ["Resources"], "version.json");
|
|
6894
7165
|
const versionInfo = await lstat17(versionFile);
|
|
6895
7166
|
if (!versionInfo.isFile() || versionInfo.size > 1024 * 1024)
|
|
6896
7167
|
throw new Error("Installed update version mismatch");
|
|
@@ -6914,7 +7185,7 @@ async function stageUpdateSwap(options) {
|
|
|
6914
7185
|
});
|
|
6915
7186
|
const staging = updateStagingFor(plan.target);
|
|
6916
7187
|
const preparing = await mkdtemp8(`${staging}.preparing-`);
|
|
6917
|
-
const candidate =
|
|
7188
|
+
const candidate = join28(staging, "candidate");
|
|
6918
7189
|
let published = false;
|
|
6919
7190
|
try {
|
|
6920
7191
|
const extracted = await extractVerifiedUpdate({
|
|
@@ -6928,12 +7199,12 @@ async function stageUpdateSwap(options) {
|
|
|
6928
7199
|
maxExpandedBytes: options.maxExpandedBytes,
|
|
6929
7200
|
...options.sidecars === undefined ? {} : { sidecars: options.sidecars }
|
|
6930
7201
|
});
|
|
6931
|
-
renameExclusive(extracted.payload,
|
|
7202
|
+
renameExclusive(extracted.payload, join28(preparing, "candidate"));
|
|
6932
7203
|
await rm8(extracted.directory, { recursive: true, force: true });
|
|
6933
|
-
const candidateTreeIdentity = await readUpdateTreeIdentity(
|
|
7204
|
+
const candidateTreeIdentity = await readUpdateTreeIdentity(join28(preparing, "candidate"));
|
|
6934
7205
|
if (!candidateTreeIdentity)
|
|
6935
7206
|
throw new Error("Update candidate tree identity could not be read");
|
|
6936
|
-
const candidateTreeDigest = await readUpdateTreeDigest(
|
|
7207
|
+
const candidateTreeDigest = await readUpdateTreeDigest(join28(preparing, "candidate"));
|
|
6937
7208
|
await writeUpdateStageState(preparing, newUpdateStageState({
|
|
6938
7209
|
version: plan.version,
|
|
6939
7210
|
previousVersion: options.currentVersion,
|
|
@@ -7018,11 +7289,11 @@ function isolatedEnv(parent, profile, platform) {
|
|
|
7018
7289
|
RUNNER_ENVIRONMENT: "github-hosted",
|
|
7019
7290
|
HOME: profile,
|
|
7020
7291
|
USERPROFILE: profile,
|
|
7021
|
-
LOCALAPPDATA:
|
|
7022
|
-
XDG_DATA_HOME:
|
|
7023
|
-
TMP:
|
|
7024
|
-
TEMP:
|
|
7025
|
-
TMPDIR:
|
|
7292
|
+
LOCALAPPDATA: join29(profile, "LocalAppData"),
|
|
7293
|
+
XDG_DATA_HOME: join29(profile, ".local", "share"),
|
|
7294
|
+
TMP: join29(profile, "tmp"),
|
|
7295
|
+
TEMP: join29(profile, "tmp"),
|
|
7296
|
+
TMPDIR: join29(profile, "tmp"),
|
|
7026
7297
|
ELECTROBUN_INSTALLER_UI_AUTOCLOSE: "1"
|
|
7027
7298
|
});
|
|
7028
7299
|
if (platform === "windows-x64")
|
|
@@ -7117,15 +7388,15 @@ async function observeInstalledApp(options) {
|
|
|
7117
7388
|
await preflightInstallerRuntime({ env: parent, runtime: candidate.path, bootstrap });
|
|
7118
7389
|
stage("runtime-preflight-passed");
|
|
7119
7390
|
for (const path of [
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7391
|
+
join29(prepared.profile, "LocalAppData"),
|
|
7392
|
+
join29(prepared.profile, ".local", "share"),
|
|
7393
|
+
join29(prepared.profile, "tmp")
|
|
7123
7394
|
])
|
|
7124
7395
|
await mkdir9(path, { recursive: true, mode: 448 });
|
|
7125
7396
|
const mac = options.platform === "macos-arm64", windows = options.platform === "windows-x64";
|
|
7126
|
-
const installedRoot = mac ?
|
|
7127
|
-
const resources =
|
|
7128
|
-
const worker =
|
|
7397
|
+
const installedRoot = mac ? join29(prepared.incoming, `${options.appName}.app`, "Contents") : join29(prepared.profile, windows ? "LocalAppData" : ".local/share", options.appId, "stable", "app");
|
|
7398
|
+
const resources = join29(installedRoot, "Resources"), binary = join29(installedRoot, mac ? "MacOS" : "bin"), launcher = join29(binary, windows ? "launcher.exe" : "launcher"), runtime = join29(binary, windows ? "bun.exe" : "bun");
|
|
7399
|
+
const worker = join29(resources, "app", "bun", "index.js");
|
|
7129
7400
|
const sidecars = options.sidecars ?? [];
|
|
7130
7401
|
let foreignHits = 0;
|
|
7131
7402
|
const sentinel = policy ? Bun.serve({
|
|
@@ -7176,7 +7447,7 @@ async function observeInstalledApp(options) {
|
|
|
7176
7447
|
throw new Error("Foreign network sentinel unavailable");
|
|
7177
7448
|
foreignHits = 0;
|
|
7178
7449
|
const nonce = randomBytes2(24).toString("hex");
|
|
7179
|
-
const ack =
|
|
7450
|
+
const ack = join29(run.directory, "ack"), permit = join29(run.directory, "permit"), observation = join29(run.directory, "observation"), unexpected = join29(run.directory, "unexpected"), pidRecord = join29(run.directory, "worker-pid");
|
|
7180
7451
|
const env = {
|
|
7181
7452
|
...baseEnv,
|
|
7182
7453
|
FRAMEWORK_CI_NONCE: nonce,
|
|
@@ -7189,13 +7460,13 @@ async function observeInstalledApp(options) {
|
|
|
7189
7460
|
};
|
|
7190
7461
|
let launchRecord, expectedApp;
|
|
7191
7462
|
if (mac && viaInstaller) {
|
|
7192
|
-
const shimDir =
|
|
7463
|
+
const shimDir = join29(run.directory, "launch-shim");
|
|
7193
7464
|
await mkdir9(shimDir, { mode: 448 });
|
|
7194
|
-
const path =
|
|
7465
|
+
const path = join29(shimDir, "open");
|
|
7195
7466
|
await writeFile8(path, shim, { flag: "wx", mode: 448 });
|
|
7196
7467
|
await chmod2(path, 448);
|
|
7197
|
-
expectedApp =
|
|
7198
|
-
launchRecord =
|
|
7468
|
+
expectedApp = join29(await realpath8(prepared.incoming), `${options.appName}.app`);
|
|
7469
|
+
launchRecord = join29(run.directory, "launch-record");
|
|
7199
7470
|
Object.assign(env, {
|
|
7200
7471
|
PATH: shimDir + delimiter + (env.PATH ?? ""),
|
|
7201
7472
|
FRAMEWORK_CI_EXPECTED_APP: expectedApp,
|
|
@@ -7231,7 +7502,7 @@ async function observeInstalledApp(options) {
|
|
|
7231
7502
|
const error = installerErrorName(await Promise.race([installerStderr, Bun.sleep(2000).then(() => "")]));
|
|
7232
7503
|
throw new Error(`Installer exited unsuccessfully (exit=${installer.exitCode}, signal=${installer.signalCode ?? "none"}, ` + `ready=${await pathExists(worker) && await pathExists(launcher)}, acknowledged=${await pathExists(ack)}, ` + `error=${error ?? "none"})`);
|
|
7233
7504
|
}
|
|
7234
|
-
const ready = await pathExists(worker) && await pathExists(launcher) && await pathExists(
|
|
7505
|
+
const ready = await pathExists(worker) && await pathExists(launcher) && await pathExists(join29(resources, "version.json"));
|
|
7235
7506
|
if (installer && shouldLaunchInstalledApp({
|
|
7236
7507
|
platform: options.platform,
|
|
7237
7508
|
ready,
|
|
@@ -7407,7 +7678,7 @@ async function observeInstalledApp(options) {
|
|
|
7407
7678
|
await swapAfterExit(target, staged.staging);
|
|
7408
7679
|
stage("update-swapped");
|
|
7409
7680
|
await preflightInstallerRuntime({ env: parent, runtime, bootstrap });
|
|
7410
|
-
const directory =
|
|
7681
|
+
const directory = join29(prepared.directory, "update");
|
|
7411
7682
|
await mkdir9(directory, { mode: 448 });
|
|
7412
7683
|
const updated = await observeRun({
|
|
7413
7684
|
directory,
|
|
@@ -7456,7 +7727,7 @@ async function qualifyInstallerCommand(options) {
|
|
|
7456
7727
|
const parsed = parseReleaseConfig(config), requirements = parsed.requirements(tag), policy = requirements.offlinePolicy, names = requirements.platforms[platform];
|
|
7457
7728
|
if (!policy || !names || names.length !== 2)
|
|
7458
7729
|
throw new Error("Installer qualification requires an explicit offline policy and payloads");
|
|
7459
|
-
const directory = resolve13(options.directory), destination =
|
|
7730
|
+
const directory = resolve13(options.directory), destination = join30(directory, `installer-test-${platform}.json`);
|
|
7460
7731
|
try {
|
|
7461
7732
|
await lstat18(destination);
|
|
7462
7733
|
throw new Error("Installer receipt already exists");
|
|
@@ -7472,8 +7743,8 @@ async function qualifyInstallerCommand(options) {
|
|
|
7472
7743
|
appName: app.appName,
|
|
7473
7744
|
appId: app.appId,
|
|
7474
7745
|
version: plan.version,
|
|
7475
|
-
installer:
|
|
7476
|
-
archive:
|
|
7746
|
+
installer: join30(directory, names[0]),
|
|
7747
|
+
archive: join30(directory, names[1]),
|
|
7477
7748
|
expectedReads: parsed.expectedReads,
|
|
7478
7749
|
offlinePolicy: policy,
|
|
7479
7750
|
sidecars: parsed.sidecars
|
|
@@ -7505,7 +7776,7 @@ async function qualifyInstallerCommand(options) {
|
|
|
7505
7776
|
|
|
7506
7777
|
// ../../src/installer/installer-upgrade-command.ts
|
|
7507
7778
|
import { lstat as lstat19, mkdir as mkdir10, rename as rename2, writeFile as writeFile10 } from "fs/promises";
|
|
7508
|
-
import { join as
|
|
7779
|
+
import { join as join32, resolve as resolve15 } from "path";
|
|
7509
7780
|
|
|
7510
7781
|
// ../../src/installer/upgrade-asset-download.ts
|
|
7511
7782
|
import { createHash as createHash14 } from "crypto";
|
|
@@ -7641,7 +7912,7 @@ async function discoverSignedRelease(options) {
|
|
|
7641
7912
|
|
|
7642
7913
|
// ../../src/updates/install/update-download.ts
|
|
7643
7914
|
import { mkdtemp as mkdtemp9, open as open12, realpath as realpath9, rm as rm9 } from "fs/promises";
|
|
7644
|
-
import { basename as basename14, dirname as dirname13, join as
|
|
7915
|
+
import { basename as basename14, dirname as dirname13, join as join31, resolve as resolve14 } from "path";
|
|
7645
7916
|
async function downloadVerifiedRelease(options) {
|
|
7646
7917
|
const { descriptor, maxBytes } = options;
|
|
7647
7918
|
const timeout = options.timeoutMs ?? 120000;
|
|
@@ -7674,12 +7945,12 @@ async function downloadVerifiedRelease(options) {
|
|
|
7674
7945
|
throw new Error("Release download size mismatch");
|
|
7675
7946
|
}
|
|
7676
7947
|
const root = options.createTemporaryDirectory ? await realpath9(resolve14(options.directory)) : resolve14(options.directory);
|
|
7677
|
-
const allocated = options.createTemporaryDirectory ? await options.createTemporaryDirectory(root) : await mkdtemp9(
|
|
7948
|
+
const allocated = options.createTemporaryDirectory ? await options.createTemporaryDirectory(root) : await mkdtemp9(join31(root, "framework-update-"));
|
|
7678
7949
|
const temporaryDirectory = resolve14(allocated);
|
|
7679
7950
|
if (dirname13(temporaryDirectory) !== root || !basename14(temporaryDirectory).startsWith("framework-update-"))
|
|
7680
7951
|
throw new Error("Invalid update download directory");
|
|
7681
7952
|
temporary = temporaryDirectory;
|
|
7682
|
-
const path =
|
|
7953
|
+
const path = join31(temporary, "archive");
|
|
7683
7954
|
const file = await open12(path, "wx", 384);
|
|
7684
7955
|
try {
|
|
7685
7956
|
async function* writeChunks() {
|
|
@@ -7782,7 +8053,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7782
8053
|
const parsed = parseReleaseConfig(config), feed = feedUrl(parsed.feed), requirements = parsed.requirements(tag), names = requirements.platforms[platform];
|
|
7783
8054
|
if (!requirements.offlinePolicy || !names || names.length !== 2)
|
|
7784
8055
|
throw new Error("Upgrade qualification requires an explicit offline policy and payloads");
|
|
7785
|
-
const directory = resolve15(options.directory), destination =
|
|
8056
|
+
const directory = resolve15(options.directory), destination = join32(directory, `upgrade-test-${platform}.json`);
|
|
7786
8057
|
try {
|
|
7787
8058
|
await lstat19(destination);
|
|
7788
8059
|
throw new Error("Upgrade receipt already exists");
|
|
@@ -7805,7 +8076,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7805
8076
|
const channel = "daily";
|
|
7806
8077
|
const trust = { ...base, channel };
|
|
7807
8078
|
const discovery = discoveryName(config, channel, platform);
|
|
7808
|
-
const signed = await readJsonFile(
|
|
8079
|
+
const signed = await readJsonFile(join32(directory, discovery), 65536, "staged descriptor");
|
|
7809
8080
|
const verified = verifyReleaseDescriptor(signed, trust);
|
|
7810
8081
|
if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.asset.name !== names[1])
|
|
7811
8082
|
throw new Error("Untrusted staged descriptor");
|
|
@@ -7828,7 +8099,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7828
8099
|
return null;
|
|
7829
8100
|
if (previous.tag === tag || !versionLessThan(previous.version, descriptor.version))
|
|
7830
8101
|
throw new Error("Previous release is not older than this release");
|
|
7831
|
-
const work =
|
|
8102
|
+
const work = join32(directory, `upgrade-${platform}`);
|
|
7832
8103
|
await mkdir10(work, { mode: 448 });
|
|
7833
8104
|
const downloaded = await downloadVerifiedRelease({
|
|
7834
8105
|
descriptor: previous,
|
|
@@ -7837,12 +8108,12 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7837
8108
|
timeoutMs: 600000,
|
|
7838
8109
|
fetch: fetcher
|
|
7839
8110
|
});
|
|
7840
|
-
const previousArchive =
|
|
8111
|
+
const previousArchive = join32(work, previous.asset.name);
|
|
7841
8112
|
await rename2(downloaded.path, previousArchive);
|
|
7842
8113
|
const installerName = parsed.requirements(previous.tag).platforms[platform]?.[0];
|
|
7843
8114
|
if (!installerName)
|
|
7844
8115
|
throw new Error("Previous release has no installer for this platform");
|
|
7845
|
-
const previousInstaller =
|
|
8116
|
+
const previousInstaller = join32(work, installerName);
|
|
7846
8117
|
await downloadAsset({
|
|
7847
8118
|
feed,
|
|
7848
8119
|
tag: previous.tag,
|
|
@@ -7866,7 +8137,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7866
8137
|
update: {
|
|
7867
8138
|
descriptor,
|
|
7868
8139
|
trust,
|
|
7869
|
-
archive:
|
|
8140
|
+
archive: join32(directory, names[1]),
|
|
7870
8141
|
maxCompressedBytes: MAX_COMPRESSED_BYTES2,
|
|
7871
8142
|
maxExpandedBytes: MAX_EXPANDED_BYTES2
|
|
7872
8143
|
}
|
|
@@ -7889,7 +8160,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7889
8160
|
}
|
|
7890
8161
|
|
|
7891
8162
|
// src/library/steps.ts
|
|
7892
|
-
var selectRetainedStepEffect = (context) =>
|
|
8163
|
+
var selectRetainedStepEffect = (context) => Effect24.gen(function* () {
|
|
7893
8164
|
const output = context.env.GITHUB_OUTPUT;
|
|
7894
8165
|
if (!output)
|
|
7895
8166
|
return yield* fail("Expected GITHUB_OUTPUT");
|
|
@@ -7901,7 +8172,7 @@ runId=${result.runId}
|
|
|
7901
8172
|
` : `reuse=false
|
|
7902
8173
|
`));
|
|
7903
8174
|
});
|
|
7904
|
-
var stageBuildStepEffect = (context, directory, artifacts = "artifacts") =>
|
|
8175
|
+
var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effect24.gen(function* () {
|
|
7905
8176
|
const fs = yield* ReleaseFs;
|
|
7906
8177
|
const [installerAsset, archiveAsset] = platformAssets(context);
|
|
7907
8178
|
const [installer, archive] = electrobunArtifacts(context.config.appName, context.platform);
|
|
@@ -7910,12 +8181,12 @@ var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effe
|
|
|
7910
8181
|
yield* step(() => fs.mkdir(directory, { recursive: true }));
|
|
7911
8182
|
const packed = yield* scopedTempDirectory("framework-command-pack-");
|
|
7912
8183
|
const sources = {
|
|
7913
|
-
[installerAsset]:
|
|
7914
|
-
[archiveAsset]:
|
|
8184
|
+
[installerAsset]: join33(artifacts, installer),
|
|
8185
|
+
[archiveAsset]: join33(artifacts, archive)
|
|
7915
8186
|
};
|
|
7916
8187
|
for (const policy of parsed.commandArtifacts) {
|
|
7917
8188
|
const name = requirements.commandArtifacts[policy.kind][context.platform];
|
|
7918
|
-
sources[name] =
|
|
8189
|
+
sources[name] = join33(packed, name);
|
|
7919
8190
|
yield* step(() => packCommandArtifact({
|
|
7920
8191
|
source: policy.build,
|
|
7921
8192
|
archive: sources[name],
|
|
@@ -7924,8 +8195,8 @@ var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effe
|
|
|
7924
8195
|
}));
|
|
7925
8196
|
}
|
|
7926
8197
|
return yield* stagePlatformArtifactsEffect({ ...context, directory, sources });
|
|
7927
|
-
}).pipe(
|
|
7928
|
-
var inspectStagedStepEffect = (context, directory) =>
|
|
8198
|
+
}).pipe(Effect24.scoped);
|
|
8199
|
+
var inspectStagedStepEffect = (context, directory) => Effect24.gen(function* () {
|
|
7929
8200
|
const fs = yield* ReleaseFs;
|
|
7930
8201
|
const parsed = parseReleaseConfig(context.config);
|
|
7931
8202
|
const requirements = parsed.requirements(context.tag);
|
|
@@ -7933,10 +8204,10 @@ var inspectStagedStepEffect = (context, directory) => Effect22.gen(function* ()
|
|
|
7933
8204
|
const entries = yield* step(() => fs.readdir(directory, { withFileTypes: true }));
|
|
7934
8205
|
if (entries.length !== assets.length || entries.some((entry) => !entry.isFile() || !assets.includes(entry.name)))
|
|
7935
8206
|
return yield* fail("Staged platform directory contains unexpected files");
|
|
7936
|
-
const [installer, archive] = platformAssets(context).map((name) =>
|
|
8207
|
+
const [installer, archive] = platformAssets(context).map((name) => join33(directory, name));
|
|
7937
8208
|
for (const policy of parsed.commandArtifacts)
|
|
7938
8209
|
yield* step(() => readCommandArtifact({
|
|
7939
|
-
archive:
|
|
8210
|
+
archive: join33(directory, requirements.commandArtifacts[policy.kind][context.platform]),
|
|
7940
8211
|
executable: policy.executable,
|
|
7941
8212
|
platform: context.platform
|
|
7942
8213
|
}));
|
|
@@ -7952,12 +8223,12 @@ var inspectStagedStepEffect = (context, directory) => Effect22.gen(function* ()
|
|
|
7952
8223
|
}))
|
|
7953
8224
|
};
|
|
7954
8225
|
});
|
|
7955
|
-
var qualifyStepEffect = (context, directory) =>
|
|
8226
|
+
var qualifyStepEffect = (context, directory) => Effect24.gen(function* () {
|
|
7956
8227
|
const mode = stepRenderer(context.env);
|
|
7957
8228
|
yield* step(() => qualifyCommandArtifactsCommand({ ...context, directory }));
|
|
7958
8229
|
yield* step(() => qualifyInstallerCommand({ ...context, renderer: mode, directory }));
|
|
7959
8230
|
});
|
|
7960
|
-
var qualifyUpgradeStepEffect = (context, directory, onStage) =>
|
|
8231
|
+
var qualifyUpgradeStepEffect = (context, directory, onStage) => Effect24.suspend(() => {
|
|
7961
8232
|
const renderer = stepRenderer(context.env);
|
|
7962
8233
|
return step(() => qualifyUpgradeCommand({ ...context, renderer, directory, ...onStage ? { onStage } : {} }));
|
|
7963
8234
|
});
|
|
@@ -7988,19 +8259,55 @@ function electrobunArtifacts(appName, platform) {
|
|
|
7988
8259
|
}[platform];
|
|
7989
8260
|
}
|
|
7990
8261
|
|
|
8262
|
+
// src/library/daily-batch.ts
|
|
8263
|
+
import { join as join34, resolve as resolve16 } from "path";
|
|
8264
|
+
import { Effect as Effect25, Exit as Exit4 } from "effect";
|
|
8265
|
+
var stageDailyBatchEffect = (options) => Effect25.gen(function* () {
|
|
8266
|
+
const fs = yield* ReleaseFs;
|
|
8267
|
+
const parent = resolve16(options.parent);
|
|
8268
|
+
const root = yield* step(() => fs.lstat(parent));
|
|
8269
|
+
if (!root.isDirectory() || root.isSymbolicLink())
|
|
8270
|
+
return yield* fail("Daily staging needs an existing real scratch parent");
|
|
8271
|
+
const original = yield* verifyDailyReleaseMatrixEffect(options);
|
|
8272
|
+
const plan = yield* attempt(() => planDailyReleaseMatrix(options.config, options.identity.tag));
|
|
8273
|
+
const directory = yield* Effect25.acquireRelease(step(() => fs.mkdtemp(join34(parent, "daily-candidate-"))), (path, exit) => Exit4.isSuccess(exit) ? Effect25.void : Effect25.promise(() => fs.rm(path, { recursive: true, force: true })));
|
|
8274
|
+
const copy = (source, name, expected) => Effect25.gen(function* () {
|
|
8275
|
+
const target = join34(directory, name);
|
|
8276
|
+
yield* step(() => fs.mkdir(target, { mode: 448 }));
|
|
8277
|
+
yield* stageExpectedFilesEffect({
|
|
8278
|
+
expected,
|
|
8279
|
+
directory: target,
|
|
8280
|
+
sources: Object.fromEntries(expected.map((file) => [file, join34(source, file)]))
|
|
8281
|
+
});
|
|
8282
|
+
return target;
|
|
8283
|
+
});
|
|
8284
|
+
const artifacts = yield* copy(options.artifacts, "artifacts", plan.assets);
|
|
8285
|
+
const receipts = yield* copy(options.receipts, "receipts", plan.checks.map((check) => check.name + ".json"));
|
|
8286
|
+
const staged = yield* verifyDailyReleaseMatrixEffect({ ...options, artifacts, receipts });
|
|
8287
|
+
if (original.assets.some((a, index) => a.name !== staged.assets[index]?.name || a.size !== staged.assets[index]?.size || a.digest !== staged.assets[index]?.digest))
|
|
8288
|
+
return yield* fail("Daily inputs changed between inspection and local staging");
|
|
8289
|
+
const manifest = { schema: "framework/daily-staged-batch/v1", ...staged };
|
|
8290
|
+
yield* step(() => fs.writeFile(join34(directory, "candidate.json"), JSON.stringify(manifest) + `
|
|
8291
|
+
`, {
|
|
8292
|
+
flag: "wx",
|
|
8293
|
+
mode: 384
|
|
8294
|
+
}));
|
|
8295
|
+
return { directory, ...manifest };
|
|
8296
|
+
}).pipe(Effect25.scoped);
|
|
8297
|
+
|
|
7991
8298
|
// src/cli-runner.ts
|
|
7992
|
-
import { Cause as Cause3, Effect as
|
|
8299
|
+
import { Cause as Cause3, Effect as Effect26, Exit as Exit5 } from "effect";
|
|
7993
8300
|
function failureError(cause) {
|
|
7994
8301
|
const error = Cause3.squash(cause);
|
|
7995
8302
|
if (error instanceof ReleaseFailure)
|
|
7996
8303
|
return new Error(error.message);
|
|
7997
8304
|
return error instanceof Error ? error : new Error(String(error));
|
|
7998
8305
|
}
|
|
7999
|
-
var runCommand = (failure, program, options = {}) =>
|
|
8306
|
+
var runCommand = (failure, program, options = {}) => Effect26.gen(function* () {
|
|
8000
8307
|
const { env } = yield* ReleaseConfig;
|
|
8001
8308
|
const output = yield* ReleaseOutput;
|
|
8002
|
-
const exit = yield*
|
|
8003
|
-
if (
|
|
8309
|
+
const exit = yield* Effect26.exit(options.requireGitHubActions && env.GITHUB_ACTIONS !== "true" ? refuse("untrusted", "Invalid workflow invocation") : program);
|
|
8310
|
+
if (Exit5.isSuccess(exit))
|
|
8004
8311
|
return 0;
|
|
8005
8312
|
if (Cause3.hasInterruptsOnly(exit.cause))
|
|
8006
8313
|
return 130;
|
|
@@ -8010,7 +8317,7 @@ var runCommand = (failure, program, options = {}) => Effect23.gen(function* () {
|
|
|
8010
8317
|
return 1;
|
|
8011
8318
|
});
|
|
8012
8319
|
var readReleaseConfig = (path) => readBoundedJson(path, 262144);
|
|
8013
|
-
var readBoundedJson = (path, maxBytes, name = "configuration file") =>
|
|
8320
|
+
var readBoundedJson = (path, maxBytes, name = "configuration file") => Effect26.gen(function* () {
|
|
8014
8321
|
const fs = yield* ReleaseFs;
|
|
8015
8322
|
const info = yield* step(() => fs.lstat(path));
|
|
8016
8323
|
if (!info.isFile() || info.size < 1 || info.size > maxBytes)
|
|
@@ -8020,27 +8327,484 @@ var readBoundedJson = (path, maxBytes, name = "configuration file") => Effect23.
|
|
|
8020
8327
|
return yield* refuse("file-changed", `${name[0].toUpperCase()}${name.slice(1)} changed`);
|
|
8021
8328
|
return yield* step(async () => JSON.parse(bytes.toString("utf8")));
|
|
8022
8329
|
});
|
|
8023
|
-
var provideLivePorts = (program) => program.pipe(
|
|
8330
|
+
var provideLivePorts = (program) => program.pipe(Effect26.provideService(ReleaseConfig, {
|
|
8024
8331
|
env: process.env,
|
|
8025
8332
|
platform: process.platform,
|
|
8026
8333
|
arch: process.arch,
|
|
8027
8334
|
cwd: process.cwd()
|
|
8028
|
-
}),
|
|
8335
|
+
}), Effect26.provideService(ReleaseOutput, {
|
|
8029
8336
|
stdout: (text) => void process.stdout.write(text),
|
|
8030
8337
|
stderr: (text) => void process.stderr.write(text)
|
|
8031
|
-
}),
|
|
8338
|
+
}), Effect26.provideService(ReleaseGit, { run: gitRun }), Effect26.provideService(ReleaseGitHub, { run: ghRun, withEnvironment: ghRunWith }), Effect26.provideService(ReleaseFetch, { fetch }), Effect26.provideService(ReleaseClock, {
|
|
8032
8339
|
sleep: (milliseconds) => Bun.sleep(milliseconds),
|
|
8033
8340
|
now: () => new Date().toISOString()
|
|
8034
|
-
}),
|
|
8341
|
+
}), Effect26.provideService(ReleaseFs, nodeFs), Effect26.provideService(ReleaseSigning, {
|
|
8035
8342
|
privateKey: environmentKey(process.env),
|
|
8036
8343
|
codesign: codesignRun
|
|
8037
8344
|
}));
|
|
8038
8345
|
|
|
8039
|
-
// src/
|
|
8346
|
+
// src/commands/prepare-stable-catalog.ts
|
|
8040
8347
|
import { createHash as createHash16 } from "crypto";
|
|
8041
|
-
import {
|
|
8348
|
+
import { createReadStream } from "fs";
|
|
8349
|
+
import { lstat as lstat20, mkdir as mkdir11, readFile as readFile10, rm as rm10, writeFile as writeFile11 } from "fs/promises";
|
|
8350
|
+
import { basename as basename15, dirname as dirname14, join as join35 } from "path";
|
|
8351
|
+
|
|
8352
|
+
// src/library/stable-catalogs.ts
|
|
8353
|
+
function object(value) {
|
|
8354
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
8355
|
+
throw new Error("Expected a JSON object");
|
|
8356
|
+
return value;
|
|
8357
|
+
}
|
|
8358
|
+
function requireText(value, label, pattern) {
|
|
8359
|
+
if (typeof value !== "string" || value.length < 1 || value.length > 200 || Array.from(value).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) === 127) || pattern && !pattern.test(value))
|
|
8360
|
+
throw new Error(`Invalid ${label}`);
|
|
8361
|
+
return value;
|
|
8362
|
+
}
|
|
8363
|
+
function requireHttps(value, label) {
|
|
8364
|
+
const url = new URL(requireText(value, label));
|
|
8365
|
+
if (url.protocol !== "https:" || url.username || url.password || url.search || url.hash)
|
|
8366
|
+
throw new Error(`Expected canonical HTTPS URL for ${label}`);
|
|
8367
|
+
return url;
|
|
8368
|
+
}
|
|
8369
|
+
var sha = (value) => requireText(value, "SHA-256", /^[a-f0-9]{64}$/);
|
|
8370
|
+
var source = (value) => requireText(value, "source SHA", /^[a-f0-9]{40}$/);
|
|
8371
|
+
var file = (value) => requireText(value, "asset name", /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/);
|
|
8372
|
+
var quoted = JSON.stringify;
|
|
8373
|
+
var ruby = (value) => JSON.stringify(value).replace(/#(?=[{@$])/g, "\\#");
|
|
8374
|
+
function asset(value) {
|
|
8375
|
+
const row = object(value);
|
|
8376
|
+
const size = row.size;
|
|
8377
|
+
if (typeof size !== "number" || !Number.isSafeInteger(size) || size <= 0)
|
|
8378
|
+
throw new Error("Invalid asset size");
|
|
8379
|
+
return { name: file(row.name), size, sha256: sha(row.sha256) };
|
|
8380
|
+
}
|
|
8381
|
+
function select(value, name, tag, stable = false) {
|
|
8382
|
+
const doc = object(value);
|
|
8383
|
+
if (doc.tag !== tag || !Array.isArray(doc.assets) || stable && doc.channel !== "stable")
|
|
8384
|
+
throw new Error(stable ? "Expected matching Stable pointer" : "Expected exact asset manifest");
|
|
8385
|
+
const matching = doc.assets.filter((row) => object(row).name === name);
|
|
8386
|
+
if (matching.length !== 1)
|
|
8387
|
+
throw new Error("Expected exactly one matching installer asset");
|
|
8388
|
+
return asset(matching[0]);
|
|
8389
|
+
}
|
|
8390
|
+
function equal(actual, expected) {
|
|
8391
|
+
return actual.name === expected.name && actual.size === expected.size && actual.sha256 === expected.sha256;
|
|
8392
|
+
}
|
|
8393
|
+
function requireChecks(receipt, keys) {
|
|
8394
|
+
if (keys.some((key) => receipt[key] !== true))
|
|
8395
|
+
throw new Error("Missing required native signing, install, launch, upgrade or manager proof");
|
|
8396
|
+
}
|
|
8397
|
+
function prepareStableCatalog(input) {
|
|
8398
|
+
const { channel, phase, measuredAsset } = input;
|
|
8399
|
+
if (channel !== "homebrew" && channel !== "winget" || phase !== "preflight" && phase !== "published-stable")
|
|
8400
|
+
throw new Error("Invalid catalog channel or release phase");
|
|
8401
|
+
const config = object(input.config);
|
|
8402
|
+
const name = requireText(config.name, "product name");
|
|
8403
|
+
const desc = requireText(config.description, "description");
|
|
8404
|
+
const homepage = requireHttps(config.homepage, "homepage").href;
|
|
8405
|
+
const base = requireHttps(config.releaseBase, "release base");
|
|
8406
|
+
if (!base.pathname.endsWith("/"))
|
|
8407
|
+
throw new Error("Expected release base directory URL");
|
|
8408
|
+
const channelConfig = object(config[channel]);
|
|
8409
|
+
const receipt = object(input.receipt);
|
|
8410
|
+
const tag = requireText(receipt.tag, "release tag", /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/);
|
|
8411
|
+
if (receipt.schema !== "stable-catalog.v1" || receipt.channel !== channel)
|
|
8412
|
+
throw new Error("Wrong qualification receipt");
|
|
8413
|
+
if (source(receipt.sourceSha) !== source(input.expectedSourceSha))
|
|
8414
|
+
throw new Error("Receipt source differs from the protected candidate source");
|
|
8415
|
+
const template = requireText(channelConfig.artifact, "asset template", /^[A-Za-z0-9][A-Za-z0-9._-]*\{tag\}[A-Za-z0-9._-]*$/);
|
|
8416
|
+
const assetName = file(template.replace("{tag}", tag));
|
|
8417
|
+
if (!assetName.endsWith(channel === "homebrew" ? ".dmg" : ".zip"))
|
|
8418
|
+
throw new Error("Wrong installer format");
|
|
8419
|
+
const staged = select(input.manifest, assetName, tag);
|
|
8420
|
+
if (!equal(staged, asset(measuredAsset)) || !equal(staged, asset(receipt.asset)))
|
|
8421
|
+
throw new Error("Digest or size disagrees across installer bytes, manifest and receipt");
|
|
8422
|
+
if (phase === "published-stable" && !equal(staged, select(input.stablePointer, assetName, tag, true)))
|
|
8423
|
+
throw new Error("Stable pointer disagrees with installer release manifest");
|
|
8424
|
+
const version = tag.slice(1);
|
|
8425
|
+
const url = new URL(`${tag}/${assetName}`, base).href;
|
|
8426
|
+
requireChecks(receipt, [
|
|
8427
|
+
"freshInstall",
|
|
8428
|
+
"launch",
|
|
8429
|
+
"upgrade",
|
|
8430
|
+
"profileRetained",
|
|
8431
|
+
"managerOwnsUpdates"
|
|
8432
|
+
]);
|
|
8433
|
+
if (channel === "homebrew") {
|
|
8434
|
+
requireChecks(receipt, ["developerId", "notarized"]);
|
|
8435
|
+
if (receipt.platform !== "macos-arm64")
|
|
8436
|
+
throw new Error("Wrong macOS qualification platform");
|
|
8437
|
+
const token = requireText(channelConfig.token, "cask token", /^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
8438
|
+
const bundle = requireText(channelConfig.bundle, "app bundle", /^[A-Za-z0-9][A-Za-z0-9 ._-]*\.app$/);
|
|
8439
|
+
return [
|
|
8440
|
+
{
|
|
8441
|
+
path: `Casks/${token}.rb`,
|
|
8442
|
+
contents: `cask ${ruby(token)} do
|
|
8443
|
+
version ${ruby(version)}
|
|
8444
|
+
sha256 ${ruby(staged.sha256)}
|
|
8445
|
+
|
|
8446
|
+
url ${ruby(url)}
|
|
8447
|
+
name ${ruby(name)}
|
|
8448
|
+
desc ${ruby(desc)}
|
|
8449
|
+
homepage ${ruby(homepage)}
|
|
8450
|
+
|
|
8451
|
+
depends_on arch: :arm64
|
|
8452
|
+
|
|
8453
|
+
app ${ruby(bundle)}
|
|
8454
|
+
end
|
|
8455
|
+
`
|
|
8456
|
+
}
|
|
8457
|
+
];
|
|
8458
|
+
}
|
|
8459
|
+
requireChecks(receipt, ["authenticode", "windows11", "windows10", "unattended", "uninstall"]);
|
|
8460
|
+
if (receipt.platform !== "windows-x64")
|
|
8461
|
+
throw new Error("Wrong Windows qualification platform");
|
|
8462
|
+
const id = requireText(channelConfig.identifier, "WinGet package identifier", /^[A-Za-z0-9][A-Za-z0-9-]*(\.[A-Za-z0-9][A-Za-z0-9-]*)+$/);
|
|
8463
|
+
const publisher = requireText(channelConfig.publisher, "WinGet publisher");
|
|
8464
|
+
const license = requireText(channelConfig.license, "license");
|
|
8465
|
+
const exe = requireText(receipt.nestedInstaller, "nested executable", /^[A-Za-z0-9][A-Za-z0-9 ._-]*\.exe$/i);
|
|
8466
|
+
const flags = /^[-/][a-zA-Z0-9_-]+(?: [-/][a-zA-Z0-9_-]+)*$/;
|
|
8467
|
+
const silent = requireText(receipt.silent, "silent flags", flags);
|
|
8468
|
+
const progress = requireText(receipt.silentWithProgress, "silent progress flags", flags);
|
|
8469
|
+
const schemaVersion = "1.12.0";
|
|
8470
|
+
const path = `manifests/${id[0].toLowerCase()}/${id.replaceAll(".", "/")}/${version}/${id}`;
|
|
8471
|
+
const manifest = (type, body) => `# yaml-language-server: $schema=https://aka.ms/winget-manifest.${type}.${schemaVersion}.schema.json
|
|
8472
|
+
PackageIdentifier: ${quoted(id)}
|
|
8473
|
+
PackageVersion: ${quoted(version)}
|
|
8474
|
+
${body}ManifestType: ${type}
|
|
8475
|
+
ManifestVersion: ${schemaVersion}
|
|
8476
|
+
`;
|
|
8477
|
+
return [
|
|
8478
|
+
{ path: `${path}.yaml`, contents: manifest("version", `DefaultLocale: en-US
|
|
8479
|
+
`) },
|
|
8480
|
+
{
|
|
8481
|
+
path: `${path}.installer.yaml`,
|
|
8482
|
+
contents: manifest("installer", `InstallerType: zip
|
|
8483
|
+
NestedInstallerType: exe
|
|
8484
|
+
NestedInstallerFiles:
|
|
8485
|
+
- RelativeFilePath: ${quoted(exe)}
|
|
8486
|
+
InstallerSwitches:
|
|
8487
|
+
Silent: ${quoted(silent)}
|
|
8488
|
+
SilentWithProgress: ${quoted(progress)}
|
|
8489
|
+
Installers:
|
|
8490
|
+
- Architecture: x64
|
|
8491
|
+
InstallerUrl: ${quoted(url)}
|
|
8492
|
+
InstallerSha256: ${staged.sha256.toUpperCase()}
|
|
8493
|
+
`)
|
|
8494
|
+
},
|
|
8495
|
+
{
|
|
8496
|
+
path: `${path}.locale.en-US.yaml`,
|
|
8497
|
+
contents: manifest("defaultLocale", `PackageLocale: en-US
|
|
8498
|
+
Publisher: ${quoted(publisher)}
|
|
8499
|
+
PublisherUrl: ${quoted(homepage)}
|
|
8500
|
+
PackageName: ${quoted(name)}
|
|
8501
|
+
PackageUrl: ${quoted(homepage)}
|
|
8502
|
+
License: ${quoted(license)}
|
|
8503
|
+
ShortDescription: ${quoted(desc)}
|
|
8504
|
+
`)
|
|
8505
|
+
}
|
|
8506
|
+
];
|
|
8507
|
+
}
|
|
8508
|
+
|
|
8509
|
+
// src/commands/prepare-stable-catalog.ts
|
|
8510
|
+
var read2 = async (path) => {
|
|
8511
|
+
const stat = await lstat20(path);
|
|
8512
|
+
if (!stat.isFile() || stat.size > 1024 * 1024)
|
|
8513
|
+
throw new Error("Expected bounded ordinary JSON file");
|
|
8514
|
+
return JSON.parse(await readFile10(path, "utf8"));
|
|
8515
|
+
};
|
|
8516
|
+
async function prepareStableCatalogCommand(args) {
|
|
8517
|
+
const [
|
|
8518
|
+
channel,
|
|
8519
|
+
phase,
|
|
8520
|
+
expectedSourceSha,
|
|
8521
|
+
configPath,
|
|
8522
|
+
receiptPath,
|
|
8523
|
+
manifestPath,
|
|
8524
|
+
artifact,
|
|
8525
|
+
out,
|
|
8526
|
+
stablePointerPath,
|
|
8527
|
+
...extra
|
|
8528
|
+
] = args;
|
|
8529
|
+
if (channel !== "homebrew" && channel !== "winget" || phase !== "preflight" && phase !== "published-stable" || !expectedSourceSha || !configPath || !receiptPath || !manifestPath || !artifact || !out || extra.length || phase === "published-stable" !== Boolean(stablePointerPath))
|
|
8530
|
+
throw new Error("Expected channel, phase, source SHA, config, receipt, manifest, archive, new output directory [stable pointer]");
|
|
8531
|
+
const st = await lstat20(artifact);
|
|
8532
|
+
if (!st.isFile())
|
|
8533
|
+
throw new Error("Expected ordinary installer file");
|
|
8534
|
+
const hash = createHash16("sha256");
|
|
8535
|
+
for await (const chunk of createReadStream(artifact))
|
|
8536
|
+
hash.update(chunk);
|
|
8537
|
+
const files = prepareStableCatalog({
|
|
8538
|
+
channel,
|
|
8539
|
+
phase,
|
|
8540
|
+
expectedSourceSha,
|
|
8541
|
+
config: await read2(configPath),
|
|
8542
|
+
receipt: await read2(receiptPath),
|
|
8543
|
+
manifest: await read2(manifestPath),
|
|
8544
|
+
stablePointer: stablePointerPath && await read2(stablePointerPath),
|
|
8545
|
+
measuredAsset: { name: basename15(artifact), size: st.size, sha256: hash.digest("hex") }
|
|
8546
|
+
});
|
|
8547
|
+
await mkdir11(out);
|
|
8548
|
+
try {
|
|
8549
|
+
for (const entry of files) {
|
|
8550
|
+
const target = join35(out, entry.path);
|
|
8551
|
+
await mkdir11(dirname14(target), { recursive: true });
|
|
8552
|
+
await writeFile11(target, entry.contents, { flag: "wx" });
|
|
8553
|
+
}
|
|
8554
|
+
return { channel, phase, files: files.length };
|
|
8555
|
+
} catch (error) {
|
|
8556
|
+
await rm10(out, { recursive: true, force: true });
|
|
8557
|
+
throw error;
|
|
8558
|
+
}
|
|
8559
|
+
}
|
|
8560
|
+
|
|
8561
|
+
// src/library/apt/stage-apt-repository.ts
|
|
8562
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
8563
|
+
import { mkdir as mkdir12, readFile as readFile11, rm as rm11, writeFile as writeFile12 } from "fs/promises";
|
|
8564
|
+
import { dirname as dirname15, isAbsolute as isAbsolute6, join as join36 } from "path";
|
|
8565
|
+
|
|
8566
|
+
// src/library/apt/apt-metadata.ts
|
|
8567
|
+
import { createHash as createHash17 } from "crypto";
|
|
8568
|
+
import { gzipSync } from "zlib";
|
|
8569
|
+
var sha256 = (data) => createHash17("sha256").update(data).digest("hex");
|
|
8570
|
+
function stageAptMetadata({ policy, tag, assets, deb, control, now }) {
|
|
8571
|
+
if (!/^v(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)$/.test(tag))
|
|
8572
|
+
throw new Error("Invalid release tag");
|
|
8573
|
+
const { packageName, architecture, assetName: name, suite, origin } = policy;
|
|
8574
|
+
if (!/^[a-z][a-z0-9+.-]{1,62}$/.test(packageName) || architecture !== "amd64" && architecture !== "arm64" || !/^[A-Za-z0-9][A-Za-z0-9_.+-]*\.deb$/.test(name) || suite !== "daily" && suite !== "stable" || !/^[A-Za-z0-9][A-Za-z0-9 .+_-]{0,62}$/.test(origin))
|
|
8575
|
+
throw new Error("Invalid Debian repository policy");
|
|
8576
|
+
const matching = assets.filter((asset) => asset.name === name);
|
|
8577
|
+
if (matching.length !== 1)
|
|
8578
|
+
throw new Error("Require one staged Debian artifact");
|
|
8579
|
+
const asset = matching[0];
|
|
8580
|
+
if (!deb.length || asset.size !== deb.length || asset.sha256 !== sha256(deb))
|
|
8581
|
+
throw new Error("Staged Debian bytes do not match the verified release inventory");
|
|
8582
|
+
const fields = new Map;
|
|
8583
|
+
let lines = control.replaceAll(`\r
|
|
8584
|
+
`, `
|
|
8585
|
+
`).split(`
|
|
8586
|
+
`);
|
|
8587
|
+
if (lines.at(-1) === "")
|
|
8588
|
+
lines = lines.slice(0, -1);
|
|
8589
|
+
for (const [index, line] of lines.entries()) {
|
|
8590
|
+
if (/^[ \t]/.test(line) && index !== 0)
|
|
8591
|
+
continue;
|
|
8592
|
+
const field = /^([a-z][a-z0-9-]*):[ \t]*(.*)$/i.exec(line);
|
|
8593
|
+
if (!field || fields.has(field[1].toLowerCase()))
|
|
8594
|
+
throw new Error("Invalid or duplicate Debian control field");
|
|
8595
|
+
fields.set(field[1].toLowerCase(), field[2]);
|
|
8596
|
+
}
|
|
8597
|
+
for (const key of ["filename", "size", "md5sum", "sha1", "sha256", "sha512"])
|
|
8598
|
+
if (fields.has(key))
|
|
8599
|
+
throw new Error("Debian control includes repository-owned metadata");
|
|
8600
|
+
if (fields.get("package") !== packageName || fields.get("version") !== tag.slice(1) || fields.get("architecture") !== architecture || !fields.get("description"))
|
|
8601
|
+
throw new Error("Unexpected Debian package, version, architecture or description");
|
|
8602
|
+
if (!Number.isFinite(now.getTime()))
|
|
8603
|
+
throw new Error("Invalid release timestamp");
|
|
8604
|
+
const filename = `pool/main/${packageName[0]}/${packageName}/${name}`;
|
|
8605
|
+
const entries = `${lines.join(`
|
|
8606
|
+
`)}
|
|
8607
|
+
Filename: ${filename}
|
|
8608
|
+
Size: ${asset.size}
|
|
8609
|
+
SHA256: ${asset.sha256}
|
|
8610
|
+
|
|
8611
|
+
`;
|
|
8612
|
+
const plain = new TextEncoder().encode(entries);
|
|
8613
|
+
const compressed = gzipSync(plain);
|
|
8614
|
+
const directories = `main/binary-${architecture}`;
|
|
8615
|
+
const members = [
|
|
8616
|
+
[`${directories}/Packages`, plain],
|
|
8617
|
+
[`${directories}/Packages.gz`, compressed]
|
|
8618
|
+
];
|
|
8619
|
+
const release = [
|
|
8620
|
+
`Origin: ${origin}`,
|
|
8621
|
+
`Label: ${origin} ${suite}`,
|
|
8622
|
+
`Suite: ${suite}`,
|
|
8623
|
+
`Codename: ${suite}`,
|
|
8624
|
+
`Date: ${now.toUTCString()}`,
|
|
8625
|
+
`Valid-Until: ${new Date(now.getTime() + 30 * 86400000).toUTCString()}`,
|
|
8626
|
+
`Architectures: ${architecture}`,
|
|
8627
|
+
"Components: main",
|
|
8628
|
+
"Acquire-By-Hash: yes",
|
|
8629
|
+
"SHA256:",
|
|
8630
|
+
...members.map(([path, bytes]) => ` ${sha256(bytes)} ${bytes.length} ${path}`),
|
|
8631
|
+
""
|
|
8632
|
+
].join(`
|
|
8633
|
+
`);
|
|
8634
|
+
return {
|
|
8635
|
+
packagePath: filename,
|
|
8636
|
+
release,
|
|
8637
|
+
files: new Map([
|
|
8638
|
+
...members,
|
|
8639
|
+
...members.map(([, bytes]) => [`${directories}/by-hash/SHA256/${sha256(bytes)}`, bytes])
|
|
8640
|
+
])
|
|
8641
|
+
};
|
|
8642
|
+
}
|
|
8643
|
+
|
|
8644
|
+
// src/library/apt/stage-apt-repository.ts
|
|
8645
|
+
function cmd(program, options, label) {
|
|
8646
|
+
const run = spawnSync2(program, options, { encoding: "utf8", timeout: 60000 });
|
|
8647
|
+
if (run.error || run.status !== 0)
|
|
8648
|
+
throw new Error(label);
|
|
8649
|
+
return run.stdout;
|
|
8650
|
+
}
|
|
8651
|
+
async function add(path, bytes) {
|
|
8652
|
+
await mkdir12(dirname15(path), { recursive: true });
|
|
8653
|
+
await writeFile12(path, bytes, { flag: "wx" });
|
|
8654
|
+
}
|
|
8655
|
+
async function stageAptRepositoryCommand(args) {
|
|
8656
|
+
const [tag, policyPath, inventoryPath, packagePath, output, signingHome, trustedFingerprint] = args;
|
|
8657
|
+
if (args.length !== 7 || !tag || !/^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(tag) || !policyPath || !inventoryPath || !packagePath || !output || !signingHome || !isAbsolute6(signingHome) || !trustedFingerprint || !/^[A-F0-9]{40}$/.test(trustedFingerprint))
|
|
8658
|
+
throw new Error("Expected TAG POLICY VERIFIED_INVENTORY DEB NEW_OUTPUT GPG_HOME PINNED_FINGERPRINT");
|
|
8659
|
+
const policy = JSON.parse(await readFile11(policyPath, "utf8"));
|
|
8660
|
+
const inventory = JSON.parse(await readFile11(inventoryPath, "utf8"));
|
|
8661
|
+
if (inventory.tag !== tag || !Array.isArray(inventory.assets))
|
|
8662
|
+
throw new Error("Verified inventory does not name requested release");
|
|
8663
|
+
const deb = await readFile11(packagePath);
|
|
8664
|
+
await mkdir12(output, { mode: 448 });
|
|
8665
|
+
try {
|
|
8666
|
+
const stagedInput = join36(output, ".input.deb");
|
|
8667
|
+
await writeFile12(stagedInput, deb, { mode: 384, flag: "wx" });
|
|
8668
|
+
const control = cmd("dpkg-deb", ["--field", stagedInput], "Debian control inspection failed");
|
|
8669
|
+
const staged = stageAptMetadata({
|
|
8670
|
+
policy,
|
|
8671
|
+
tag,
|
|
8672
|
+
assets: inventory.assets,
|
|
8673
|
+
deb,
|
|
8674
|
+
control,
|
|
8675
|
+
now: new Date
|
|
8676
|
+
});
|
|
8677
|
+
const base = join36(output, "dists", policy.suite);
|
|
8678
|
+
await add(join36(output, staged.packagePath), deb);
|
|
8679
|
+
for (const [path, contents] of staged.files)
|
|
8680
|
+
await add(join36(base, path), contents);
|
|
8681
|
+
await add(join36(base, "Release"), staged.release);
|
|
8682
|
+
const flags = [
|
|
8683
|
+
"--batch",
|
|
8684
|
+
"--no-tty",
|
|
8685
|
+
"--pinentry-mode",
|
|
8686
|
+
"error",
|
|
8687
|
+
"--homedir",
|
|
8688
|
+
signingHome,
|
|
8689
|
+
"--local-user",
|
|
8690
|
+
`${trustedFingerprint}!`,
|
|
8691
|
+
"--digest-algo",
|
|
8692
|
+
"SHA256"
|
|
8693
|
+
];
|
|
8694
|
+
for (const [name, mode] of [
|
|
8695
|
+
["InRelease", "--clearsign"],
|
|
8696
|
+
["Release.gpg", "--detach-sign"]
|
|
8697
|
+
]) {
|
|
8698
|
+
cmd("gpg", [...flags, "--armor", "--output", join36(base, name), mode, join36(base, "Release")], `Could not produce ${name} with the pinned signing identity`);
|
|
8699
|
+
}
|
|
8700
|
+
const { unlink } = await import("fs/promises");
|
|
8701
|
+
await unlink(stagedInput);
|
|
8702
|
+
await add(join36(output, "STAGED"), `${tag}
|
|
8703
|
+
`);
|
|
8704
|
+
return { tag, staged: true };
|
|
8705
|
+
} catch (error) {
|
|
8706
|
+
await rm11(output, { recursive: true, force: true });
|
|
8707
|
+
throw error;
|
|
8708
|
+
}
|
|
8709
|
+
}
|
|
8710
|
+
|
|
8711
|
+
// src/linux-channel-proof-cli.ts
|
|
8712
|
+
import { spawnSync as spawnSync3 } from "child_process";
|
|
8713
|
+
import { createHash as createHash18 } from "crypto";
|
|
8714
|
+
import { createReadStream as createReadStream2 } from "fs";
|
|
8715
|
+
import { lstat as lstat21, readFile as readFile12, realpath as realpath10 } from "fs/promises";
|
|
8716
|
+
import { join as join37 } from "path";
|
|
8717
|
+
import { pathToFileURL } from "url";
|
|
8718
|
+
function check(ok, message) {
|
|
8719
|
+
if (!ok)
|
|
8720
|
+
throw new Error(message);
|
|
8721
|
+
}
|
|
8722
|
+
async function hash(path) {
|
|
8723
|
+
check((await lstat21(path)).isFile(), "artifact must be a regular file");
|
|
8724
|
+
const digest = createHash18("sha256");
|
|
8725
|
+
for await (const chunk of createReadStream2(path))
|
|
8726
|
+
digest.update(chunk);
|
|
8727
|
+
return digest.digest("hex");
|
|
8728
|
+
}
|
|
8729
|
+
function options(text, section) {
|
|
8730
|
+
const values = new Map;
|
|
8731
|
+
let matched = false;
|
|
8732
|
+
for (const raw of text.split(/\r?\n/)) {
|
|
8733
|
+
const line = raw.trim();
|
|
8734
|
+
if (!line || line.startsWith("#") || line.startsWith(";"))
|
|
8735
|
+
continue;
|
|
8736
|
+
if (line === `[${section}]` && !matched) {
|
|
8737
|
+
matched = true;
|
|
8738
|
+
continue;
|
|
8739
|
+
}
|
|
8740
|
+
const field = /^([a-z_]+)\s*=\s*(\S+)$/.exec(line);
|
|
8741
|
+
check(matched && field && !values.has(field[1]), "unexpected or duplicate repository option");
|
|
8742
|
+
values.set(field[1], field[2]);
|
|
8743
|
+
}
|
|
8744
|
+
check(matched, "expected exactly one repository section");
|
|
8745
|
+
return values;
|
|
8746
|
+
}
|
|
8747
|
+
async function verifyRpmStage(stage) {
|
|
8748
|
+
check(/^[0-9a-f]{40}$/.test(stage.sourceSha), "expected an exact source commit");
|
|
8749
|
+
check(/^[a-z0-9][a-z0-9._+-]*$/.test(stage.packageName), "invalid RPM package name");
|
|
8750
|
+
check(/^[a-zA-Z0-9][a-zA-Z0-9._+~^]*$/.test(stage.version), "invalid RPM version");
|
|
8751
|
+
check(stage.architecture === "x86_64", "only x86_64 is supported");
|
|
8752
|
+
check(/^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/.test(stage.repoId), "invalid repository ID");
|
|
8753
|
+
for (const artifact of [stage.payload, stage.rpm]) {
|
|
8754
|
+
check(/^[0-9a-f]{64}$/.test(artifact.sha256), "expected SHA-256");
|
|
8755
|
+
check(await hash(artifact.path) === artifact.sha256, "staged artifact digest mismatch");
|
|
8756
|
+
}
|
|
8757
|
+
const repo = await realpath10(stage.repository);
|
|
8758
|
+
const keyUrl = pathToFileURL(await realpath10(stage.publicKey)).href;
|
|
8759
|
+
const config = options(await readFile12(stage.repoFile, "utf8"), stage.repoId);
|
|
8760
|
+
check(config.get("baseurl") === pathToFileURL(repo).href, "expected the local repository");
|
|
8761
|
+
check(config.get("gpgkey") === keyUrl, "expected the configured QA public key");
|
|
8762
|
+
for (const flag of ["pkg_gpgcheck", "repo_gpgcheck"]) {
|
|
8763
|
+
check(config.get(flag) === "1", `${flag} must be enabled`);
|
|
8764
|
+
}
|
|
8765
|
+
const allowed = new Set(["name", "enabled", "baseurl", "gpgkey", "pkg_gpgcheck", "repo_gpgcheck"]);
|
|
8766
|
+
check([...config.keys()].every((key) => allowed.has(key)), "unexpected repository options");
|
|
8767
|
+
for (const path of [
|
|
8768
|
+
stage.publicKey,
|
|
8769
|
+
join37(repo, "repodata/repomd.xml"),
|
|
8770
|
+
join37(repo, "repodata/repomd.xml.asc")
|
|
8771
|
+
]) {
|
|
8772
|
+
check((await lstat21(path)).isFile(), "expected regular key and signed metadata files");
|
|
8773
|
+
}
|
|
8774
|
+
const result = spawnSync3("rpm", ["-qp", "--queryformat", "%{NAME}|%{VERSION}|%{ARCH}", await realpath10(stage.rpm.path)], { encoding: "utf8", timeout: 1e4 });
|
|
8775
|
+
check(result.error?.code !== "ENOENT", "rpm is required for RPM header verification");
|
|
8776
|
+
check(result.status === 0 && result.stdout === `${stage.packageName}|${stage.version}|${stage.architecture}`, "RPM header does not match the requested package, version and architecture");
|
|
8777
|
+
return { kind: "rpm-staging-inputs", sourceSha: stage.sourceSha };
|
|
8778
|
+
}
|
|
8779
|
+
var systemTalkDenied = /^(org\.freedesktop\.(Flatpak|DBus|systemd1)|org\.gtk\.GDBus)(\.|$)/;
|
|
8780
|
+
function verifyFlatpakCapabilities(policy, result) {
|
|
8781
|
+
check(/^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*){2,}$/.test(policy.applicationId) && result.applicationId === policy.applicationId, "unexpected Flatpak app identity");
|
|
8782
|
+
check(/^[0-9a-f]{40}$/.test(policy.sourceSha) && result.sourceSha === policy.sourceSha && /^[0-9a-f]{64}$/.test(policy.artifactSha256) && result.artifactSha256 === policy.artifactSha256, "Flatpak evidence does not match the expected source and artifact");
|
|
8783
|
+
check(result.architecture === "x86_64", "only x86_64 is supported");
|
|
8784
|
+
const cap = policy.permissions;
|
|
8785
|
+
const actual = result.effectivePermissions;
|
|
8786
|
+
check(cap.sockets.every((name) => name === "wayland" || name === "pulseaudio"), "unsafe socket policy");
|
|
8787
|
+
check(cap.devices.every((name) => name === "dri"), "unsafe device policy");
|
|
8788
|
+
check(cap.sessionTalkNames.every((name) => /^[A-Za-z_][\w-]*(\.[A-Za-z_][\w-]*)+$/.test(name) && !systemTalkDenied.test(name)), "unsafe session-bus policy");
|
|
8789
|
+
check(typeof actual.network === "boolean" && typeof cap.network === "boolean" && (!actual.network || cap.network === true) && actual.sockets.every((name) => cap.sockets.some((allowed) => allowed === name)) && actual.devices.every((name) => cap.devices.some((allowed) => allowed === name)) && actual.sessionTalkNames.every((name) => cap.sessionTalkNames.includes(name)) && actual.filesystems.length === 0 && actual.systemTalkNames.length === 0, "effective Flatpak permissions exceed policy");
|
|
8790
|
+
check([
|
|
8791
|
+
result.localRepositoryInstall,
|
|
8792
|
+
result.upgradedAndRetainedData,
|
|
8793
|
+
result.sandboxedRenderer,
|
|
8794
|
+
result.portalSelectedWorkspace,
|
|
8795
|
+
result.sandboxTerminalAndCli,
|
|
8796
|
+
result.unselectedWorkspaceDenied,
|
|
8797
|
+
result.hostCredentialsDenied,
|
|
8798
|
+
result.genericHostExecutionDenied
|
|
8799
|
+
].every((outcome) => outcome === true), "missing a required Flatpak capability or isolation observation");
|
|
8800
|
+
return { kind: "flatpak-observations", sourceSha: result.sourceSha };
|
|
8801
|
+
}
|
|
8802
|
+
|
|
8803
|
+
// src/library/arch-publish.ts
|
|
8804
|
+
import { createHash as createHash19 } from "crypto";
|
|
8805
|
+
import { join as join38 } from "path";
|
|
8042
8806
|
import { tmpdir as tmpdir5 } from "os";
|
|
8043
|
-
import { Effect as
|
|
8807
|
+
import { Effect as Effect27 } from "effect";
|
|
8044
8808
|
|
|
8045
8809
|
// ../../src/release/arch-package.ts
|
|
8046
8810
|
function archPkgver(tag) {
|
|
@@ -8221,7 +8985,7 @@ exec pacman -S --needed --noconfirm "$@"
|
|
|
8221
8985
|
// src/library/arch-publish.ts
|
|
8222
8986
|
var AUR_HOST_KEY = "aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN";
|
|
8223
8987
|
var MAX_LICENSE_BYTES = 1024 * 1024;
|
|
8224
|
-
var feedBytes = (feed, path, maximum) =>
|
|
8988
|
+
var feedBytes = (feed, path, maximum) => Effect27.gen(function* () {
|
|
8225
8989
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
8226
8990
|
const scope = feedUrl(feed);
|
|
8227
8991
|
const response = yield* step(() => fetchReleaseLocation(`${scope}${path}`, scope, fetch2, AbortSignal.timeout(30000)));
|
|
@@ -8231,7 +8995,7 @@ var feedBytes = (feed, path, maximum) => Effect24.gen(function* () {
|
|
|
8231
8995
|
}
|
|
8232
8996
|
return yield* step(() => readReleaseBytes(response, maximum));
|
|
8233
8997
|
});
|
|
8234
|
-
var feedJson = (feed, path, maximum) =>
|
|
8998
|
+
var feedJson = (feed, path, maximum) => Effect27.gen(function* () {
|
|
8235
8999
|
const bytes = yield* feedBytes(feed, path, maximum);
|
|
8236
9000
|
if (!bytes)
|
|
8237
9001
|
return null;
|
|
@@ -8243,13 +9007,13 @@ var feedJson = (feed, path, maximum) => Effect24.gen(function* () {
|
|
|
8243
9007
|
}
|
|
8244
9008
|
});
|
|
8245
9009
|
});
|
|
8246
|
-
var readChannelTag = (feed, channel) =>
|
|
9010
|
+
var readChannelTag = (feed, channel) => Effect27.gen(function* () {
|
|
8247
9011
|
const parsed = yield* feedJson(feed, `channels/${channel}.json`, 262144);
|
|
8248
9012
|
if (parsed === null)
|
|
8249
9013
|
return null;
|
|
8250
9014
|
return yield* step(async () => parseFeedRelease(parsed).tag);
|
|
8251
9015
|
});
|
|
8252
|
-
var readLicense = (url) =>
|
|
9016
|
+
var readLicense = (url) => Effect27.gen(function* () {
|
|
8253
9017
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
8254
9018
|
const response = yield* step(() => fetch2(url, { redirect: "follow", signal: AbortSignal.timeout(30000) }));
|
|
8255
9019
|
if (response.status !== 200 || !response.body) {
|
|
@@ -8257,12 +9021,12 @@ var readLicense = (url) => Effect24.gen(function* () {
|
|
|
8257
9021
|
return yield* fail("Release license is unavailable");
|
|
8258
9022
|
}
|
|
8259
9023
|
const bytes = yield* step(() => readReleaseBytes(response, MAX_LICENSE_BYTES));
|
|
8260
|
-
const sha256 = yield* step(async () =>
|
|
9024
|
+
const sha256 = yield* step(async () => createHash19("sha256").update(bytes).digest("hex"));
|
|
8261
9025
|
return { url, sha256 };
|
|
8262
9026
|
});
|
|
8263
|
-
var git2 = (args) =>
|
|
9027
|
+
var git2 = (args) => Effect27.gen(function* () {
|
|
8264
9028
|
const { run } = yield* ReleaseGit;
|
|
8265
|
-
return yield*
|
|
9029
|
+
return yield* Effect27.tryPromise({
|
|
8266
9030
|
try: () => run(args),
|
|
8267
9031
|
catch: (error) => {
|
|
8268
9032
|
const stderr = String(error.stderr ?? "").trim().split(`
|
|
@@ -8275,11 +9039,11 @@ var git2 = (args) => Effect24.gen(function* () {
|
|
|
8275
9039
|
}
|
|
8276
9040
|
});
|
|
8277
9041
|
});
|
|
8278
|
-
var gitExit = (args) =>
|
|
9042
|
+
var gitExit = (args) => Effect27.gen(function* () {
|
|
8279
9043
|
const { run } = yield* ReleaseGit;
|
|
8280
|
-
return yield*
|
|
9044
|
+
return yield* Effect27.promise(() => run(args).then(() => 0, (error) => Number(error.code ?? 1) || 1));
|
|
8281
9045
|
});
|
|
8282
|
-
var verifyArchRelease = (options) =>
|
|
9046
|
+
var verifyArchRelease = (options) => Effect27.gen(function* () {
|
|
8283
9047
|
const parsed = parseReleaseConfig(options.config);
|
|
8284
9048
|
const { config } = options;
|
|
8285
9049
|
const repository = typeof config.repository === "string" && isRepositorySlug(config.repository) ? config.repository : null;
|
|
@@ -8299,7 +9063,7 @@ var verifyArchRelease = (options) => Effect24.gen(function* () {
|
|
|
8299
9063
|
if (!listed)
|
|
8300
9064
|
return yield* fail(`Missing signed descriptor: ${descriptorPolicy.name}`);
|
|
8301
9065
|
const bytes = yield* feedBytes(options.feed, `${options.tag}/${descriptorPolicy.name}`, 65536);
|
|
8302
|
-
if (!bytes || bytes.length !== listed.size ||
|
|
9066
|
+
if (!bytes || bytes.length !== listed.size || createHash19("sha256").update(bytes).digest("hex") !== listed.sha256)
|
|
8303
9067
|
return yield* fail(`Signed descriptor differs from its release: ${descriptorPolicy.name}`);
|
|
8304
9068
|
const json = yield* step(async () => {
|
|
8305
9069
|
try {
|
|
@@ -8329,7 +9093,7 @@ var verifyArchRelease = (options) => Effect24.gen(function* () {
|
|
|
8329
9093
|
return yield* fail("Signed descriptor does not bind the published archive");
|
|
8330
9094
|
return descriptor.asset;
|
|
8331
9095
|
});
|
|
8332
|
-
var publishArchPackageEffect = (options) =>
|
|
9096
|
+
var publishArchPackageEffect = (options) => Effect27.gen(function* () {
|
|
8333
9097
|
const { archPackage: policy, feed } = parseReleaseConfig(options.config);
|
|
8334
9098
|
if (!policy)
|
|
8335
9099
|
return { status: "not-configured" };
|
|
@@ -8371,7 +9135,7 @@ var publishArchPackageEffect = (options) => Effect24.gen(function* () {
|
|
|
8371
9135
|
const directory = options.printDirectory;
|
|
8372
9136
|
yield* step(() => fs.mkdir(directory, { recursive: true }));
|
|
8373
9137
|
for (const [name, contents] of Object.entries({ ...files, ...repositoryFiles }))
|
|
8374
|
-
yield* step(() => fs.writeFile(
|
|
9138
|
+
yield* step(() => fs.writeFile(join38(directory, name), contents, { mode: 420 }));
|
|
8375
9139
|
}
|
|
8376
9140
|
const base = { pkgname: policy.pkgname, pkgver: rendered.pkgver, pkgrel };
|
|
8377
9141
|
if (options.dryRun)
|
|
@@ -8383,15 +9147,15 @@ var publishArchPackageEffect = (options) => Effect24.gen(function* () {
|
|
|
8383
9147
|
const key = Buffer.from(encodedKey, "base64").toString("utf8");
|
|
8384
9148
|
if (!key.includes("PRIVATE KEY"))
|
|
8385
9149
|
return yield* fail("AUR_SSH_PRIVATE_KEY_B64 is not a private key");
|
|
8386
|
-
return yield*
|
|
8387
|
-
const work = yield* step(() => fs.mkdtemp(
|
|
8388
|
-
yield*
|
|
9150
|
+
return yield* Effect27.gen(function* () {
|
|
9151
|
+
const work = yield* step(() => fs.mkdtemp(join38(tmpdir5(), "arch-package-")));
|
|
9152
|
+
yield* Effect27.addFinalizer(() => Effect27.promise(() => fs.rm(work, { recursive: true, force: true }).then(() => {
|
|
8389
9153
|
return;
|
|
8390
9154
|
}, () => {
|
|
8391
9155
|
return;
|
|
8392
9156
|
})));
|
|
8393
|
-
const keyFile =
|
|
8394
|
-
const knownHosts =
|
|
9157
|
+
const keyFile = join38(work, "aur_id_ed25519");
|
|
9158
|
+
const knownHosts = join38(work, "aur_known_hosts");
|
|
8395
9159
|
yield* step(() => fs.mkdir(work, { recursive: true, mode: 448 }));
|
|
8396
9160
|
yield* step(() => fs.writeFile(keyFile, key.endsWith(`
|
|
8397
9161
|
`) ? key : `${key}
|
|
@@ -8399,7 +9163,7 @@ var publishArchPackageEffect = (options) => Effect24.gen(function* () {
|
|
|
8399
9163
|
yield* step(() => fs.writeFile(knownHosts, `${AUR_HOST_KEY}
|
|
8400
9164
|
`, { mode: 420 }));
|
|
8401
9165
|
const ssh = `ssh -i "${keyFile}" -o IdentitiesOnly=yes -o UserKnownHostsFile="${knownHosts}" -o StrictHostKeyChecking=yes`;
|
|
8402
|
-
const checkout =
|
|
9166
|
+
const checkout = join38(work, policy.pkgname);
|
|
8403
9167
|
yield* git2([
|
|
8404
9168
|
"-c",
|
|
8405
9169
|
`core.sshCommand=${ssh}`,
|
|
@@ -8412,7 +9176,7 @@ var publishArchPackageEffect = (options) => Effect24.gen(function* () {
|
|
|
8412
9176
|
checkout
|
|
8413
9177
|
]);
|
|
8414
9178
|
for (const [name, contents] of Object.entries(files))
|
|
8415
|
-
yield* step(() => fs.writeFile(
|
|
9179
|
+
yield* step(() => fs.writeFile(join38(checkout, name), contents, { mode: 420 }));
|
|
8416
9180
|
yield* git2(["-C", checkout, "add", "--", ...Object.keys(files)]);
|
|
8417
9181
|
const staged = yield* gitExit(["-C", checkout, "diff", "--cached", "--quiet"]);
|
|
8418
9182
|
if (staged === 0)
|
|
@@ -8433,35 +9197,35 @@ var publishArchPackageEffect = (options) => Effect24.gen(function* () {
|
|
|
8433
9197
|
]);
|
|
8434
9198
|
yield* git2(["-C", checkout, "-c", `core.sshCommand=${ssh}`, "push", "origin", "HEAD:master"]);
|
|
8435
9199
|
return { status: "published", ...base };
|
|
8436
|
-
}).pipe(
|
|
9200
|
+
}).pipe(Effect27.scoped);
|
|
8437
9201
|
});
|
|
8438
9202
|
|
|
8439
9203
|
// src/cli-commands.ts
|
|
8440
|
-
var print = (value) =>
|
|
9204
|
+
var print = (value) => Effect28.gen(function* () {
|
|
8441
9205
|
const { stdout } = yield* ReleaseOutput;
|
|
8442
9206
|
stdout(JSON.stringify(value) + `
|
|
8443
9207
|
`);
|
|
8444
9208
|
});
|
|
8445
|
-
var say = (line) =>
|
|
9209
|
+
var say = (line) => Effect28.gen(function* () {
|
|
8446
9210
|
const { stdout } = yield* ReleaseOutput;
|
|
8447
9211
|
stdout(line + `
|
|
8448
9212
|
`);
|
|
8449
9213
|
});
|
|
8450
9214
|
var invalid = (message = "Invalid workflow invocation") => refuse("usage", message);
|
|
8451
9215
|
var localFlag = (args) => args[0] === "--local" ? [true, args.slice(1)] : [false, args];
|
|
8452
|
-
var hostPlatform =
|
|
9216
|
+
var hostPlatform = Effect28.gen(function* () {
|
|
8453
9217
|
const { platform, arch } = yield* ReleaseConfig;
|
|
8454
9218
|
return yield* step(async () => hostReleasePlatform(platform, arch));
|
|
8455
9219
|
});
|
|
8456
|
-
var withPlanGitHub = (env, effect) =>
|
|
9220
|
+
var withPlanGitHub = (env, effect) => Effect28.gen(function* () {
|
|
8457
9221
|
const github = yield* ReleaseGitHub;
|
|
8458
|
-
return yield* effect.pipe(
|
|
9222
|
+
return yield* effect.pipe(Effect28.provideService(ReleaseGitHub, {
|
|
8459
9223
|
run: github.withEnvironment ? github.withEnvironment(releasePlanGitHubEnvironment(env)) : github.run
|
|
8460
9224
|
}));
|
|
8461
9225
|
});
|
|
8462
9226
|
var publish = (argv) => {
|
|
8463
9227
|
const [local, args] = localFlag(argv);
|
|
8464
|
-
return runCommand("Unable to publish release artifacts; check the trusted workflow or local checkout, receipts, signing configuration and staged bytes.",
|
|
9228
|
+
return runCommand("Unable to publish release artifacts; check the trusted workflow or local checkout, receipts, signing configuration and staged bytes.", Effect28.gen(function* () {
|
|
8465
9229
|
const [directory, configPath, out, ...extra] = args;
|
|
8466
9230
|
if (!directory || !configPath || extra.length || !out !== !local)
|
|
8467
9231
|
return yield* invalid();
|
|
@@ -8474,7 +9238,7 @@ var publish = (argv) => {
|
|
|
8474
9238
|
const clock = yield* ReleaseClock;
|
|
8475
9239
|
const platform = yield* hostPlatform;
|
|
8476
9240
|
const { repository } = yield* localTagProvenanceEffect({ config, tag, sourceSha });
|
|
8477
|
-
const plan = yield*
|
|
9241
|
+
const plan = yield* Effect28.uninterruptible(stageLocalReleaseEffect({
|
|
8478
9242
|
config,
|
|
8479
9243
|
directory,
|
|
8480
9244
|
out,
|
|
@@ -8492,7 +9256,7 @@ var publish = (argv) => {
|
|
|
8492
9256
|
};
|
|
8493
9257
|
var cut = (argv) => {
|
|
8494
9258
|
const [local, args] = localFlag(argv);
|
|
8495
|
-
return runCommand((error) => `Unable to cut the release: ${redactedErrorMessage(error)}. Check the trusted workflow or local checkout and release configuration.`,
|
|
9259
|
+
return runCommand((error) => `Unable to cut the release: ${redactedErrorMessage(error)}. Check the trusted workflow or local checkout and release configuration.`, Effect28.gen(function* () {
|
|
8496
9260
|
const [kind, path, sourceSha, ...extra] = args;
|
|
8497
9261
|
if (kind !== "daily" || !path || extra.length || !sourceSha !== !local)
|
|
8498
9262
|
return yield* invalid();
|
|
@@ -8502,7 +9266,7 @@ var cut = (argv) => {
|
|
|
8502
9266
|
const { env } = yield* ReleaseConfig;
|
|
8503
9267
|
if (local) {
|
|
8504
9268
|
const platform = yield* hostPlatform;
|
|
8505
|
-
const result = yield*
|
|
9269
|
+
const result = yield* Effect28.uninterruptible(runLocalReleaseCutEffect({ kind, config, sourceSha, platform }));
|
|
8506
9270
|
return yield* print(result);
|
|
8507
9271
|
}
|
|
8508
9272
|
const result = yield* releaseCutCommand({
|
|
@@ -8516,7 +9280,7 @@ var cut = (argv) => {
|
|
|
8516
9280
|
};
|
|
8517
9281
|
var promote = (argv) => {
|
|
8518
9282
|
const [local, args] = localFlag(argv);
|
|
8519
|
-
return runCommand("Unable to promote the release; check the trusted workflow or feed and release configuration.",
|
|
9283
|
+
return runCommand("Unable to promote the release; check the trusted workflow or feed and release configuration.", Effect28.gen(function* () {
|
|
8520
9284
|
const [path, out, ...extra] = args;
|
|
8521
9285
|
const { env } = yield* ReleaseConfig;
|
|
8522
9286
|
const held = env.STABLE_PROMOTION_HELD;
|
|
@@ -8526,7 +9290,7 @@ var promote = (argv) => {
|
|
|
8526
9290
|
if (local) {
|
|
8527
9291
|
const clock = yield* ReleaseClock;
|
|
8528
9292
|
const repository = yield* originRepositoryEffect;
|
|
8529
|
-
const result = yield*
|
|
9293
|
+
const result = yield* Effect28.uninterruptible(runLocalPromotionEffect({
|
|
8530
9294
|
config,
|
|
8531
9295
|
out,
|
|
8532
9296
|
now: clock.now(),
|
|
@@ -8539,7 +9303,7 @@ var promote = (argv) => {
|
|
|
8539
9303
|
yield* print(yield* promotionCommand({ env, config }));
|
|
8540
9304
|
}), { requireGitHubActions: !local });
|
|
8541
9305
|
};
|
|
8542
|
-
var finalize = (argv) => runCommand((error) => `Release finalization failed: ${redactedErrorMessage(error)}`,
|
|
9306
|
+
var finalize = (argv) => runCommand((error) => `Release finalization failed: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
|
|
8543
9307
|
const { env } = yield* ReleaseConfig;
|
|
8544
9308
|
if (argv[0] === "--local") {
|
|
8545
9309
|
const [configPath, tag, ...extra] = argv.slice(1);
|
|
@@ -8560,7 +9324,7 @@ var finalize = (argv) => runCommand((error) => `Release finalization failed: ${r
|
|
|
8560
9324
|
yield* finalizeReleasePleaseDraftEffect({ env, config, ...identity });
|
|
8561
9325
|
yield* say("Qualified draft published as a prerelease");
|
|
8562
9326
|
}));
|
|
8563
|
-
var planAssets = (args) => runCommand("Unable to plan release assets; check release provenance and the trusted workflow.",
|
|
9327
|
+
var planAssets = (args) => runCommand("Unable to plan release assets; check release provenance and the trusted workflow.", Effect28.gen(function* () {
|
|
8564
9328
|
const [tag, path, ...extra] = args;
|
|
8565
9329
|
if (!tag || !path || extra.length)
|
|
8566
9330
|
return yield* invalid("Expected release tag and configuration file");
|
|
@@ -8568,7 +9332,7 @@ var planAssets = (args) => runCommand("Unable to plan release assets; check rele
|
|
|
8568
9332
|
const { env } = yield* ReleaseConfig;
|
|
8569
9333
|
yield* print(yield* planReleaseAssetsEffect({ env, config, tag }));
|
|
8570
9334
|
}));
|
|
8571
|
-
var sign2 = (args) => runCommand("Unable to sign release artifact; check the identity, archive and signing key.",
|
|
9335
|
+
var sign2 = (args) => runCommand("Unable to sign release artifact; check the identity, archive and signing key.", Effect28.gen(function* () {
|
|
8572
9336
|
const [identityPath, artifactPath, feed, ...extra] = args;
|
|
8573
9337
|
const { env } = yield* ReleaseConfig;
|
|
8574
9338
|
if (!identityPath || !artifactPath || !feed || extra.length || !env.ADEA_RELEASE_SIGNING_KEY)
|
|
@@ -8579,7 +9343,7 @@ var sign2 = (args) => runCommand("Unable to sign release artifact; check the ide
|
|
|
8579
9343
|
}));
|
|
8580
9344
|
var signDescriptors = (argv) => {
|
|
8581
9345
|
const [local, args] = localFlag(argv);
|
|
8582
|
-
return runCommand("Unable to stage signed descriptors; check the trusted release, installer receipts and signing configuration.",
|
|
9346
|
+
return runCommand("Unable to stage signed descriptors; check the trusted release, installer receipts and signing configuration.", Effect28.gen(function* () {
|
|
8583
9347
|
const [directory, configPath, ...extra] = args;
|
|
8584
9348
|
const { env } = yield* ReleaseConfig;
|
|
8585
9349
|
const {
|
|
@@ -8612,7 +9376,7 @@ var signDescriptors = (argv) => {
|
|
|
8612
9376
|
}));
|
|
8613
9377
|
}));
|
|
8614
9378
|
};
|
|
8615
|
-
var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.message}`,
|
|
9379
|
+
var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.message}`, Effect28.gen(function* () {
|
|
8616
9380
|
const args = [...argv];
|
|
8617
9381
|
const flag = args.indexOf("--artifacts");
|
|
8618
9382
|
const artifacts = flag === -1 ? undefined : args.splice(flag, 2)[1];
|
|
@@ -8664,9 +9428,9 @@ var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.
|
|
|
8664
9428
|
return yield* invalid(`Unknown release step ${String(name)}`);
|
|
8665
9429
|
}
|
|
8666
9430
|
}));
|
|
8667
|
-
var verifyMacosSigning = (args) =>
|
|
9431
|
+
var verifyMacosSigning = (args) => Effect28.gen(function* () {
|
|
8668
9432
|
let problems = 0;
|
|
8669
|
-
const code = yield* runCommand("Unable to check the app signing; run it on macOS with codesign.",
|
|
9433
|
+
const code = yield* runCommand("Unable to check the app signing; run it on macOS with codesign.", Effect28.gen(function* () {
|
|
8670
9434
|
const [app, flag, ...extra] = args;
|
|
8671
9435
|
if (!app || extra.length || ![undefined, "--hardened"].includes(flag))
|
|
8672
9436
|
return yield* invalid("usage");
|
|
@@ -8679,14 +9443,14 @@ var verifyMacosSigning = (args) => Effect25.gen(function* () {
|
|
|
8679
9443
|
}));
|
|
8680
9444
|
return code || (problems ? 1 : 0);
|
|
8681
9445
|
});
|
|
8682
|
-
var publishFramework = (args) => runCommand((error) => error.message,
|
|
9446
|
+
var publishFramework = (args) => runCommand((error) => error.message, Effect28.gen(function* () {
|
|
8683
9447
|
const [archive, flag, ...extra] = args;
|
|
8684
9448
|
if (!archive || extra.length || flag !== undefined && flag !== "--dry-run")
|
|
8685
9449
|
return yield* invalid("Expected one framework package archive and an optional --dry-run");
|
|
8686
9450
|
const { env } = yield* ReleaseConfig;
|
|
8687
9451
|
yield* print(yield* step(() => publishFrameworkPackage({ env, archive, dryRun: flag === "--dry-run" })));
|
|
8688
9452
|
}));
|
|
8689
|
-
var publishArch = (argv) => runCommand((error) => `Unable to publish the Arch package: ${redactedErrorMessage(error)}`,
|
|
9453
|
+
var publishArch = (argv) => runCommand((error) => `Unable to publish the Arch package: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
|
|
8690
9454
|
const args = [...argv];
|
|
8691
9455
|
const printIndex = args.indexOf("--print");
|
|
8692
9456
|
const printDirectory = printIndex === -1 ? undefined : args[printIndex + 1];
|
|
@@ -8721,16 +9485,78 @@ var publishArch = (argv) => runCommand((error) => `Unable to publish the Arch pa
|
|
|
8721
9485
|
...printDirectory ? { printDirectory } : {}
|
|
8722
9486
|
}));
|
|
8723
9487
|
}));
|
|
9488
|
+
var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; check the command arguments and use matching exact staged artifacts and native receipts.", Effect28.gen(function* () {
|
|
9489
|
+
const [action, configPath, ...operands] = args;
|
|
9490
|
+
if (!configPath)
|
|
9491
|
+
return yield* invalid();
|
|
9492
|
+
if (action === "plan" && operands.length === 1) {
|
|
9493
|
+
const config = yield* readReleaseConfig(configPath);
|
|
9494
|
+
const matrix = yield* step(async () => planDailyReleaseMatrix(config, operands[0]));
|
|
9495
|
+
return yield* print(matrix);
|
|
9496
|
+
}
|
|
9497
|
+
if (!(action === "verify" && operands.length === 3 || action === "stage-local" && operands.length === 4 || action === "produce-native-receipt" && (operands.length === 4 || operands.length === 5)))
|
|
9498
|
+
return yield* invalid();
|
|
9499
|
+
const [identityPath, artifacts, receipts, parent, baselineArtifacts] = operands;
|
|
9500
|
+
const raw = yield* readBoundedJson(identityPath, 4096, "Daily identity");
|
|
9501
|
+
if (!isRecord(raw) || typeof raw.tag !== "string" || typeof raw.sourceSha !== "string" || typeof raw.workflowSha !== "string" || typeof raw.runId !== "string" || typeof raw.runAttempt !== "number")
|
|
9502
|
+
return yield* invalid();
|
|
9503
|
+
const { tag, sourceSha, workflowSha, runId, runAttempt } = raw;
|
|
9504
|
+
const config = yield* readReleaseConfig(configPath);
|
|
9505
|
+
const identity = { tag, sourceSha, workflowSha, runId, runAttempt };
|
|
9506
|
+
if (action === "produce-native-receipt") {
|
|
9507
|
+
const { env, platform: os, arch } = yield* ReleaseConfig;
|
|
9508
|
+
yield* step(async () => assertHostedRunner(env, "Daily native receipt"));
|
|
9509
|
+
const report = yield* readBoundedJson(parent, 65536, "Daily native job report");
|
|
9510
|
+
return yield* print(yield* createDailyNativeReceiptEffect({
|
|
9511
|
+
config,
|
|
9512
|
+
identity,
|
|
9513
|
+
artifacts,
|
|
9514
|
+
checkName: receipts,
|
|
9515
|
+
baselineArtifacts,
|
|
9516
|
+
report
|
|
9517
|
+
}, { os, arch }));
|
|
9518
|
+
}
|
|
9519
|
+
const options = {
|
|
9520
|
+
config,
|
|
9521
|
+
identity,
|
|
9522
|
+
artifacts,
|
|
9523
|
+
receipts
|
|
9524
|
+
};
|
|
9525
|
+
const result = action === "verify" ? yield* verifyDailyReleaseMatrixEffect(options) : yield* stageDailyBatchEffect({ ...options, parent });
|
|
9526
|
+
return yield* print(result);
|
|
9527
|
+
}));
|
|
9528
|
+
var prepareStableCatalog2 = (args) => runCommand((error) => `Unable to prepare Stable catalog: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
|
|
9529
|
+
yield* print(yield* step(() => prepareStableCatalogCommand(args)));
|
|
9530
|
+
}));
|
|
9531
|
+
var stageAptRepository = (args) => runCommand((error) => `Unable to stage Apt repository: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
|
|
9532
|
+
yield* print(yield* step(() => stageAptRepositoryCommand(args)));
|
|
9533
|
+
}));
|
|
9534
|
+
var linuxChannelProof = (args) => runCommand((error) => `Unable to check Linux package channel: ${redactedErrorMessage(error)}`, Effect28.gen(function* () {
|
|
9535
|
+
const [channel, input, ...extra] = args;
|
|
9536
|
+
if (channel !== "rpm" && channel !== "flatpak" || !input || extra.length)
|
|
9537
|
+
return yield* invalid("Expected <rpm|flatpak> <input.json>");
|
|
9538
|
+
const value = yield* readBoundedJson(input, 1024 * 1024, "Linux channel proof");
|
|
9539
|
+
if (channel === "rpm") {
|
|
9540
|
+
yield* print(yield* step(() => verifyRpmStage(value)));
|
|
9541
|
+
} else {
|
|
9542
|
+
const { policy, observation } = value;
|
|
9543
|
+
yield* print(yield* step(async () => verifyFlatpakCapabilities(policy, observation)));
|
|
9544
|
+
}
|
|
9545
|
+
}));
|
|
8724
9546
|
var commands = {
|
|
8725
9547
|
cut,
|
|
9548
|
+
"daily-matrix": dailyMatrix,
|
|
8726
9549
|
finalize,
|
|
9550
|
+
"linux-channel-proof": linuxChannelProof,
|
|
8727
9551
|
"plan-assets": planAssets,
|
|
9552
|
+
"prepare-stable-catalog": prepareStableCatalog2,
|
|
8728
9553
|
promote,
|
|
8729
9554
|
publish,
|
|
8730
9555
|
"publish-arch": publishArch,
|
|
8731
9556
|
"publish-framework-package": publishFramework,
|
|
8732
9557
|
sign: sign2,
|
|
8733
9558
|
"sign-descriptors": signDescriptors,
|
|
9559
|
+
"stage-apt-repository": stageAptRepository,
|
|
8734
9560
|
step: releaseStep,
|
|
8735
9561
|
"verify-macos-signing": verifyMacosSigning
|
|
8736
9562
|
};
|
|
@@ -8739,7 +9565,7 @@ var releaseCli = (argv) => {
|
|
|
8739
9565
|
const command = name === undefined ? undefined : commands[name];
|
|
8740
9566
|
if (command)
|
|
8741
9567
|
return command(args);
|
|
8742
|
-
return
|
|
9568
|
+
return Effect28.gen(function* () {
|
|
8743
9569
|
const { stderr } = yield* ReleaseOutput;
|
|
8744
9570
|
stderr(`Usage: adea-release <${Object.keys(commands).join("|")}> [arguments]; unknown command ${String(name)}
|
|
8745
9571
|
`);
|
|
@@ -8748,4 +9574,4 @@ var releaseCli = (argv) => {
|
|
|
8748
9574
|
};
|
|
8749
9575
|
|
|
8750
9576
|
// src/cli.ts
|
|
8751
|
-
process.exitCode = await
|
|
9577
|
+
process.exitCode = await Effect29.runPromise(provideLivePorts(releaseCli(process.argv.slice(2))));
|