@telorun/cli 0.88.0 → 0.90.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/bundle/built-layers.d.ts +36 -0
- package/dist/bundle/built-layers.d.ts.map +1 -0
- package/dist/bundle/built-layers.js +84 -0
- package/dist/bundle/built-layers.js.map +1 -0
- package/dist/bundle/module-payload.d.ts +30 -15
- package/dist/bundle/module-payload.d.ts.map +1 -1
- package/dist/bundle/module-payload.js +118 -21
- package/dist/bundle/module-payload.js.map +1 -1
- package/dist/bundle/partition-layers.d.ts +13 -6
- package/dist/bundle/partition-layers.d.ts.map +1 -1
- package/dist/bundle/partition-layers.js +49 -7
- package/dist/bundle/partition-layers.js.map +1 -1
- package/dist/bundle/payload-drift.d.ts +1 -1
- package/dist/bundle/payload-drift.d.ts.map +1 -1
- package/dist/bundle/select-files.d.ts +11 -2
- package/dist/bundle/select-files.d.ts.map +1 -1
- package/dist/bundle/select-files.js +23 -8
- package/dist/bundle/select-files.js.map +1 -1
- package/dist/bundle/staged-files.d.ts +43 -0
- package/dist/bundle/staged-files.d.ts.map +1 -0
- package/dist/bundle/staged-files.js +158 -0
- package/dist/bundle/staged-files.js.map +1 -0
- package/dist/bundle/warm-layers.d.ts +11 -6
- package/dist/bundle/warm-layers.d.ts.map +1 -1
- package/dist/bundle/warm-layers.js +26 -10
- package/dist/bundle/warm-layers.js.map +1 -1
- package/dist/commands/install.d.ts +1 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +7 -1
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/module.d.ts.map +1 -1
- package/dist/commands/module.js +21 -7
- package/dist/commands/module.js.map +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +5 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/release.d.ts +8 -6
- package/dist/commands/release.d.ts.map +1 -1
- package/dist/commands/release.js +168 -69
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +14 -6
- package/dist/commands/run.js.map +1 -1
- package/dist/controller-runtime.d.ts +25 -3
- package/dist/controller-runtime.d.ts.map +1 -1
- package/dist/controller-runtime.js +39 -9
- package/dist/controller-runtime.js.map +1 -1
- package/dist/env-files.d.ts +23 -8
- package/dist/env-files.d.ts.map +1 -1
- package/dist/env-files.js +77 -17
- package/dist/env-files.js.map +1 -1
- package/dist/release/apply-plan.d.ts +2 -1
- package/dist/release/apply-plan.d.ts.map +1 -1
- package/dist/release/apply-plan.js +8 -4
- package/dist/release/apply-plan.js.map +1 -1
- package/dist/release/cargo-toml.d.ts +17 -0
- package/dist/release/cargo-toml.d.ts.map +1 -0
- package/dist/release/cargo-toml.js +253 -0
- package/dist/release/cargo-toml.js.map +1 -0
- package/dist/release/crate-inputs.d.ts +41 -0
- package/dist/release/crate-inputs.d.ts.map +1 -0
- package/dist/release/crate-inputs.js +407 -0
- package/dist/release/crate-inputs.js.map +1 -0
- package/dist/release/evidence.d.ts +13 -17
- package/dist/release/evidence.d.ts.map +1 -1
- package/dist/release/evidence.js +26 -30
- package/dist/release/evidence.js.map +1 -1
- package/dist/release/stage.d.ts +61 -0
- package/dist/release/stage.d.ts.map +1 -0
- package/dist/release/stage.js +506 -0
- package/dist/release/stage.js.map +1 -0
- package/dist/release/targets.d.ts +60 -0
- package/dist/release/targets.d.ts.map +1 -0
- package/dist/release/targets.js +94 -0
- package/dist/release/targets.js.map +1 -0
- package/dist/release/workspace.d.ts +17 -5
- package/dist/release/workspace.d.ts.map +1 -1
- package/dist/release/workspace.js +89 -13
- package/dist/release/workspace.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `telo release stage` — fetch, extract, verify and pin the files a module's
|
|
3
|
+
* `sources:` block declares.
|
|
4
|
+
*
|
|
5
|
+
* Fetching is the CLI's alone: the kernel reads what this put on disk and never
|
|
6
|
+
* reaches an upstream. Plain staging only verifies against the pins in the
|
|
7
|
+
* manifest; `--pin` is the one writer of those pins, through the analyzer's
|
|
8
|
+
* byte-splice editor, so nothing else in `telo.yaml` moves — and nothing is
|
|
9
|
+
* written until the edited text reads back with exactly the pins computed.
|
|
10
|
+
*/
|
|
11
|
+
import { type SourceArchiveFormat } from "@telorun/analyzer";
|
|
12
|
+
import { type BundleEntry } from "@telorun/kernel";
|
|
13
|
+
export interface StageTarget {
|
|
14
|
+
/** Workspace-relative module key, for messages. */
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly dir: string;
|
|
17
|
+
readonly manifestPath: string;
|
|
18
|
+
}
|
|
19
|
+
export interface StageOutcome {
|
|
20
|
+
readonly module: string;
|
|
21
|
+
readonly source: string;
|
|
22
|
+
/** Module-relative path of the entry. */
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly action: "verified" | "staged" | "linked" | "pinned";
|
|
25
|
+
}
|
|
26
|
+
export interface StageFailure {
|
|
27
|
+
readonly module: string;
|
|
28
|
+
readonly source?: string;
|
|
29
|
+
readonly path?: string;
|
|
30
|
+
readonly url?: string;
|
|
31
|
+
readonly message: string;
|
|
32
|
+
}
|
|
33
|
+
export interface StageResult {
|
|
34
|
+
readonly outcomes: StageOutcome[];
|
|
35
|
+
readonly failures: StageFailure[];
|
|
36
|
+
}
|
|
37
|
+
/** Reads the archive at a URL, in the format its source declares, into its entries. */
|
|
38
|
+
export type ArchiveReader = (url: string, format: SourceArchiveFormat) => Promise<BundleEntry[]>;
|
|
39
|
+
/**
|
|
40
|
+
* One fetch per URL for the life of the reader; the caller decides that life
|
|
41
|
+
* (the command takes one reader per module, so decoded archives do not pile up
|
|
42
|
+
* across a workspace). A request is bounded in time, in response size and in
|
|
43
|
+
* decompressed size, and may not end at a URL a source could not name.
|
|
44
|
+
*/
|
|
45
|
+
export declare function createArchiveReader(options?: {
|
|
46
|
+
fetchImpl?: typeof fetch;
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
maxBytes?: number;
|
|
49
|
+
maxExtractedBytes?: number;
|
|
50
|
+
}): ArchiveReader;
|
|
51
|
+
/**
|
|
52
|
+
* Stage one module's `sources:`. With `pin`, fetch every file entry, write its
|
|
53
|
+
* `sha256` and `executable` — and each built source's `build.inputs` — into the
|
|
54
|
+
* manifest, then stage against those pins. A module with no `sources:` block
|
|
55
|
+
* yields an empty result.
|
|
56
|
+
*/
|
|
57
|
+
export declare function stageModule(target: StageTarget, options: {
|
|
58
|
+
pin: boolean;
|
|
59
|
+
archives: ArchiveReader;
|
|
60
|
+
}): Promise<StageResult>;
|
|
61
|
+
//# sourceMappingURL=stage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/release/stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EASL,KAAK,mBAAmB,EAIzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQhF,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;CAC9D;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,YAAY,EAAE,CAAC;CACnC;AAED,uFAAuF;AACvF,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;AAgBjG;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE;IACP,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACvB,GACL,aAAa,CAwBf;AA2ZD;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE;IAAE,GAAG,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,aAAa,CAAA;CAAE,GACjD,OAAO,CAAC,WAAW,CAAC,CA2FtB"}
|
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `telo release stage` — fetch, extract, verify and pin the files a module's
|
|
3
|
+
* `sources:` block declares.
|
|
4
|
+
*
|
|
5
|
+
* Fetching is the CLI's alone: the kernel reads what this put on disk and never
|
|
6
|
+
* reaches an upstream. Plain staging only verifies against the pins in the
|
|
7
|
+
* manifest; `--pin` is the one writer of those pins, through the analyzer's
|
|
8
|
+
* byte-splice editor, so nothing else in `telo.yaml` moves — and nothing is
|
|
9
|
+
* written until the edited text reads back with exactly the pins computed.
|
|
10
|
+
*/
|
|
11
|
+
import { applyTextEdits, isModuleKind, isPlainSafe, readModuleSources, renderFixReplacement, resolveSourceUrl, sourceUrlProblem, } from "@telorun/analyzer";
|
|
12
|
+
import { checkStagedEntry, readTarGz } from "@telorun/kernel";
|
|
13
|
+
import { defaultCustomTags } from "@telorun/templating";
|
|
14
|
+
import { createHash } from "node:crypto";
|
|
15
|
+
import * as fs from "node:fs";
|
|
16
|
+
import * as path from "node:path";
|
|
17
|
+
import { isMap, isPair, isScalar, parse, parseAllDocuments } from "yaml";
|
|
18
|
+
import { crateInputsDigest } from "./crate-inputs.js";
|
|
19
|
+
const FETCH_TIMEOUT_MS = 5 * 60_000;
|
|
20
|
+
const MAX_ARCHIVE_BYTES = 512 * 1024 * 1024;
|
|
21
|
+
const MAX_EXTRACTED_BYTES = 2 * 1024 * 1024 * 1024;
|
|
22
|
+
const MAX_REDIRECTS = 10;
|
|
23
|
+
function fetchFailure(url, err, timeoutMs) {
|
|
24
|
+
if (err.name === "TimeoutError") {
|
|
25
|
+
return new Error(`could not fetch the archive ${url}: no complete response within ${timeoutMs / 1000}s`);
|
|
26
|
+
}
|
|
27
|
+
const cause = err.cause;
|
|
28
|
+
const detail = cause instanceof Error ? cause.message : err instanceof Error ? err.message : String(err);
|
|
29
|
+
return new Error(`could not fetch the archive ${url}: ${detail}`);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One fetch per URL for the life of the reader; the caller decides that life
|
|
33
|
+
* (the command takes one reader per module, so decoded archives do not pile up
|
|
34
|
+
* across a workspace). A request is bounded in time, in response size and in
|
|
35
|
+
* decompressed size, and may not end at a URL a source could not name.
|
|
36
|
+
*/
|
|
37
|
+
export function createArchiveReader(options = {}) {
|
|
38
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
39
|
+
const timeoutMs = options.timeoutMs ?? FETCH_TIMEOUT_MS;
|
|
40
|
+
const maxBytes = options.maxBytes ?? MAX_ARCHIVE_BYTES;
|
|
41
|
+
const maxExtractedBytes = options.maxExtractedBytes ?? MAX_EXTRACTED_BYTES;
|
|
42
|
+
const cache = new Map();
|
|
43
|
+
return (url, format) => {
|
|
44
|
+
const key = `${format}\0${url}`;
|
|
45
|
+
let entries = cache.get(key);
|
|
46
|
+
if (!entries) {
|
|
47
|
+
entries = (async () => {
|
|
48
|
+
const bytes = await fetchArchive(url, fetchImpl, timeoutMs, maxBytes);
|
|
49
|
+
try {
|
|
50
|
+
return await readTarGz(bytes, { maxBytes: maxExtractedBytes });
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
throw new Error(`the archive ${url} does not read as ${format}: ${err instanceof Error ? err.message : String(err)}`);
|
|
54
|
+
}
|
|
55
|
+
})();
|
|
56
|
+
cache.set(key, entries);
|
|
57
|
+
}
|
|
58
|
+
return entries;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async function fetchArchive(url, fetchImpl, timeoutMs, maxBytes) {
|
|
62
|
+
const tooLarge = () => new Error(`the archive ${url} is larger than the ${maxBytes}-byte limit`);
|
|
63
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
64
|
+
// Redirects are followed here rather than by fetch, so each location is vetted
|
|
65
|
+
// before any request goes to it: a redirect may not take the request somewhere
|
|
66
|
+
// the manifest could not have named — a plain-http location above all.
|
|
67
|
+
let response;
|
|
68
|
+
let current = url;
|
|
69
|
+
for (let hops = 0;; hops++) {
|
|
70
|
+
try {
|
|
71
|
+
response = await fetchImpl(current, { signal, redirect: "manual" });
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
throw fetchFailure(url, err, timeoutMs);
|
|
75
|
+
}
|
|
76
|
+
const location = response.headers.get("location");
|
|
77
|
+
if (response.status < 300 || response.status >= 400 || location === null)
|
|
78
|
+
break;
|
|
79
|
+
await response.body?.cancel();
|
|
80
|
+
if (hops === MAX_REDIRECTS) {
|
|
81
|
+
throw new Error(`the archive request ${url} was redirected more than ${MAX_REDIRECTS} times`);
|
|
82
|
+
}
|
|
83
|
+
const next = new URL(location, current).href;
|
|
84
|
+
const refusal = sourceUrlProblem(next);
|
|
85
|
+
if (refusal) {
|
|
86
|
+
throw new Error(`the archive request ${url} was redirected to ${next}: ${refusal.detail}`);
|
|
87
|
+
}
|
|
88
|
+
current = next;
|
|
89
|
+
}
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
await response.body?.cancel();
|
|
92
|
+
throw new Error(`the archive request ${url} answered ${response.status} ${response.statusText}`);
|
|
93
|
+
}
|
|
94
|
+
if (Number(response.headers.get("content-length") ?? 0) > maxBytes) {
|
|
95
|
+
await response.body?.cancel();
|
|
96
|
+
throw tooLarge();
|
|
97
|
+
}
|
|
98
|
+
const reader = response.body?.getReader();
|
|
99
|
+
if (!reader)
|
|
100
|
+
throw new Error(`the archive request ${url} answered with no body`);
|
|
101
|
+
const chunks = [];
|
|
102
|
+
let total = 0;
|
|
103
|
+
for (;;) {
|
|
104
|
+
let chunk;
|
|
105
|
+
try {
|
|
106
|
+
chunk = await reader.read();
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
throw fetchFailure(url, err, timeoutMs);
|
|
110
|
+
}
|
|
111
|
+
if (chunk.done)
|
|
112
|
+
break;
|
|
113
|
+
total += chunk.value.byteLength;
|
|
114
|
+
if (total > maxBytes) {
|
|
115
|
+
await reader.cancel();
|
|
116
|
+
throw tooLarge();
|
|
117
|
+
}
|
|
118
|
+
chunks.push(Buffer.from(chunk.value));
|
|
119
|
+
}
|
|
120
|
+
return Buffer.concat(chunks);
|
|
121
|
+
}
|
|
122
|
+
function readModuleDoc(target, failures, pin) {
|
|
123
|
+
const text = fs.readFileSync(target.manifestPath, "utf8");
|
|
124
|
+
for (const doc of parseAllDocuments(text, { customTags: defaultCustomTags() })) {
|
|
125
|
+
if (doc.errors.length > 0) {
|
|
126
|
+
failures.push({ module: target.key, message: `${target.manifestPath}: ${doc.errors[0].message}` });
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
129
|
+
const json = doc.toJSON();
|
|
130
|
+
if (typeof json?.kind !== "string" || !isModuleKind(json.kind))
|
|
131
|
+
continue;
|
|
132
|
+
// `--pin` replaces every pin, so a malformed one is not a reason to refuse.
|
|
133
|
+
const { sources, problems } = readModuleSources(json, { ignorePins: pin });
|
|
134
|
+
for (const problem of problems) {
|
|
135
|
+
failures.push({
|
|
136
|
+
module: target.key,
|
|
137
|
+
message: `${problem.message} (at ${problem.path}; run \`telo check\` for every problem)`,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return problems.length > 0 ? undefined : { doc, text, sources };
|
|
141
|
+
}
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const sha256Hex = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
145
|
+
const memberName = (name) => name.replace(/^(\.\/)+/, "");
|
|
146
|
+
async function extractMember(archives, source, url, member) {
|
|
147
|
+
const entries = await archives(url, source.archive);
|
|
148
|
+
const matches = entries.filter((entry) => memberName(entry.name) === memberName(member));
|
|
149
|
+
if (matches.length > 1) {
|
|
150
|
+
throw new Error(`member '${member}' occurs ${matches.length} times in the archive, so which file it names is ambiguous`);
|
|
151
|
+
}
|
|
152
|
+
const found = matches[0];
|
|
153
|
+
if (!found)
|
|
154
|
+
throw new Error(`member '${member}' is not in the archive`);
|
|
155
|
+
if ("link" in found) {
|
|
156
|
+
throw new Error(`member '${member}' is a symbolic link in the archive, not a file`);
|
|
157
|
+
}
|
|
158
|
+
const content = typeof found.content === "string" ? Buffer.from(found.content) : Buffer.from(found.content);
|
|
159
|
+
return { content, executable: found.executable === true };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Refuse an entry whose parent path crosses a symbolic link or a non-directory
|
|
163
|
+
* on disk: the path is confined as text, but a checked-out link would carry
|
|
164
|
+
* every rm, mkdir, write and symlink below it outside the module.
|
|
165
|
+
*/
|
|
166
|
+
function assertConfined(dir, entryPath) {
|
|
167
|
+
const segments = entryPath.split("/").slice(0, -1);
|
|
168
|
+
let current = dir;
|
|
169
|
+
for (const segment of segments) {
|
|
170
|
+
current = path.join(current, segment);
|
|
171
|
+
const stat = fs.lstatSync(current, { throwIfNoEntry: false });
|
|
172
|
+
if (!stat)
|
|
173
|
+
return;
|
|
174
|
+
if (stat.isSymbolicLink()) {
|
|
175
|
+
throw new Error(`'${path.relative(dir, current)}' is a symbolic link on disk; staging below it would write outside the module. Replace it with a directory.`);
|
|
176
|
+
}
|
|
177
|
+
if (!stat.isDirectory()) {
|
|
178
|
+
throw new Error(`'${path.relative(dir, current)}' exists on disk and is not a directory.`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function writeStaged(abs, content, executable) {
|
|
183
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
184
|
+
// Removed first, so a link left at the path is replaced rather than written through.
|
|
185
|
+
fs.rmSync(abs, { force: true });
|
|
186
|
+
fs.writeFileSync(abs, content);
|
|
187
|
+
fs.chmodSync(abs, executable ? 0o755 : 0o644);
|
|
188
|
+
}
|
|
189
|
+
async function stageSources(target, sources, archives) {
|
|
190
|
+
const outcomes = [];
|
|
191
|
+
const failures = [];
|
|
192
|
+
const failed = new Set();
|
|
193
|
+
const fail = (source, entry, message, url) => {
|
|
194
|
+
failed.add(`${source.name}\0${entry.path}`);
|
|
195
|
+
failures.push({ module: target.key, source: source.name, path: entry.path, url, message });
|
|
196
|
+
};
|
|
197
|
+
for (const source of sources) {
|
|
198
|
+
const record = (entry, action) => outcomes.push({ module: target.key, source: source.name, path: entry.path, action });
|
|
199
|
+
for (const entry of source.entries) {
|
|
200
|
+
if (entry.kind !== "file")
|
|
201
|
+
continue;
|
|
202
|
+
const url = resolveSourceUrl(source, entry.upstream);
|
|
203
|
+
if (!entry.pin) {
|
|
204
|
+
fail(source, entry, "the entry is not pinned — run `telo release stage --pin` to write its sha256 and executable", url);
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
const abs = path.join(target.dir, entry.path);
|
|
208
|
+
try {
|
|
209
|
+
assertConfined(target.dir, entry.path);
|
|
210
|
+
// The same check the kernel applies before reading a staged file.
|
|
211
|
+
if ((await checkStagedEntry(target.dir, source, entry)).state === "match") {
|
|
212
|
+
record(entry, "verified");
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const { content, executable } = await extractMember(archives, source, url, entry.member);
|
|
216
|
+
const digest = sha256Hex(content);
|
|
217
|
+
if (digest !== entry.pin.sha256) {
|
|
218
|
+
fail(source, entry, `member '${entry.member}' hashes to sha256 ${digest}, but the pin is ${entry.pin.sha256}`, url);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (executable !== entry.pin.executable) {
|
|
222
|
+
fail(source, entry, `member '${entry.member}' is ${executable ? "" : "not "}executable, but the pin says executable: ${entry.pin.executable}`, url);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
writeStaged(abs, content, executable);
|
|
226
|
+
record(entry, "staged");
|
|
227
|
+
}
|
|
228
|
+
catch (err) {
|
|
229
|
+
fail(source, entry, err instanceof Error ? err.message : String(err), url);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
for (const entry of source.entries) {
|
|
233
|
+
if (entry.kind !== "link")
|
|
234
|
+
continue;
|
|
235
|
+
const abs = path.join(target.dir, entry.path);
|
|
236
|
+
try {
|
|
237
|
+
assertConfined(target.dir, entry.path);
|
|
238
|
+
const existing = fs.lstatSync(abs, { throwIfNoEntry: false });
|
|
239
|
+
if (existing?.isSymbolicLink() && fs.readlinkSync(abs) === entry.target) {
|
|
240
|
+
record(entry, "verified");
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
fs.mkdirSync(path.dirname(abs), { recursive: true });
|
|
244
|
+
if (existing)
|
|
245
|
+
fs.rmSync(abs, { force: true });
|
|
246
|
+
fs.symlinkSync(entry.target, abs);
|
|
247
|
+
record(entry, "linked");
|
|
248
|
+
}
|
|
249
|
+
catch (err) {
|
|
250
|
+
fail(source, entry, err instanceof Error ? err.message : String(err));
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
for (const entry of source.entries) {
|
|
254
|
+
if (failed.has(`${source.name}\0${entry.path}`))
|
|
255
|
+
continue;
|
|
256
|
+
const abs = path.join(target.dir, entry.path);
|
|
257
|
+
let present;
|
|
258
|
+
try {
|
|
259
|
+
present =
|
|
260
|
+
entry.kind === "file"
|
|
261
|
+
? fs.lstatSync(abs, { throwIfNoEntry: false })?.isFile() === true
|
|
262
|
+
: fs.existsSync(abs);
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
fail(source, entry, err instanceof Error ? err.message : String(err));
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (!present) {
|
|
269
|
+
fail(source, entry, entry.kind === "file"
|
|
270
|
+
? "the file is absent after staging"
|
|
271
|
+
: `the link's target '${entry.target}' is absent after staging`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return { outcomes, failures };
|
|
276
|
+
}
|
|
277
|
+
/** YAML for a field value. A string is written in the quoting the replaced value
|
|
278
|
+
* used, and plain only when it reads back as that string — a digest of digits
|
|
279
|
+
* alone reads as a number unquoted. */
|
|
280
|
+
function renderValue(value, original) {
|
|
281
|
+
if (typeof value === "boolean")
|
|
282
|
+
return String(value);
|
|
283
|
+
if (original !== undefined && /^["']/.test(original)) {
|
|
284
|
+
const rendered = renderFixReplacement(original, value);
|
|
285
|
+
if (rendered !== undefined)
|
|
286
|
+
return rendered;
|
|
287
|
+
}
|
|
288
|
+
return isPlainSafe(value) && typeof parse(value) === "string" ? value : JSON.stringify(value);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Byte-splice edits setting `fields` on one mapping and touching nothing else: a
|
|
292
|
+
* key already present has its value replaced in place (an empty one gains a
|
|
293
|
+
* value), a missing key is added after the mapping's last entry, in the
|
|
294
|
+
* mapping's own style and line ending.
|
|
295
|
+
*/
|
|
296
|
+
function setMappingFields(text, node, at, fields) {
|
|
297
|
+
if (!isMap(node) || !node.range)
|
|
298
|
+
throw new Error(`${at}: expected a mapping with a source range`);
|
|
299
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
300
|
+
const edits = [];
|
|
301
|
+
const inserts = [];
|
|
302
|
+
for (const field of fields) {
|
|
303
|
+
const pair = node.items.find((item) => isPair(item) && isScalar(item.key) && item.key.value === field.key);
|
|
304
|
+
if (!pair) {
|
|
305
|
+
inserts.push(field);
|
|
306
|
+
continue;
|
|
307
|
+
}
|
|
308
|
+
edits.push(replaceValue(text, pair, `${at}.${field.key}`, field.value));
|
|
309
|
+
}
|
|
310
|
+
if (inserts.length === 0)
|
|
311
|
+
return edits;
|
|
312
|
+
const ends = node.items.map((item) => (isPair(item) ? pairEnd(text, item) : undefined));
|
|
313
|
+
if (ends.some((end) => end === undefined)) {
|
|
314
|
+
throw new Error(`${at}: expected scalar entries with source ranges; write the entry as plain key: value lines`);
|
|
315
|
+
}
|
|
316
|
+
const lastEnd = ends.length === 0 ? undefined : Math.max(...ends);
|
|
317
|
+
const rendered = inserts.map((field) => `${field.key}: ${renderValue(field.value, undefined)}`);
|
|
318
|
+
if (node.flow) {
|
|
319
|
+
// After the last entry rather than before the closing brace, which a
|
|
320
|
+
// trailing comma would leave doubled.
|
|
321
|
+
const start = lastEnd ?? text.indexOf("{", node.range[0]) + 1;
|
|
322
|
+
const lead = lastEnd === undefined ? "" : ", ";
|
|
323
|
+
edits.push({ start, end: start, newText: `${lead}${rendered.join(", ")}` });
|
|
324
|
+
return edits;
|
|
325
|
+
}
|
|
326
|
+
const first = node.items[0];
|
|
327
|
+
const firstKey = first && isScalar(first.key) ? first.key.range : undefined;
|
|
328
|
+
if (!firstKey || lastEnd === undefined)
|
|
329
|
+
throw new Error(`${at}: expected scalar entries with source ranges`);
|
|
330
|
+
const indent = firstKey[0] - (text.lastIndexOf("\n", firstKey[0] - 1) + 1);
|
|
331
|
+
const lineEnd = text.indexOf("\n", lastEnd);
|
|
332
|
+
const lines = rendered.map((line) => `${" ".repeat(indent)}${line}${eol}`).join("");
|
|
333
|
+
edits.push(lineEnd < 0
|
|
334
|
+
? { start: text.length, end: text.length, newText: `${eol}${lines}` }
|
|
335
|
+
: { start: lineEnd + 1, end: lineEnd + 1, newText: lines });
|
|
336
|
+
return edits;
|
|
337
|
+
}
|
|
338
|
+
/** Where one scalar pair ends in the text: its value, or the colon of an empty one. */
|
|
339
|
+
function pairEnd(text, pair) {
|
|
340
|
+
const keyEnd = isScalar(pair.key) ? pair.key.range?.[1] : undefined;
|
|
341
|
+
if (pair.value === null || (isScalar(pair.value) && pair.value.source === "")) {
|
|
342
|
+
const colon = keyEnd === undefined ? -1 : text.indexOf(":", keyEnd);
|
|
343
|
+
return colon < 0 ? undefined : colon + 1;
|
|
344
|
+
}
|
|
345
|
+
return isScalar(pair.value) ? pair.value.range?.[1] : undefined;
|
|
346
|
+
}
|
|
347
|
+
/** The edit replacing one pair's value; an empty value is written after its colon. */
|
|
348
|
+
function replaceValue(text, pair, at, value) {
|
|
349
|
+
const keyEnd = isScalar(pair.key) ? pair.key.range?.[1] : undefined;
|
|
350
|
+
if (pair.value === null || (isScalar(pair.value) && pair.value.source === "")) {
|
|
351
|
+
const colon = keyEnd === undefined ? -1 : text.indexOf(":", keyEnd);
|
|
352
|
+
if (colon < 0)
|
|
353
|
+
throw new Error(`${at}: expected a key with a source range`);
|
|
354
|
+
const start = text[colon + 1] === " " ? colon + 2 : colon + 1;
|
|
355
|
+
return { start, end: start, newText: `${start === colon + 1 ? " " : ""}${renderValue(value, undefined)}` };
|
|
356
|
+
}
|
|
357
|
+
const range = isScalar(pair.value) ? pair.value.range : undefined;
|
|
358
|
+
if (!range)
|
|
359
|
+
throw new Error(`${at}: expected a scalar with a source range`);
|
|
360
|
+
const original = text.slice(range[0], range[1]);
|
|
361
|
+
if (/[\n\r]/.test(original)) {
|
|
362
|
+
throw new Error(`${at}: the existing value spans several lines and cannot be rewritten in place; write it on one line`);
|
|
363
|
+
}
|
|
364
|
+
return { start: range[0], end: range[1], newText: renderValue(value, original) };
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Why `text` does not carry exactly the pins and inputs computed, or undefined
|
|
368
|
+
* when it does — read with the same reader everything downstream uses, so an
|
|
369
|
+
* edit that produced invalid YAML, or YAML meaning something else, is never
|
|
370
|
+
* written.
|
|
371
|
+
*/
|
|
372
|
+
function pinsReadBackProblem(text, pins, inputs) {
|
|
373
|
+
const docs = parseAllDocuments(text, { customTags: defaultCustomTags() });
|
|
374
|
+
const broken = docs.find((doc) => doc.errors.length > 0);
|
|
375
|
+
if (broken)
|
|
376
|
+
return `the edited manifest does not parse: ${broken.errors[0].message}`;
|
|
377
|
+
const owner = docs
|
|
378
|
+
.map((doc) => doc.toJSON())
|
|
379
|
+
.find((json) => typeof json?.kind === "string" && isModuleKind(json.kind));
|
|
380
|
+
const { sources, problems } = readModuleSources(owner);
|
|
381
|
+
if (problems.length > 0) {
|
|
382
|
+
return `the edited sources: block does not read: ${problems.map((problem) => problem.message).join("; ")}`;
|
|
383
|
+
}
|
|
384
|
+
for (const { source, entry, pin } of pins) {
|
|
385
|
+
const read = sources
|
|
386
|
+
.find((candidate) => candidate.name === source.name)
|
|
387
|
+
?.entries.find((candidate) => candidate.key === entry.key);
|
|
388
|
+
if (read?.kind !== "file" || read.pin?.sha256 !== pin.sha256 || read.pin.executable !== pin.executable) {
|
|
389
|
+
return `source '${source.name}' entry '${entry.key}' does not read back with the pin written`;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
for (const [name, digest] of inputs) {
|
|
393
|
+
if (sources.find((candidate) => candidate.name === name)?.build?.inputs !== digest) {
|
|
394
|
+
return `source '${name}' does not read back with the build inputs written`;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return undefined;
|
|
398
|
+
}
|
|
399
|
+
/** Replace a file's contents in one step, keeping its mode: a crash or a full
|
|
400
|
+
* disk leaves the old manifest, never half of the new one. */
|
|
401
|
+
function replaceFile(file, text) {
|
|
402
|
+
const temp = path.join(path.dirname(file), `.${path.basename(file)}.${process.pid}.tmp`);
|
|
403
|
+
fs.writeFileSync(temp, text, { mode: fs.statSync(file).mode & 0o777 });
|
|
404
|
+
try {
|
|
405
|
+
fs.renameSync(temp, file);
|
|
406
|
+
}
|
|
407
|
+
catch (err) {
|
|
408
|
+
fs.rmSync(temp, { force: true });
|
|
409
|
+
throw err;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Stage one module's `sources:`. With `pin`, fetch every file entry, write its
|
|
414
|
+
* `sha256` and `executable` — and each built source's `build.inputs` — into the
|
|
415
|
+
* manifest, then stage against those pins. A module with no `sources:` block
|
|
416
|
+
* yields an empty result.
|
|
417
|
+
*/
|
|
418
|
+
export async function stageModule(target, options) {
|
|
419
|
+
const failures = [];
|
|
420
|
+
const moduleDoc = readModuleDoc(target, failures, options.pin);
|
|
421
|
+
if (!moduleDoc)
|
|
422
|
+
return { outcomes: [], failures };
|
|
423
|
+
if (!options.pin)
|
|
424
|
+
return stageSources(target, moduleDoc.sources, options.archives);
|
|
425
|
+
const pins = [];
|
|
426
|
+
for (const source of moduleDoc.sources) {
|
|
427
|
+
for (const entry of source.entries) {
|
|
428
|
+
if (entry.kind !== "file")
|
|
429
|
+
continue;
|
|
430
|
+
const url = resolveSourceUrl(source, entry.upstream);
|
|
431
|
+
try {
|
|
432
|
+
const { content, executable } = await extractMember(options.archives, source, url, entry.member);
|
|
433
|
+
pins.push({ source, entry, pin: { sha256: sha256Hex(content), executable } });
|
|
434
|
+
}
|
|
435
|
+
catch (err) {
|
|
436
|
+
failures.push({
|
|
437
|
+
module: target.key,
|
|
438
|
+
source: source.name,
|
|
439
|
+
path: entry.path,
|
|
440
|
+
url,
|
|
441
|
+
message: err instanceof Error ? err.message : String(err),
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
// A built source records what built its files beside their pins, so a later
|
|
447
|
+
// edit to that crate or a path dependency is caught by `release check`.
|
|
448
|
+
const inputs = new Map();
|
|
449
|
+
for (const source of moduleDoc.sources) {
|
|
450
|
+
if (source.build === undefined)
|
|
451
|
+
continue;
|
|
452
|
+
try {
|
|
453
|
+
inputs.set(source.name, await crateInputsDigest(path.resolve(target.dir, source.build.cargo)));
|
|
454
|
+
}
|
|
455
|
+
catch (err) {
|
|
456
|
+
failures.push({
|
|
457
|
+
module: target.key,
|
|
458
|
+
source: source.name,
|
|
459
|
+
message: `cannot digest crate '${source.build.cargo}': ${err instanceof Error ? err.message : String(err)}`,
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// All or nothing: a manifest carrying some new pins and some stale ones would
|
|
464
|
+
// verify against a mix no single upstream state produced.
|
|
465
|
+
if (failures.length > 0)
|
|
466
|
+
return { outcomes: [], failures };
|
|
467
|
+
const { doc, text } = moduleDoc;
|
|
468
|
+
let updated;
|
|
469
|
+
try {
|
|
470
|
+
const edits = [
|
|
471
|
+
...pins.flatMap(({ source, entry, pin }) => setMappingFields(text, doc.getIn(["sources", source.name, "entries", entry.key], true), `sources.${source.name}.entries.${entry.key}`, [
|
|
472
|
+
{ key: "sha256", value: pin.sha256 },
|
|
473
|
+
{ key: "executable", value: pin.executable },
|
|
474
|
+
])),
|
|
475
|
+
...[...inputs].flatMap(([name, digest]) => setMappingFields(text, doc.getIn(["sources", name, "build"], true), `sources.${name}.build`, [
|
|
476
|
+
{ key: "inputs", value: digest },
|
|
477
|
+
])),
|
|
478
|
+
];
|
|
479
|
+
updated = applyTextEdits(text, edits);
|
|
480
|
+
}
|
|
481
|
+
catch (err) {
|
|
482
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
483
|
+
failures.push({ module: target.key, message: `cannot write pins into ${target.manifestPath}: ${detail}` });
|
|
484
|
+
return { outcomes: [], failures };
|
|
485
|
+
}
|
|
486
|
+
const readBack = pinsReadBackProblem(updated, pins, inputs);
|
|
487
|
+
if (readBack) {
|
|
488
|
+
failures.push({
|
|
489
|
+
module: target.key,
|
|
490
|
+
message: `cannot write pins into ${target.manifestPath}: ${readBack}. The manifest was left ` +
|
|
491
|
+
`unchanged — write the entry as plain \`key: value\` lines and run \`telo release stage --pin\` again.`,
|
|
492
|
+
});
|
|
493
|
+
return { outcomes: [], failures };
|
|
494
|
+
}
|
|
495
|
+
if (updated !== text)
|
|
496
|
+
replaceFile(target.manifestPath, updated);
|
|
497
|
+
const outcomes = pins.map(({ source, entry }) => ({
|
|
498
|
+
module: target.key,
|
|
499
|
+
source: source.name,
|
|
500
|
+
path: entry.path,
|
|
501
|
+
action: "pinned",
|
|
502
|
+
}));
|
|
503
|
+
const staged = await stageModule(target, { pin: false, archives: options.archives });
|
|
504
|
+
return { outcomes: [...outcomes, ...staged.outcomes], failures: staged.failures };
|
|
505
|
+
}
|
|
506
|
+
//# sourceMappingURL=stage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage.js","sourceRoot":"","sources":["../../src/release/stage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,GAMjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAoB,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAA4B,MAAM,MAAM,CAAC;AACnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAiCtD,MAAM,gBAAgB,GAAG,CAAC,GAAG,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