@adea-ai/app-framework-release-tools 0.9.1 → 0.10.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 CHANGED
@@ -39,7 +39,10 @@ __export(exports_src, {
39
39
  inspectDailyBatch: () => inspectDailyBatch,
40
40
  inspectDailyPreSigning: () => inspectDailyPreSigning,
41
41
  inspectStagedStep: () => inspectStagedStep,
42
+ packageChannelNames: () => packageChannelNames,
43
+ parsePackageChannelManifest: () => parsePackageChannelManifest,
42
44
  planDailyReleaseMatrix: () => planDailyReleaseMatrix,
45
+ planPackageChannels: () => planPackageChannels,
43
46
  planQualificationRun: () => planQualificationRun2,
44
47
  planReleaseAssets: () => planReleaseAssets2,
45
48
  promoteDailyBatch: () => promoteDailyBatch,
@@ -316,10 +319,18 @@ function assertPayloadLayout(options) {
316
319
  if (!entries.includes(fold ? name.toLowerCase() : name))
317
320
  throw new Error(`Payload missing ${name}`);
318
321
  }
319
- const containsCef = entries.some((name) => /(?:^|\/)(?:chromium embedded framework|libcef\.dll|libcef\.so)$/i.test(name));
320
- if (containsCef !== (renderer === "cef"))
322
+ if (payloadRenderer(entries) !== renderer)
321
323
  throw new Error("Payload does not match selected renderer");
322
324
  }
325
+ function payloadRenderer(entries) {
326
+ return entries.some((name) => /(?:^|\/)(?:chromium embedded framework|libcef\.dll|libcef\.so)$/i.test(name)) ? "cef" : "native";
327
+ }
328
+ function acceptedUpdateRenderers(renderer, accepted) {
329
+ const all = [renderer, ...accepted ?? []];
330
+ if (all.some((item) => item !== "native" && item !== "cef"))
331
+ throw new Error("Invalid installer profile");
332
+ return [...new Set(all)];
333
+ }
323
334
  function assertInstallerLayout(platform, appName, entries) {
324
335
  assertPortableAppName(appName);
325
336
  if (platform !== "windows-x64" && platform !== "linux-x64" && platform !== "linux-arm64")
@@ -4548,6 +4559,8 @@ function planDailyReleaseMatrix(config, tag) {
4548
4559
  const requirements = parsed.requirements(tag);
4549
4560
  const profile = config.dailyReleaseProfile;
4550
4561
  const expanded = profile === expandedDesktopDailyProfile;
4562
+ requireThat(config.dailyInstallerSigning === undefined || config.dailyInstallerSigning === "required", 'dailyInstallerSigning must be "required" when present');
4563
+ const installerSigning = expanded || config.dailyInstallerSigning === "required";
4551
4564
  const checks = [];
4552
4565
  const primaryAssets = [];
4553
4566
  for (const platform of expanded ? expandedPlatforms : platforms) {
@@ -4592,10 +4605,12 @@ function planDailyReleaseMatrix(config, tag) {
4592
4605
  discoveryPolicies(config, tag);
4593
4606
  const all = [...primaryAssets, ...requirements.releaseAssets];
4594
4607
  requireThat(new Set(all).size === all.length, "Daily release assets are not unique");
4595
- return { appId: config.appId, profile, assets: all, checks };
4608
+ return { appId: config.appId, profile, installerSigning, assets: all, checks };
4596
4609
  }
4597
- function requiresDailyInstallerSigning(profile, check) {
4598
- return profile === expandedDesktopDailyProfile && (check.format === "dmg" || check.format === "windows-setup");
4610
+ function requiresDailyInstallerSigning(matrix, check) {
4611
+ if (!matrix.installerSigning)
4612
+ return false;
4613
+ return matrix.profile === expandedDesktopDailyProfile ? check.format === "dmg" || check.format === "windows-setup" : check.format === "dmg";
4599
4614
  }
4600
4615
  function priorDailyInstallerNames(config, tag, check) {
4601
4616
  const plan = planDailyReleaseMatrix(config, tag);
@@ -4676,7 +4691,7 @@ var verifiedMatrix = (options, verifyPrior) => Effect16.gen(function* () {
4676
4691
  const valid = yield* attempt(() => validateDailyNativeEvidence(raw.value, "framework/daily-native-receipt/v2", {
4677
4692
  appId: matrix.appId,
4678
4693
  profile: matrix.profile,
4679
- signing: requiresDailyInstallerSigning(matrix.profile, check) ? installerSigningPolicy(config, check) : undefined,
4694
+ signing: requiresDailyInstallerSigning(matrix, check) ? installerSigningPolicy(config, check) : undefined,
4680
4695
  identity,
4681
4696
  check,
4682
4697
  assets: check.assets.map((name) => inventory.get(name)),
@@ -4875,7 +4890,7 @@ var createDailyNativeReceiptEffect = (options, worker, observedSigning) => Effec
4875
4890
  const [os, arch] = platformTargets[check.platform];
4876
4891
  if (worker.os !== os || worker.arch !== arch)
4877
4892
  return yield* fail(`Daily native check requires ${check.platform}`);
4878
- const signing = requiresDailyInstallerSigning(matrix.profile, check) ? yield* attempt(() => installerSigningPolicy(config, check)) : undefined;
4893
+ const signing = requiresDailyInstallerSigning(matrix, check) ? yield* attempt(() => installerSigningPolicy(config, check)) : undefined;
4879
4894
  if (signing && !observedSigning)
4880
4895
  return yield* fail("Expanded Daily installers require proof from the live native observer");
4881
4896
  const fs = yield* ReleaseFs;
@@ -7779,7 +7794,8 @@ async function extractVerifiedUpdate(options) {
7779
7794
  return extractBoundArchive(options, descriptor, async (file) => verifyReleaseStream(file.createReadStream({ autoClose: false, start: 0 }), descriptor));
7780
7795
  }
7781
7796
  async function extractBoundArchive(options, descriptor, verifyBeforeExtraction) {
7782
- const { archive, platform, renderer, appName, maxCompressedBytes, maxExpandedBytes } = options;
7797
+ const { archive, platform, appName, maxCompressedBytes, maxExpandedBytes } = options;
7798
+ const accepted = acceptedUpdateRenderers(options.renderer, options.acceptedRenderers);
7783
7799
  if (!isAbsolute6(archive) || !isAbsolute6(options.directory) || !Number.isSafeInteger(maxCompressedBytes) || maxCompressedBytes < 1 || !Number.isSafeInteger(descriptor.asset.size) || descriptor.asset.size < 1 || descriptor.asset.size > maxCompressedBytes || !/^[a-f0-9]{64}$/.test(descriptor.asset.sha256) || !Number.isSafeInteger(maxExpandedBytes) || maxExpandedBytes < 1)
7784
7800
  throw new Error("Invalid update extraction context");
7785
7801
  assertPortableAppName(appName);
@@ -7865,7 +7881,7 @@ async function extractBoundArchive(options, descriptor, verifyBeforeExtraction)
7865
7881
  if (seen.has(key) || seen.size >= 200000)
7866
7882
  return reject();
7867
7883
  const relative = normalized.slice(archiveRoot.length + 1), linkTarget = typeof entry.linkpath === "string" ? entry.linkpath : "";
7868
- const cefLink = (platform === "linux-x64" || platform === "linux-arm64") && renderer === "cef" && entry.type === "SymbolicLink" && isLinuxCefLibraryLink(relative, linkTarget);
7884
+ const cefLink = (platform === "linux-x64" || platform === "linux-arm64") && accepted.includes("cef") && entry.type === "SymbolicLink" && isLinuxCefLibraryLink(relative, linkTarget);
7869
7885
  if (entry.type !== "File" && entry.type !== "Directory" && !cefLink)
7870
7886
  return reject();
7871
7887
  seen.add(key);
@@ -7930,6 +7946,9 @@ async function extractBoundArchive(options, descriptor, verifyBeforeExtraction)
7930
7946
  }
7931
7947
  }
7932
7948
  await rm8(decompressed);
7949
+ const renderer = payloadRenderer(entries);
7950
+ if (!accepted.includes(renderer))
7951
+ throw new Error("Payload does not match selected renderer");
7933
7952
  assertPayloadLayout({ platform, renderer, appName, entries, sidecars });
7934
7953
  const prefix = isMacInstallerPlatform(platform) ? join22(`${appName}.app`, "Contents") : appName.replaceAll(" ", "");
7935
7954
  const resources = join22(payloadRoot, prefix, "Resources");
@@ -8761,6 +8780,7 @@ async function stageUpdateSwap(options) {
8761
8780
  directory: preparing,
8762
8781
  platform: plan.platform,
8763
8782
  renderer: plan.renderer,
8783
+ ...options.acceptedRenderers ? { acceptedRenderers: options.acceptedRenderers } : {},
8764
8784
  appName: plan.appName,
8765
8785
  maxCompressedBytes: options.maxCompressedBytes,
8766
8786
  maxExpandedBytes: options.maxExpandedBytes,
@@ -10647,6 +10667,553 @@ async function buildStandaloneWindowsExe(options) {
10647
10667
  await rm13(work, { recursive: true, force: true });
10648
10668
  }
10649
10669
  }
10670
+ // src/library/package-channels.ts
10671
+ var packageChannelNames = [
10672
+ "homebrew",
10673
+ "winget",
10674
+ "apt",
10675
+ "pacman",
10676
+ "rpm",
10677
+ "flatpak"
10678
+ ];
10679
+ function ensure(ok, message) {
10680
+ if (!ok)
10681
+ throw new Error(message);
10682
+ }
10683
+ function object(value, label) {
10684
+ ensure(typeof value === "object" && value !== null && !Array.isArray(value), `Expected ${label} to be a JSON object`);
10685
+ return value;
10686
+ }
10687
+ function keys2(row, label, required, optional = []) {
10688
+ for (const key of required)
10689
+ ensure(Object.hasOwn(row, key), `Missing ${label}.${key}`);
10690
+ for (const key of Object.keys(row))
10691
+ ensure(required.includes(key) || optional.includes(key), `Unknown ${label}.${key}`);
10692
+ }
10693
+ function text3(value, label, pattern, max = 200) {
10694
+ ensure(typeof value === "string" && value.length > 0 && value.length <= max && !Array.from(value).some((c) => c.charCodeAt(0) < 32 || c.charCodeAt(0) === 127) && (!pattern || pattern.test(value)), `Invalid ${label}`);
10695
+ return value;
10696
+ }
10697
+ function https(value, label, directory) {
10698
+ const url = new URL(text3(value, label, undefined, 500));
10699
+ ensure(url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash, `Expected canonical HTTPS URL for ${label}`);
10700
+ ensure(url.href === value, `Expected canonical HTTPS URL for ${label}`);
10701
+ ensure(url.pathname.endsWith("/") === directory, `Expected ${label} to ${directory ? "" : "not "}end in /`);
10702
+ return url;
10703
+ }
10704
+ var tagPattern3 = /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;
10705
+ var sha256Pattern = /^[a-f0-9]{64}$/;
10706
+ var gitShaPattern = /^[a-f0-9]{40}$/;
10707
+ var filePattern = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
10708
+ var templatePattern = /^[A-Za-z0-9][A-Za-z0-9._-]*\{tag\}[A-Za-z0-9._-]*$/;
10709
+ var packagePattern = /^[a-z0-9][a-z0-9+.-]{0,62}$/;
10710
+ var reverseDns = /^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*){2,}$/;
10711
+ var relativePath2 = /^[A-Za-z0-9][A-Za-z0-9._-]*(\/[A-Za-z0-9][A-Za-z0-9._-]*)*$/;
10712
+ var quoted = JSON.stringify;
10713
+ var ruby = (value) => JSON.stringify(value).replace(/#(?=[{@$])/g, "\\#");
10714
+ var shell = (value) => `'${value.replaceAll("'", "'\\''")}'`;
10715
+ function parseAsset(value) {
10716
+ const row = object(value, "manifest asset");
10717
+ const size = row.size;
10718
+ ensure(typeof size === "number" && Number.isSafeInteger(size) && size > 0, "Invalid asset size");
10719
+ const sha256 = row.sha256 ?? row.digest;
10720
+ return {
10721
+ name: text3(row.name, "asset name", filePattern),
10722
+ size,
10723
+ sha256: text3(sha256, "asset SHA-256", sha256Pattern)
10724
+ };
10725
+ }
10726
+ function parsePackageChannelManifest(value) {
10727
+ const doc = object(value, "manifest");
10728
+ let raw;
10729
+ let manifest;
10730
+ if (doc.schema === "framework/daily-batch/v1") {
10731
+ const identity = object(doc.identity, "manifest identity");
10732
+ ensure(Array.isArray(doc.artifacts), "Expected Daily batch artifacts");
10733
+ raw = doc.artifacts;
10734
+ manifest = {
10735
+ appId: text3(identity.appId, "manifest appId"),
10736
+ tag: text3(identity.tag, "release tag", tagPattern3),
10737
+ channel: "daily",
10738
+ sourceSha: text3(identity.sourceSha, "source SHA", gitShaPattern)
10739
+ };
10740
+ } else {
10741
+ ensure(doc.schema === undefined, "Unsupported manifest schema");
10742
+ ensure(doc.channel === "daily" || doc.channel === "stable", "Expected release channel");
10743
+ ensure(Array.isArray(doc.assets), "Expected release assets");
10744
+ raw = doc.assets;
10745
+ manifest = {
10746
+ appId: null,
10747
+ tag: text3(doc.tag, "release tag", tagPattern3),
10748
+ channel: doc.channel,
10749
+ sourceSha: null
10750
+ };
10751
+ }
10752
+ ensure(raw.length > 0 && raw.length <= 512, "Expected a bounded asset inventory");
10753
+ const assets = new Map;
10754
+ for (const entry of raw) {
10755
+ const asset = parseAsset(entry);
10756
+ ensure(!assets.has(asset.name), `Duplicate manifest asset ${asset.name}`);
10757
+ assets.set(asset.name, asset);
10758
+ }
10759
+ return { ...manifest, assets };
10760
+ }
10761
+ function exact2(context, template, label, suffixes) {
10762
+ const name = text3(template, `${label} artifact template`, templatePattern).replace("{tag}", context.manifest.tag);
10763
+ ensure(suffixes.some((suffix) => name.endsWith(suffix)), `Expected ${label} artifact ending in ${suffixes.join(" or ")}`);
10764
+ const asset = context.manifest.assets.get(name);
10765
+ ensure(asset, `The manifest has no ${name}`);
10766
+ return {
10767
+ ...asset,
10768
+ url: new URL(`${context.manifest.tag}/${name}`, context.common.releaseBase).href
10769
+ };
10770
+ }
10771
+ function stageInput(context, asset) {
10772
+ return {
10773
+ path: "stage-input.json",
10774
+ contents: JSON.stringify({
10775
+ schema: "framework/package-channel-stage-input/v1",
10776
+ appId: context.common.appId,
10777
+ tag: context.manifest.tag,
10778
+ channel: context.manifest.channel,
10779
+ sourceSha: context.manifest.sourceSha,
10780
+ asset
10781
+ }, null, 2) + `
10782
+ `
10783
+ };
10784
+ }
10785
+ function homebrew(context, row) {
10786
+ keys2(row, "homebrew", ["tap", "token", "bundle", "artifact"]);
10787
+ const tap = text3(row.tap, "Homebrew tap", /^[A-Za-z0-9][A-Za-z0-9-]*\/homebrew-[a-z0-9][a-z0-9-]*$/);
10788
+ const stableToken = text3(row.token, "cask token", /^[a-z0-9]+(?:-[a-z0-9]+)*$/);
10789
+ const bundle = text3(row.bundle, "app bundle", /^[A-Za-z0-9][A-Za-z0-9 ._-]*\.app$/);
10790
+ const asset = exact2(context, row.artifact, "Homebrew", [".dmg"]);
10791
+ const stable = context.manifest.channel === "stable";
10792
+ const token = stable ? stableToken : `${stableToken}@daily`;
10793
+ const [owner, repository] = tap.split("/");
10794
+ const tapName = `${owner}/${repository.slice("homebrew-".length)}`;
10795
+ const { name, description, homepage } = context.common;
10796
+ return {
10797
+ status: "planned",
10798
+ catalogEligible: stable,
10799
+ asset,
10800
+ files: [
10801
+ {
10802
+ path: `Casks/${token}.rb`,
10803
+ contents: `cask ${ruby(token)} do
10804
+ version ${ruby(context.version)}
10805
+ sha256 ${ruby(asset.sha256)}
10806
+
10807
+ url ${ruby(asset.url)}
10808
+ name ${ruby(stable ? name : `${name} Daily`)}
10809
+ desc ${ruby(description)}
10810
+ homepage ${ruby(homepage)}
10811
+
10812
+ depends_on arch: :arm64
10813
+ conflicts_with cask: ${ruby(stable ? `${stableToken}@daily` : stableToken)}
10814
+
10815
+ app ${ruby(bundle)}
10816
+ end
10817
+ `
10818
+ }
10819
+ ],
10820
+ install: `brew install --cask ${tapName}/${token}`
10821
+ };
10822
+ }
10823
+ function winget(context, row) {
10824
+ keys2(row, "winget", ["identifier", "publisher", "artifact", "silent", "silentWithProgress"], ["nestedInstaller"]);
10825
+ const stableId = text3(row.identifier, "WinGet package identifier", /^[A-Za-z0-9][A-Za-z0-9-]*(\.[A-Za-z0-9][A-Za-z0-9-]*)+$/);
10826
+ const publisher = text3(row.publisher, "WinGet publisher");
10827
+ const asset = exact2(context, row.artifact, "WinGet", [".exe", ".zip"]);
10828
+ const direct = asset.name.endsWith(".exe");
10829
+ ensure(direct === (row.nestedInstaller === undefined), direct ? "A direct .exe installer takes no nestedInstaller" : "A .zip installer needs nestedInstaller");
10830
+ const nested = direct ? undefined : text3(row.nestedInstaller, "nested executable", /^[A-Za-z0-9][A-Za-z0-9 ._-]*\.exe$/i);
10831
+ const flags = /^[-/][a-zA-Z0-9_-]+(?: [-/][a-zA-Z0-9_-]+)*$/;
10832
+ const silent = text3(row.silent, "silent flags", flags);
10833
+ const progress = text3(row.silentWithProgress, "silent progress flags", flags);
10834
+ const stable = context.manifest.channel === "stable";
10835
+ const id = stable ? stableId : `${stableId}.Daily`;
10836
+ const { name, description, homepage, license } = context.common;
10837
+ const schemaVersion = "1.12.0";
10838
+ const base = `manifests/${id[0].toLowerCase()}/${id.replaceAll(".", "/")}/${context.version}/${id}`;
10839
+ const manifest = (type, body) => `# yaml-language-server: $schema=https://aka.ms/winget-manifest.${type}.${schemaVersion}.schema.json
10840
+ PackageIdentifier: ${quoted(id)}
10841
+ PackageVersion: ${quoted(context.version)}
10842
+ ${body}ManifestType: ${type}
10843
+ ManifestVersion: ${schemaVersion}
10844
+ `;
10845
+ return {
10846
+ status: "planned",
10847
+ catalogEligible: stable,
10848
+ asset,
10849
+ files: [
10850
+ { path: `${base}.yaml`, contents: manifest("version", `DefaultLocale: en-US
10851
+ `) },
10852
+ {
10853
+ path: `${base}.installer.yaml`,
10854
+ contents: manifest("installer", `${direct ? "InstallerType: exe" : `InstallerType: zip
10855
+ NestedInstallerType: exe
10856
+ NestedInstallerFiles:
10857
+ - RelativeFilePath: ${quoted(nested)}`}
10858
+ InstallerSwitches:
10859
+ Silent: ${quoted(silent)}
10860
+ SilentWithProgress: ${quoted(progress)}
10861
+ UpgradeBehavior: install
10862
+ Installers:
10863
+ - Architecture: x64
10864
+ InstallerUrl: ${quoted(asset.url)}
10865
+ InstallerSha256: ${asset.sha256.toUpperCase()}
10866
+ `)
10867
+ },
10868
+ {
10869
+ path: `${base}.locale.en-US.yaml`,
10870
+ contents: manifest("defaultLocale", `PackageLocale: en-US
10871
+ Publisher: ${quoted(publisher)}
10872
+ PublisherUrl: ${quoted(homepage)}
10873
+ PackageName: ${quoted(stable ? name : `${name} Daily`)}
10874
+ PackageUrl: ${quoted(homepage)}
10875
+ License: ${quoted(license)}
10876
+ ShortDescription: ${quoted(description)}
10877
+ `)
10878
+ }
10879
+ ],
10880
+ install: stable ? `winget install --exact --id ${id}` : `winget install --manifest ${base.slice(0, base.lastIndexOf("/")).replaceAll("/", "\\")}`
10881
+ };
10882
+ }
10883
+ function apt(context, row) {
10884
+ keys2(row, "apt", ["packageName", "artifact", "repository", "suite", "keyUrl"], ["component"]);
10885
+ const pkg = text3(row.packageName, "Debian package name", packagePattern);
10886
+ const asset = exact2(context, row.artifact, "APT", [".deb"]);
10887
+ const repository = https(row.repository, "APT repository", true).href;
10888
+ const suite = text3(row.suite, "APT suite", /^(daily|stable)$/);
10889
+ ensure(suite === context.manifest.channel, `APT suite ${suite} does not match the ${context.manifest.channel} manifest`);
10890
+ const component = text3(row.component ?? "main", "APT component", /^main$/);
10891
+ const keyUrl = https(row.keyUrl, "APT key URL", false).href;
10892
+ const keyring = `/usr/share/keyrings/${pkg}-archive-keyring.gpg`;
10893
+ const sources = `${pkg}.sources`;
10894
+ return {
10895
+ status: "planned",
10896
+ catalogEligible: false,
10897
+ asset,
10898
+ files: [
10899
+ {
10900
+ path: sources,
10901
+ contents: `Types: deb
10902
+ URIs: ${repository}
10903
+ Suites: ${suite}
10904
+ Components: ${component}
10905
+ Architectures: amd64
10906
+ Signed-By: ${keyring}
10907
+ `
10908
+ },
10909
+ stageInput(context, asset)
10910
+ ],
10911
+ install: [
10912
+ `curl -fsSL ${shell(keyUrl)} | sudo gpg --dearmor -o ${keyring}`,
10913
+ `curl -fsSL ${shell(repository + sources)} | sudo tee /etc/apt/sources.list.d/${sources} >/dev/null`,
10914
+ `sudo apt update`,
10915
+ `sudo apt install ${pkg}`
10916
+ ].join(" && ")
10917
+ };
10918
+ }
10919
+ function pacman(context, row) {
10920
+ keys2(row, "pacman", ["packageName", "repository", "base", "keyUrl"], ["keyFingerprint"]);
10921
+ const pkg = text3(row.packageName, "Arch package name", /^[a-z0-9@_+][a-z0-9@._+-]{0,62}$/);
10922
+ const repo = text3(row.repository, "pacman repository name", /^[a-z0-9][a-z0-9_-]{0,63}$/);
10923
+ const base = https(row.base, "pacman repository base", true).href;
10924
+ const keyUrl = https(row.keyUrl, "pacman key URL", false).href;
10925
+ ensure(row.keyFingerprint !== undefined, "Needs keyFingerprint: the pacman signing key is not pinned");
10926
+ const fingerprint = text3(row.keyFingerprint, "pacman key fingerprint", /^[A-F0-9]{40}$/);
10927
+ const snippet = `[${repo}]
10928
+ SigLevel = Required TrustedOnly
10929
+ Server = ${base}$arch
10930
+ `;
10931
+ return {
10932
+ status: "planned",
10933
+ catalogEligible: false,
10934
+ asset: null,
10935
+ files: [
10936
+ { path: "pacman.conf.snippet", contents: snippet },
10937
+ {
10938
+ path: "stage-input.json",
10939
+ contents: JSON.stringify({
10940
+ schema: "framework/package-channel-stage-input/v1",
10941
+ appId: context.common.appId,
10942
+ tag: context.manifest.tag,
10943
+ channel: context.manifest.channel,
10944
+ sourceSha: context.manifest.sourceSha,
10945
+ packageName: pkg,
10946
+ repository: repo,
10947
+ keyFingerprint: fingerprint
10948
+ }, null, 2) + `
10949
+ `
10950
+ }
10951
+ ],
10952
+ install: [
10953
+ `curl -fsSL ${shell(keyUrl)} | sudo pacman-key --add -`,
10954
+ `sudo pacman-key --lsign-key ${fingerprint}`,
10955
+ `printf ${shell(snippet.replaceAll(`
10956
+ `, "\\n"))} | sudo tee -a /etc/pacman.conf >/dev/null`,
10957
+ `sudo pacman -Sy ${pkg}`
10958
+ ].join(" && ")
10959
+ };
10960
+ }
10961
+ function linuxPayload(context, row, label) {
10962
+ const asset = exact2(context, row.artifact, label, [".tar.zst", ".tar.gz", ".tar.xz"]);
10963
+ const bundleRoot = text3(row.bundleRoot, `${label} bundle root`, filePattern);
10964
+ const launcher = text3(row.launcher, `${label} launcher`, relativePath2);
10965
+ ensure(!launcher.split("/").includes(".."), `Invalid ${label} launcher`);
10966
+ const formatEnvironment = text3(row.formatEnvironment, `${label} format environment`, /^[A-Z][A-Z0-9_]*_LINUX_PACKAGE_FORMAT$/);
10967
+ return { asset, bundleRoot, launcher, formatEnvironment };
10968
+ }
10969
+ function rpm(context, row) {
10970
+ keys2(row, "rpm", [
10971
+ "packageName",
10972
+ "artifact",
10973
+ "repoId",
10974
+ "repository",
10975
+ "keyUrl",
10976
+ "bundleRoot",
10977
+ "launcher",
10978
+ "executable",
10979
+ "formatEnvironment"
10980
+ ], ["requires"]);
10981
+ const pkg = text3(row.packageName, "RPM package name", /^[a-z0-9][a-z0-9._+-]{0,62}$/);
10982
+ const { asset, bundleRoot, launcher, formatEnvironment } = linuxPayload(context, row, "RPM");
10983
+ const repoId = text3(row.repoId, "RPM repository id", /^[a-z0-9][a-z0-9_-]{0,63}$/);
10984
+ const repository = https(row.repository, "RPM repository", true).href;
10985
+ const keyUrl = https(row.keyUrl, "RPM key URL", false).href;
10986
+ const executable = text3(row.executable, "RPM executable", /^[a-z0-9][a-z0-9._-]{0,63}$/);
10987
+ const requires = row.requires ?? [];
10988
+ ensure(Array.isArray(requires) && requires.length <= 64, "Invalid RPM requires");
10989
+ const requireLines = requires.map((entry) => `Requires: ${text3(entry, "RPM requirement", /^[A-Za-z0-9][A-Za-z0-9._+()-]*( (>=|=|<=) [A-Za-z0-9._+~^-]+)?$/)}
10990
+ `);
10991
+ const { name, description, homepage, license } = context.common;
10992
+ const spec = `# Generated by @adea-ai/app-framework-release-tools from ${asset.name}.
10993
+ # Repackages the verified portable payload; check Source0 against the SHA-256 before building.
10994
+ %global debug_package %{nil}
10995
+ %global __strip /bin/true
10996
+ %global _build_id_links none
10997
+ %global payload_sha256 ${asset.sha256}
10998
+
10999
+ Name: ${pkg}
11000
+ Version: ${context.version}
11001
+ Release: 1
11002
+ Summary: ${description}
11003
+ License: ${license}
11004
+ URL: ${homepage}
11005
+ Source0: ${asset.url}
11006
+ ExclusiveArch: x86_64
11007
+ AutoReqProv: no
11008
+ ${requireLines.join("")}
11009
+ %description
11010
+ ${name}: ${description}
11011
+
11012
+ %prep
11013
+ echo "%{payload_sha256} %{SOURCE0}" | sha256sum --check --strict
11014
+ %setup -q -c -T
11015
+ tar --no-same-owner -xf %{SOURCE0}
11016
+ test -d ${shell(bundleRoot)}
11017
+
11018
+ %install
11019
+ mkdir -p %{buildroot}%{_libdir}/${pkg} %{buildroot}%{_bindir}
11020
+ cp -a ${shell(bundleRoot)}/. %{buildroot}%{_libdir}/${pkg}/
11021
+ printf 'rpm\\n' > %{buildroot}%{_libdir}/${pkg}/Resources/app/.adea-linux-package
11022
+ cat > %{buildroot}%{_bindir}/${executable} <<'LAUNCHER'
11023
+ #!/bin/sh
11024
+ export ${formatEnvironment}=rpm
11025
+ exec %{_libdir}/${pkg}/${launcher} "$@"
11026
+ LAUNCHER
11027
+ chmod 0755 %{buildroot}%{_bindir}/${executable}
11028
+
11029
+ %files
11030
+ %{_libdir}/${pkg}
11031
+ %{_bindir}/${executable}
11032
+ `;
11033
+ const repoFile = `[${repoId}]
11034
+ name=${name} ${context.manifest.channel}
11035
+ baseurl=${repository}${context.manifest.channel}/$basearch/
11036
+ enabled=1
11037
+ gpgcheck=1
11038
+ repo_gpgcheck=1
11039
+ gpgkey=${keyUrl}
11040
+ `;
11041
+ return {
11042
+ status: "planned",
11043
+ catalogEligible: false,
11044
+ asset,
11045
+ files: [
11046
+ { path: `${pkg}.spec`, contents: spec },
11047
+ { path: `${repoId}.repo`, contents: repoFile },
11048
+ stageInput(context, asset)
11049
+ ],
11050
+ install: [
11051
+ `sudo curl -fsSLo /etc/yum.repos.d/${repoId}.repo ${shell(repository + repoId + ".repo")}`,
11052
+ `sudo dnf install ${pkg}`
11053
+ ].join(" && ")
11054
+ };
11055
+ }
11056
+ var yaml = (value) => JSON.stringify(value);
11057
+ var systemTalkDenied = /^(org\.freedesktop\.(Flatpak|DBus|systemd1)|org\.gtk\.GDBus)(\.|$)/;
11058
+ function flatpak(context, row) {
11059
+ keys2(row, "flatpak", [
11060
+ "applicationId",
11061
+ "artifact",
11062
+ "runtime",
11063
+ "runtimeVersion",
11064
+ "sdk",
11065
+ "bundleRoot",
11066
+ "launcher",
11067
+ "command",
11068
+ "formatEnvironment",
11069
+ "remote",
11070
+ "permissions"
11071
+ ]);
11072
+ const id = text3(row.applicationId, "Flatpak application id", reverseDns);
11073
+ const { asset, bundleRoot, launcher, formatEnvironment } = linuxPayload(context, row, "Flatpak");
11074
+ const runtime = text3(row.runtime, "Flatpak runtime", reverseDns);
11075
+ const sdk = text3(row.sdk, "Flatpak SDK", reverseDns);
11076
+ const runtimeVersion = text3(row.runtimeVersion, "Flatpak runtime version", /^[0-9][0-9.]*$/);
11077
+ const command = text3(row.command, "Flatpak command", /^[a-z0-9][a-z0-9._-]{0,63}$/);
11078
+ const remote = object(row.remote, "flatpak.remote");
11079
+ keys2(remote, "flatpak.remote", ["name", "url"]);
11080
+ const remoteName = text3(remote.name, "Flatpak remote name", /^[a-z0-9][a-z0-9_-]{0,63}$/);
11081
+ const remoteUrl = https(remote.url, "Flatpak remote URL", false).href;
11082
+ ensure(remoteUrl.endsWith(".flatpakrepo"), "Expected a .flatpakrepo remote URL");
11083
+ const permissions = object(row.permissions, "flatpak.permissions");
11084
+ keys2(permissions, "flatpak.permissions", ["network", "sockets", "devices", "sessionTalkNames"]);
11085
+ ensure(typeof permissions.network === "boolean", "Invalid Flatpak network permission");
11086
+ const list = (value, label, allowed) => {
11087
+ ensure(Array.isArray(value) && value.length <= 16, `Invalid Flatpak ${label}`);
11088
+ for (const entry of value)
11089
+ ensure(typeof entry === "string" && allowed(entry), `Unsafe Flatpak ${label}: ${String(entry)}`);
11090
+ ensure(new Set(value).size === value.length, `Duplicate Flatpak ${label}`);
11091
+ return value;
11092
+ };
11093
+ const sockets = list(permissions.sockets, "socket", (s) => s === "wayland" || s === "pulseaudio");
11094
+ const devices = list(permissions.devices, "device", (d) => d === "dri");
11095
+ const talk = list(permissions.sessionTalkNames, "session talk name", (n) => /^[A-Za-z_][\w-]*(\.[A-Za-z_][\w-]*)+$/.test(n) && !systemTalkDenied.test(n));
11096
+ const finishArgs = [
11097
+ ...permissions.network ? ["--share=network"] : [],
11098
+ "--share=ipc",
11099
+ ...sockets.map((s) => `--socket=${s}`),
11100
+ ...sockets.includes("wayland") ? ["--socket=fallback-x11"] : [],
11101
+ ...devices.map((d) => `--device=${d}`),
11102
+ ...talk.map((n) => `--talk-name=${n}`),
11103
+ `--env=${formatEnvironment}=flatpak`
11104
+ ];
11105
+ const manifest = `# Generated by @adea-ai/app-framework-release-tools from ${asset.name}.
11106
+ app-id: ${yaml(id)}
11107
+ runtime: ${yaml(runtime)}
11108
+ runtime-version: ${yaml(runtimeVersion)}
11109
+ sdk: ${yaml(sdk)}
11110
+ command: ${yaml(command)}
11111
+ finish-args:
11112
+ ${finishArgs.map((arg) => ` - ${yaml(arg)}`).join(`
11113
+ `)}
11114
+ modules:
11115
+ - name: ${yaml(id)}
11116
+ buildsystem: simple
11117
+ build-commands:
11118
+ - ${yaml(`mkdir -p /app/lib/${command} /app/bin`)}
11119
+ - ${yaml(`cp -a ${bundleRoot}/. /app/lib/${command}/`)}
11120
+ - ${yaml(`printf 'flatpak\\n' > /app/lib/${command}/Resources/app/.adea-linux-package`)}
11121
+ - ${yaml(`printf '#!/bin/sh\\nexport ${formatEnvironment}=flatpak\\nexec /app/lib/${command}/${launcher} "$@"\\n' > /app/bin/${command}`)}
11122
+ - ${yaml(`chmod 0755 /app/bin/${command}`)}
11123
+ sources:
11124
+ - type: archive
11125
+ url: ${yaml(asset.url)}
11126
+ sha256: ${yaml(asset.sha256)}
11127
+ strip-components: 0
11128
+ `;
11129
+ return {
11130
+ status: "planned",
11131
+ catalogEligible: false,
11132
+ asset,
11133
+ files: [
11134
+ { path: `${id}.yml`, contents: manifest },
11135
+ {
11136
+ path: `${id}.flatpakrepo.snippet`,
11137
+ contents: `[Flatpak Repo]
11138
+ Title=${context.common.name}
11139
+ Url=${new URL("./", remoteUrl).href}
11140
+ `
11141
+ }
11142
+ ],
11143
+ install: [
11144
+ `flatpak remote-add --user --if-not-exists ${remoteName} ${shell(remoteUrl)}`,
11145
+ `flatpak install --user ${remoteName} ${id}`
11146
+ ].join(" && ")
11147
+ };
11148
+ }
11149
+ var planners = { homebrew, winget, apt, pacman, rpm, flatpak };
11150
+ function parseCommon(policy) {
11151
+ keys2(policy, "policy", ["schema", "appId", "name", "description", "homepage", "license", "releaseBase", "channels"], ["downloads"]);
11152
+ ensure(policy.schema === "framework/package-channels/v1", "Unsupported package channel policy");
11153
+ return {
11154
+ appId: text3(policy.appId, "appId", /^(?=.{1,128}$)[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/),
11155
+ name: text3(policy.name, "product name"),
11156
+ description: text3(policy.description, "description"),
11157
+ homepage: https(policy.homepage, "homepage", true).href,
11158
+ license: text3(policy.license, "license", /^[A-Za-z0-9][A-Za-z0-9.+-]*( (AND|OR) [A-Za-z0-9][A-Za-z0-9.+-]*)*$/),
11159
+ releaseBase: https(policy.releaseBase, "release base", true)
11160
+ };
11161
+ }
11162
+ function downloads(context, value) {
11163
+ if (value === undefined)
11164
+ return [];
11165
+ ensure(Array.isArray(value) && value.length <= 32, "Invalid downloads");
11166
+ return value.map((entry) => {
11167
+ const row = object(entry, "download");
11168
+ keys2(row, "download", ["platform", "label", "artifact"]);
11169
+ const platform = text3(row.platform, "download platform", /^(macos|windows|linux)-(arm64|x64)$/);
11170
+ return {
11171
+ platform,
11172
+ label: text3(row.label, "download label"),
11173
+ ...exact2(context, row.artifact, "download", [
11174
+ ".dmg",
11175
+ "-Setup.exe",
11176
+ "-Setup.zip",
11177
+ ".deb",
11178
+ ".AppImage",
11179
+ ".rpm",
11180
+ "-Setup.tar.gz"
11181
+ ])
11182
+ };
11183
+ });
11184
+ }
11185
+ function planPackageChannels(input) {
11186
+ const policy = object(input.policy, "policy");
11187
+ const common = parseCommon(policy);
11188
+ const manifest = parsePackageChannelManifest(input.manifest);
11189
+ ensure(manifest.appId === null || manifest.appId === common.appId, "The manifest belongs to a different app");
11190
+ const configured = object(policy.channels, "policy.channels");
11191
+ keys2(configured, "policy.channels", [], packageChannelNames);
11192
+ const requested = input.channels ?? packageChannelNames.filter((n) => Object.hasOwn(configured, n));
11193
+ ensure(requested.length > 0, "No package channels requested");
11194
+ ensure(new Set(requested).size === requested.length, "Duplicate package channel");
11195
+ const context = { common, manifest, version: manifest.tag.slice(1) };
11196
+ const channels = {};
11197
+ for (const name of requested) {
11198
+ ensure(packageChannelNames.includes(name), `Unknown package channel ${String(name)}`);
11199
+ try {
11200
+ ensure(Object.hasOwn(configured, name), `The policy does not configure ${name}`);
11201
+ channels[name] = planners[name](context, object(configured[name], `policy.channels.${name}`));
11202
+ } catch (error) {
11203
+ channels[name] = { status: "failed", reason: error.message };
11204
+ }
11205
+ }
11206
+ return {
11207
+ schema: "framework/package-channel-plan/v1",
11208
+ appId: common.appId,
11209
+ tag: manifest.tag,
11210
+ version: context.version,
11211
+ channel: manifest.channel,
11212
+ sourceSha: manifest.sourceSha,
11213
+ downloads: downloads(context, policy.downloads),
11214
+ channels
11215
+ };
11216
+ }
10650
11217
  // src/framework-loader.ts
10651
11218
  var releaseTools = async () => exports_src;
10652
11219
 
@@ -10831,7 +11398,7 @@ var observeDailyNativeEffect = (options, run) => Effect26.gen(function* () {
10831
11398
  ...previous.kind === "private-from-verified-payload" ? [prior.payload] : []
10832
11399
  ] : undefined;
10833
11400
  const earlier = previous && baseline ? yield* snapshot(previous.directory, baseline, baselineFiles) : undefined;
10834
- const signing = requiresDailyInstallerSigning(matrix.profile, check) ? yield* attempt(() => installerSigningPolicy(config, check)) : undefined;
11401
+ const signing = requiresDailyInstallerSigning(matrix, check) ? yield* attempt(() => installerSigningPolicy(config, check)) : undefined;
10835
11402
  const observeSigning = () => Effect26.gen(function* () {
10836
11403
  if (!signing)
10837
11404
  return;
@@ -11044,7 +11611,7 @@ import { lstat as lstat23, mkdir as mkdir13, readFile as readFile14, readdir as
11044
11611
  import { basename as basename18, dirname as dirname16, join as join42 } from "path";
11045
11612
 
11046
11613
  // src/library/stable-catalogs.ts
11047
- function object(value) {
11614
+ function object2(value) {
11048
11615
  if (typeof value !== "object" || value === null || Array.isArray(value))
11049
11616
  throw new Error("Expected a JSON object");
11050
11617
  return value;
@@ -11063,20 +11630,20 @@ function requireHttps(value, label) {
11063
11630
  var sha = (value) => requireText(value, "SHA-256", /^[a-f0-9]{64}$/);
11064
11631
  var source = (value) => requireText(value, "source SHA", /^[a-f0-9]{40}$/);
11065
11632
  var file = (value) => requireText(value, "asset name", /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/);
11066
- var quoted = JSON.stringify;
11067
- var ruby = (value) => JSON.stringify(value).replace(/#(?=[{@$])/g, "\\#");
11633
+ var quoted2 = JSON.stringify;
11634
+ var ruby2 = (value) => JSON.stringify(value).replace(/#(?=[{@$])/g, "\\#");
11068
11635
  function asset(value) {
11069
- const row = object(value);
11636
+ const row = object2(value);
11070
11637
  const size = row.size;
11071
11638
  if (typeof size !== "number" || !Number.isSafeInteger(size) || size <= 0)
11072
11639
  throw new Error("Invalid asset size");
11073
11640
  return { name: file(row.name), size, sha256: sha(row.sha256) };
11074
11641
  }
11075
11642
  function select(value, name, tag, stable = false) {
11076
- const doc = object(value);
11643
+ const doc = object2(value);
11077
11644
  if (doc.tag !== tag || !Array.isArray(doc.assets) || stable && doc.channel !== "stable")
11078
11645
  throw new Error(stable ? "Expected matching Stable pointer" : "Expected exact asset manifest");
11079
- const matching = doc.assets.filter((row) => object(row).name === name);
11646
+ const matching = doc.assets.filter((row) => object2(row).name === name);
11080
11647
  if (matching.length !== 1)
11081
11648
  throw new Error("Expected exactly one matching installer asset");
11082
11649
  return asset(matching[0]);
@@ -11092,22 +11659,22 @@ function prepareStableCatalog(input) {
11092
11659
  const { channel, phase, measuredAsset } = input;
11093
11660
  if (channel !== "homebrew" && channel !== "winget" || phase !== "preflight" && phase !== "published-stable")
11094
11661
  throw new Error("Invalid catalog channel or release phase");
11095
- const config = object(input.config);
11662
+ const config = object2(input.config);
11096
11663
  const name = requireText(config.name, "product name");
11097
11664
  const desc = requireText(config.description, "description");
11098
11665
  const homepage = requireHttps(config.homepage, "homepage").href;
11099
11666
  const base = requireHttps(config.releaseBase, "release base");
11100
11667
  if (!base.pathname.endsWith("/"))
11101
11668
  throw new Error("Expected release base directory URL");
11102
- const channelConfig = object(config[channel]);
11669
+ const channelConfig = object2(config[channel]);
11103
11670
  if (channel === "homebrew" && channelConfig.artifacts !== undefined) {
11104
- const proofs = object(input.receipt);
11105
- const templates = object(channelConfig.artifacts);
11671
+ const proofs = object2(input.receipt);
11672
+ const templates = object2(channelConfig.artifacts);
11106
11673
  const targets = ["macos-arm64", "macos-x64"];
11107
11674
  if (proofs.schema !== "stable-homebrew-matrix/v1" || !Array.isArray(proofs.receipts) || proofs.receipts.length !== 2 || Object.keys(templates).length !== 2 || !targets.every((target) => Object.hasOwn(templates, target)) || input.measuredAsset !== undefined || input.measuredAssets?.length !== 2)
11108
11675
  throw new Error("Dual-architecture Homebrew requires exactly two native receipts and DMGs");
11109
11676
  const targetFiles = targets.map((target) => {
11110
- const matches = proofs.receipts.map(object).filter((row) => row.platform === target);
11677
+ const matches = proofs.receipts.map(object2).filter((row) => row.platform === target);
11111
11678
  if (matches.length !== 1)
11112
11679
  throw new Error("Expected one native proof per Homebrew architecture");
11113
11680
  const proof = matches[0];
@@ -11142,24 +11709,24 @@ function prepareStableCatalog(input) {
11142
11709
  return [
11143
11710
  {
11144
11711
  path: `Casks/${token}.rb`,
11145
- contents: `cask ${ruby(token)} do
11146
- version ${ruby(arm.tag.slice(1))}
11712
+ contents: `cask ${ruby2(token)} do
11713
+ version ${ruby2(arm.tag.slice(1))}
11147
11714
 
11148
11715
  on_arm do
11149
- sha256 ${ruby(arm.staged.sha256)}
11150
- url ${ruby(arm.url)}
11716
+ sha256 ${ruby2(arm.staged.sha256)}
11717
+ url ${ruby2(arm.url)}
11151
11718
  end
11152
11719
 
11153
11720
  on_intel do
11154
- sha256 ${ruby(intel.staged.sha256)}
11155
- url ${ruby(intel.url)}
11721
+ sha256 ${ruby2(intel.staged.sha256)}
11722
+ url ${ruby2(intel.url)}
11156
11723
  end
11157
11724
 
11158
- name ${ruby(name)}
11159
- desc ${ruby(desc)}
11160
- homepage ${ruby(homepage)}
11725
+ name ${ruby2(name)}
11726
+ desc ${ruby2(desc)}
11727
+ homepage ${ruby2(homepage)}
11161
11728
 
11162
- app ${ruby(bundle)}
11729
+ app ${ruby2(bundle)}
11163
11730
  end
11164
11731
  `
11165
11732
  }
@@ -11167,7 +11734,7 @@ end
11167
11734
  }
11168
11735
  if (input.measuredAssets !== undefined || measuredAsset === undefined)
11169
11736
  throw new Error("Expected one measured catalog installer");
11170
- const receipt = object(input.receipt);
11737
+ const receipt = object2(input.receipt);
11171
11738
  const tag = requireText(receipt.tag, "release tag", /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/);
11172
11739
  if (receipt.schema !== "stable-catalog.v1" || receipt.channel !== channel)
11173
11740
  throw new Error("Wrong qualification receipt");
@@ -11201,18 +11768,18 @@ end
11201
11768
  return [
11202
11769
  {
11203
11770
  path: `Casks/${token}.rb`,
11204
- contents: `cask ${ruby(token)} do
11205
- version ${ruby(version)}
11206
- sha256 ${ruby(staged.sha256)}
11771
+ contents: `cask ${ruby2(token)} do
11772
+ version ${ruby2(version)}
11773
+ sha256 ${ruby2(staged.sha256)}
11207
11774
 
11208
- url ${ruby(url)}
11209
- name ${ruby(name)}
11210
- desc ${ruby(desc)}
11211
- homepage ${ruby(homepage)}
11775
+ url ${ruby2(url)}
11776
+ name ${ruby2(name)}
11777
+ desc ${ruby2(desc)}
11778
+ homepage ${ruby2(homepage)}
11212
11779
 
11213
11780
  depends_on arch: :arm64
11214
11781
 
11215
- app ${ruby(bundle)}
11782
+ app ${ruby2(bundle)}
11216
11783
  end
11217
11784
  `
11218
11785
  }
@@ -11233,8 +11800,8 @@ end
11233
11800
  const schemaVersion = "1.12.0";
11234
11801
  const path = `manifests/${id[0].toLowerCase()}/${id.replaceAll(".", "/")}/${version}/${id}`;
11235
11802
  const manifest = (type, body) => `# yaml-language-server: $schema=https://aka.ms/winget-manifest.${type}.${schemaVersion}.schema.json
11236
- PackageIdentifier: ${quoted(id)}
11237
- PackageVersion: ${quoted(version)}
11803
+ PackageIdentifier: ${quoted2(id)}
11804
+ PackageVersion: ${quoted2(version)}
11238
11805
  ${body}ManifestType: ${type}
11239
11806
  ManifestVersion: ${schemaVersion}
11240
11807
  `;
@@ -11246,25 +11813,25 @@ ManifestVersion: ${schemaVersion}
11246
11813
  contents: manifest("installer", `${directExe ? "InstallerType: exe" : `InstallerType: zip
11247
11814
  NestedInstallerType: exe
11248
11815
  NestedInstallerFiles:
11249
- - RelativeFilePath: ${quoted(exe)}`}
11816
+ - RelativeFilePath: ${quoted2(exe)}`}
11250
11817
  InstallerSwitches:
11251
- Silent: ${quoted(silent)}
11252
- SilentWithProgress: ${quoted(progress)}
11818
+ Silent: ${quoted2(silent)}
11819
+ SilentWithProgress: ${quoted2(progress)}
11253
11820
  Installers:
11254
11821
  - Architecture: x64
11255
- InstallerUrl: ${quoted(url)}
11822
+ InstallerUrl: ${quoted2(url)}
11256
11823
  InstallerSha256: ${staged.sha256.toUpperCase()}
11257
11824
  `)
11258
11825
  },
11259
11826
  {
11260
11827
  path: `${path}.locale.en-US.yaml`,
11261
11828
  contents: manifest("defaultLocale", `PackageLocale: en-US
11262
- Publisher: ${quoted(publisher)}
11263
- PublisherUrl: ${quoted(homepage)}
11264
- PackageName: ${quoted(name)}
11265
- PackageUrl: ${quoted(homepage)}
11266
- License: ${quoted(license)}
11267
- ShortDescription: ${quoted(desc)}
11829
+ Publisher: ${quoted2(publisher)}
11830
+ PublisherUrl: ${quoted2(homepage)}
11831
+ PackageName: ${quoted2(name)}
11832
+ PackageUrl: ${quoted2(homepage)}
11833
+ License: ${quoted2(license)}
11834
+ ShortDescription: ${quoted2(desc)}
11268
11835
  `)
11269
11836
  }
11270
11837
  ];
@@ -11336,17 +11903,71 @@ async function prepareStableCatalogCommand(args) {
11336
11903
  }
11337
11904
  }
11338
11905
 
11906
+ // src/commands/package-channels.ts
11907
+ import { lstat as lstat24, mkdir as mkdir14, readFile as readFile15, rm as rm15, writeFile as writeFile16 } from "fs/promises";
11908
+ import { dirname as dirname17, isAbsolute as isAbsolute9, join as join43, normalize } from "path";
11909
+ var read3 = async (path) => {
11910
+ const stat = await lstat24(path);
11911
+ if (!stat.isFile() || stat.size > 4 * 1024 * 1024)
11912
+ throw new Error("Expected a bounded ordinary JSON file");
11913
+ return JSON.parse(await readFile15(path, "utf8"));
11914
+ };
11915
+ async function packageChannelsCommand(args) {
11916
+ const [policyPath, manifestPath, out, ...names] = args;
11917
+ if (!policyPath || !manifestPath || !out)
11918
+ throw new Error(`Expected policy, manifest, new output directory [${packageChannelNames.join("|")} ...]`);
11919
+ for (const name of names)
11920
+ if (!packageChannelNames.includes(name))
11921
+ throw new Error(`Unknown package channel ${name}`);
11922
+ const plan = planPackageChannels({
11923
+ policy: await read3(policyPath),
11924
+ manifest: await read3(manifestPath),
11925
+ ...names.length ? { channels: names } : {}
11926
+ });
11927
+ await mkdir14(out);
11928
+ try {
11929
+ const summary = {};
11930
+ for (const [name, result] of Object.entries(plan.channels)) {
11931
+ if (result.status === "failed") {
11932
+ summary[name] = result;
11933
+ continue;
11934
+ }
11935
+ for (const file of result.files) {
11936
+ const relative = normalize(file.path);
11937
+ if (isAbsolute9(relative) || relative.split(/[\\/]/).includes(".."))
11938
+ throw new Error("Refusing a channel file outside the output directory");
11939
+ const target = join43(out, name, relative);
11940
+ await mkdir14(dirname17(target), { recursive: true });
11941
+ await writeFile16(target, file.contents, { flag: "wx" });
11942
+ }
11943
+ summary[name] = { ...result, files: result.files.map((file) => file.path) };
11944
+ }
11945
+ await writeFile16(join43(out, "package-channels.json"), JSON.stringify({ ...plan, channels: summary }, null, 2) + `
11946
+ `, { flag: "wx" });
11947
+ } catch (error) {
11948
+ await rm15(out, { recursive: true, force: true });
11949
+ throw error;
11950
+ }
11951
+ const failed = Object.entries(plan.channels).filter(([, result]) => result.status === "failed").map(([name]) => name);
11952
+ return {
11953
+ tag: plan.tag,
11954
+ channel: plan.channel,
11955
+ planned: Object.keys(plan.channels).filter((name) => !failed.includes(name)),
11956
+ failed
11957
+ };
11958
+ }
11959
+
11339
11960
  // src/commands/build-linux-formats.ts
11340
- import { mkdtemp as mkdtemp14, rename as rename3, rm as rm15 } from "fs/promises";
11961
+ import { mkdtemp as mkdtemp14, rename as rename3, rm as rm16 } from "fs/promises";
11341
11962
  import { tmpdir as tmpdir7 } from "os";
11342
- import { basename as basename19, dirname as dirname17, isAbsolute as isAbsolute9, join as join43, resolve as resolve22 } from "path";
11963
+ import { basename as basename19, dirname as dirname18, isAbsolute as isAbsolute10, join as join44, resolve as resolve22 } from "path";
11343
11964
  import { Effect as Effect29 } from "effect";
11344
11965
 
11345
11966
  // src/library/verified-git-source.ts
11346
11967
  import { createHash as createHash28 } from "crypto";
11347
11968
  var id2 = /^[a-f0-9]{40}$/;
11348
11969
  var pathPart = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
11349
- async function object2(git, type, oid, max) {
11970
+ async function object3(git, type, oid, max) {
11350
11971
  if (!id2.test(oid))
11351
11972
  throw new Error("Invalid source object");
11352
11973
  const bytes = await git(["cat-file", type, oid]);
@@ -11355,7 +11976,7 @@ async function object2(git, type, oid, max) {
11355
11976
  return bytes;
11356
11977
  }
11357
11978
  async function verifiedSourceCommit(git, sha) {
11358
- const bytes = await object2(git, "commit", sha, 1024 * 1024);
11979
+ const bytes = await object3(git, "commit", sha, 1024 * 1024);
11359
11980
  const headers = bytes.toString("utf8").split(`
11360
11981
 
11361
11982
  `, 1)[0];
@@ -11371,7 +11992,7 @@ async function verifiedSourceFile(git, rootTree, path) {
11371
11992
  throw new Error("Invalid source metadata path");
11372
11993
  let tree = rootTree;
11373
11994
  for (let index = 0;index < parts.length; index++) {
11374
- const bytes = await object2(git, "tree", tree, 8 * 1024 * 1024);
11995
+ const bytes = await object3(git, "tree", tree, 8 * 1024 * 1024);
11375
11996
  let offset = 0;
11376
11997
  let found;
11377
11998
  while (offset < bytes.length) {
@@ -11393,7 +12014,7 @@ async function verifiedSourceFile(git, rootTree, path) {
11393
12014
  if (index === parts.length - 1) {
11394
12015
  if (found.mode !== "100644" && found.mode !== "100755")
11395
12016
  throw new Error("Source metadata must be a regular blob");
11396
- return object2(git, "blob", found.oid, 262144);
12017
+ return object3(git, "blob", found.oid, 262144);
11397
12018
  }
11398
12019
  if (found.mode !== "40000" && found.mode !== "040000")
11399
12020
  throw new Error("Invalid source metadata directory");
@@ -11405,10 +12026,10 @@ async function verifiedSourceFile(git, rootTree, path) {
11405
12026
  // src/commands/build-linux-formats.ts
11406
12027
  var sha2565 = /^[a-f0-9]{64}$/;
11407
12028
  var sourcePath = (path) => path.length <= 512 && path.split("/").every((part) => /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(part));
11408
- var exact2 = (value, required, optional = []) => required.every((key) => Object.hasOwn(value, key)) && Object.keys(value).every((key) => required.includes(key) || optional.includes(key));
12029
+ var exact3 = (value, required, optional = []) => required.every((key) => Object.hasOwn(value, key)) && Object.keys(value).every((key) => required.includes(key) || optional.includes(key));
11409
12030
  var strings2 = (value, max) => Array.isArray(value) && value.length <= max && value.every((item) => typeof item === "string" && item.length <= 512);
11410
12031
  function parseLinuxFormatBuildPolicy(value) {
11411
- if (!isRecord(value) || !exact2(value, ["schema", "renderer", "appimagetoolSha256", "runtimeSha256", "policy"]) || value.schema !== "linux-format-build-policy/v1" || value.renderer !== "native" && value.renderer !== "cef" || typeof value.appimagetoolSha256 !== "string" || !sha2565.test(value.appimagetoolSha256) || typeof value.runtimeSha256 !== "string" || !sha2565.test(value.runtimeSha256) || !isRecord(value.policy))
12032
+ if (!isRecord(value) || !exact3(value, ["schema", "renderer", "appimagetoolSha256", "runtimeSha256", "policy"]) || value.schema !== "linux-format-build-policy/v1" || value.renderer !== "native" && value.renderer !== "cef" || typeof value.appimagetoolSha256 !== "string" || !sha2565.test(value.appimagetoolSha256) || typeof value.runtimeSha256 !== "string" || !sha2565.test(value.runtimeSha256) || !isRecord(value.policy))
11412
12033
  throw new Error("Invalid Linux format build policy");
11413
12034
  const p = value.policy;
11414
12035
  const required = [
@@ -11441,10 +12062,10 @@ function parseLinuxFormatBuildPolicy(value) {
11441
12062
  "icon",
11442
12063
  "formatEnvironment"
11443
12064
  ];
11444
- if (!exact2(p, required, ["executable", "links"]) || textFields.some((key) => typeof p[key] !== "string" || p[key].length > 512 || [...p[key]].some((character) => {
12065
+ if (!exact3(p, required, ["executable", "links"]) || textFields.some((key) => typeof p[key] !== "string" || p[key].length > 512 || [...p[key]].some((character) => {
11445
12066
  const code = character.charCodeAt(0);
11446
12067
  return code < 32 || code === 127;
11447
- })) || p.executable !== undefined && (typeof p.executable !== "string" || p.executable.length > 64) || !strings2(p.dependencies, 128) || !strings2(p.categories, 32) || !strings2(p.mimeTypes, 32) || !Array.isArray(p.debSetuid) || p.debSetuid.length > 32 || p.debSetuid.some((pin) => !isRecord(pin) || !exact2(pin, ["path", "sha256"]) || typeof pin.path !== "string" || pin.path.length > 512 || typeof pin.sha256 !== "string" || !sha2565.test(pin.sha256)) || p.links !== undefined && (!Array.isArray(p.links) || p.links.length > 32 || p.links.some((link) => !isRecord(link) || !exact2(link, ["name", "target"]) || typeof link.name !== "string" || link.name.length > 64 || typeof link.target !== "string" || link.target.length > 512)))
12068
+ })) || p.executable !== undefined && (typeof p.executable !== "string" || p.executable.length > 64) || !strings2(p.dependencies, 128) || !strings2(p.categories, 32) || !strings2(p.mimeTypes, 32) || !Array.isArray(p.debSetuid) || p.debSetuid.length > 32 || p.debSetuid.some((pin) => !isRecord(pin) || !exact3(pin, ["path", "sha256"]) || typeof pin.path !== "string" || pin.path.length > 512 || typeof pin.sha256 !== "string" || !sha2565.test(pin.sha256)) || p.links !== undefined && (!Array.isArray(p.links) || p.links.length > 32 || p.links.some((link) => !isRecord(link) || !exact3(link, ["name", "target"]) || typeof link.name !== "string" || link.name.length > 64 || typeof link.target !== "string" || link.target.length > 512)))
11448
12069
  throw new Error("Invalid Linux format build policy");
11449
12070
  return {
11450
12071
  renderer: value.renderer,
@@ -11467,7 +12088,7 @@ var buildLinuxFormatsCommand = (args) => runCommand("Unable to build Linux forma
11467
12088
  output,
11468
12089
  ...extra
11469
12090
  ] = args;
11470
- if (extra.length || !sourceSha || !/^[a-f0-9]{40}$/.test(sourceSha) || !expectedRepository || !isRepositorySlug(expectedRepository) || !expectedRunId || !/^[1-9]\d{0,19}$/.test(expectedRunId) || !expectedAttempt || !/^[1-9]\d{0,8}$/.test(expectedAttempt) || expectedChannel !== "daily" && expectedChannel !== "stable" || !descriptorPath || !archive || !tool || !runtime || !output || ![descriptorPath, archive, tool, runtime, output].every(isAbsolute9))
12091
+ if (extra.length || !sourceSha || !/^[a-f0-9]{40}$/.test(sourceSha) || !expectedRepository || !isRepositorySlug(expectedRepository) || !expectedRunId || !/^[1-9]\d{0,19}$/.test(expectedRunId) || !expectedAttempt || !/^[1-9]\d{0,8}$/.test(expectedAttempt) || expectedChannel !== "daily" && expectedChannel !== "stable" || !descriptorPath || !archive || !tool || !runtime || !output || ![descriptorPath, archive, tool, runtime, output].every(isAbsolute10))
11471
12092
  return yield* fail("Expected trusted source, repository, run, attempt and channel, then descriptor, archive, tools and output");
11472
12093
  const { env, platform, arch, cwd } = yield* ReleaseConfig;
11473
12094
  if (platform !== "linux" || !isLinuxPackageArchitecture(arch) || env.CIRCLECI === "true" && env.CIRCLE_SHA1 !== sourceSha || env.GITLAB_CI === "true" && (env.CI_COMMIT_SHA !== sourceSha || env.CI_PIPELINE_ID !== expectedRunId) || env.GITHUB_ACTIONS === "true" && (env.GITHUB_SHA !== sourceSha || env.GITHUB_RUN_ID !== expectedRunId || env.GITHUB_RUN_ATTEMPT !== expectedAttempt))
@@ -11484,8 +12105,8 @@ var buildLinuxFormatsCommand = (args) => runCommand("Unable to build Linux forma
11484
12105
  const manifest = yield* sourceJson("linux-format-build.json");
11485
12106
  if (!isRecord(manifest) || typeof manifest.releaseConfig !== "string" || !sourcePath(manifest.releaseConfig) || manifest.releaseConfig === "linux-format-build.json")
11486
12107
  return yield* fail("Invalid source Linux format manifest");
11487
- const policies = manifest.schema === "linux-format-build-manifest/v2" && exact2(manifest, ["schema", "releaseConfig", "policies"]) && isRecord(manifest.policies) && exact2(manifest.policies, ["x64", "arm64"]) && manifest.policies.x64 !== manifest.policies.arm64 ? manifest.policies : undefined;
11488
- const policyPath = manifest.schema === "linux-format-build-manifest/v1" && exact2(manifest, ["schema", "releaseConfig", "policy"]) && arch === "x64" ? manifest.policy : policies?.[arch];
12108
+ const policies = manifest.schema === "linux-format-build-manifest/v2" && exact3(manifest, ["schema", "releaseConfig", "policies"]) && isRecord(manifest.policies) && exact3(manifest.policies, ["x64", "arm64"]) && manifest.policies.x64 !== manifest.policies.arm64 ? manifest.policies : undefined;
12109
+ const policyPath = manifest.schema === "linux-format-build-manifest/v1" && exact3(manifest, ["schema", "releaseConfig", "policy"]) && arch === "x64" ? manifest.policy : policies?.[arch];
11489
12110
  if (typeof policyPath !== "string" || !sourcePath(policyPath) || policyPath === manifest.releaseConfig || policyPath === "linux-format-build.json")
11490
12111
  return yield* fail("Invalid source Linux format manifest for the native architecture");
11491
12112
  const config = yield* sourceJson(manifest.releaseConfig);
@@ -11523,7 +12144,7 @@ var buildLinuxFormatsCommand = (args) => runCommand("Unable to build Linux forma
11523
12144
  const receipt = yield* Effect29.callback((resume, signal) => {
11524
12145
  const promise = (async () => {
11525
12146
  signal.throwIfAborted();
11526
- const scratch = await mkdtemp14(join43(tmpdir7(), "adea-linux-formats-"));
12147
+ const scratch = await mkdtemp14(join44(tmpdir7(), "adea-linux-formats-"));
11527
12148
  let scratchCleaned = false;
11528
12149
  try {
11529
12150
  signal.throwIfAborted();
@@ -11548,7 +12169,7 @@ var buildLinuxFormatsCommand = (args) => runCommand("Unable to build Linux forma
11548
12169
  arch,
11549
12170
  signal,
11550
12171
  afterWorkCleanup: async () => {
11551
- await rm15(scratch, { recursive: true, force: true });
12172
+ await rm16(scratch, { recursive: true, force: true });
11552
12173
  scratchCleaned = true;
11553
12174
  },
11554
12175
  inspectAppArchive: async () => {
@@ -11558,7 +12179,7 @@ var buildLinuxFormatsCommand = (args) => runCommand("Unable to build Linux forma
11558
12179
  const extracted = await extractVerifiedUpdate({
11559
12180
  descriptor: verified.descriptor,
11560
12181
  archive: copy,
11561
- directory: dirname17(destination),
12182
+ directory: dirname18(destination),
11562
12183
  platform: target.platform,
11563
12184
  renderer: metadata.renderer,
11564
12185
  appName: config.appName,
@@ -11567,16 +12188,16 @@ var buildLinuxFormatsCommand = (args) => runCommand("Unable to build Linux forma
11567
12188
  maxExpandedBytes: 8 * 1024 ** 3
11568
12189
  });
11569
12190
  try {
11570
- await rename3(extracted.payload, join43(destination, metadata.policy.bundleRoot));
12191
+ await rename3(extracted.payload, join44(destination, metadata.policy.bundleRoot));
11571
12192
  } finally {
11572
- await rm15(extracted.directory, { recursive: true, force: true });
12193
+ await rm16(extracted.directory, { recursive: true, force: true });
11573
12194
  }
11574
12195
  },
11575
12196
  run: async (name, toolArgs, options) => {
11576
12197
  if (name !== "dpkg-deb" && name !== "appimagetool")
11577
12198
  throw new Error("Unexpected Linux build tool");
11578
12199
  const executable = name === "dpkg-deb" ? "/usr/bin/dpkg-deb" : options?.executable;
11579
- if (!executable || !isAbsolute9(executable))
12200
+ if (!executable || !isAbsolute10(executable))
11580
12201
  throw new Error("Invalid Linux build tool");
11581
12202
  await linux.tool(executable, toolArgs, {
11582
12203
  PATH: "/usr/bin:/bin",
@@ -11589,7 +12210,7 @@ var buildLinuxFormatsCommand = (args) => runCommand("Unable to build Linux forma
11589
12210
  return result;
11590
12211
  } finally {
11591
12212
  if (!scratchCleaned)
11592
- await rm15(scratch, { recursive: true, force: true });
12213
+ await rm16(scratch, { recursive: true, force: true });
11593
12214
  }
11594
12215
  })();
11595
12216
  promise.then((value) => resume(Effect29.succeed(value)), (error) => resume(Effect29.fail(new ReleaseFailure({
@@ -11641,8 +12262,8 @@ var buildWindowsStandaloneCommand = (args) => runCommand("Unable to build the st
11641
12262
 
11642
12263
  // src/library/apt/stage-apt-repository.ts
11643
12264
  import { spawnSync as spawnSync3 } from "child_process";
11644
- import { lstat as lstat24, mkdir as mkdir14, readFile as readFile15, readdir as readdir16, rm as rm16, unlink as unlink4, writeFile as writeFile16 } from "fs/promises";
11645
- import { dirname as dirname18, isAbsolute as isAbsolute10, join as join44 } from "path";
12265
+ import { lstat as lstat25, mkdir as mkdir15, readFile as readFile16, readdir as readdir16, rm as rm17, unlink as unlink4, writeFile as writeFile17 } from "fs/promises";
12266
+ import { dirname as dirname19, isAbsolute as isAbsolute11, join as join45 } from "path";
11646
12267
  function cmd(program, options, label) {
11647
12268
  const run = spawnSync3(program, options, { encoding: "utf8", timeout: 60000 });
11648
12269
  if (run.error || run.status !== 0)
@@ -11650,14 +12271,14 @@ function cmd(program, options, label) {
11650
12271
  return run.stdout;
11651
12272
  }
11652
12273
  async function add(path, bytes) {
11653
- await mkdir14(dirname18(path), { recursive: true });
11654
- await writeFile16(path, bytes, { flag: "wx" });
12274
+ await mkdir15(dirname19(path), { recursive: true });
12275
+ await writeFile17(path, bytes, { flag: "wx" });
11655
12276
  }
11656
12277
  async function stageAptRepositoryCommand(args) {
11657
12278
  const [tag, policyPath, inventoryPath, packagePath, output, signingHome, trustedFingerprint] = args;
11658
- 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 || !isAbsolute10(signingHome) || !trustedFingerprint || !/^[A-F0-9]{40}$/.test(trustedFingerprint))
12279
+ 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 || !isAbsolute11(signingHome) || !trustedFingerprint || !/^[A-F0-9]{40}$/.test(trustedFingerprint))
11659
12280
  throw new Error("Expected TAG POLICY VERIFIED_INVENTORY DEB_OR_DIRECTORY NEW_OUTPUT GPG_HOME PINNED_FINGERPRINT");
11660
- const rawPolicy = JSON.parse(await readFile15(policyPath, "utf8"));
12281
+ const rawPolicy = JSON.parse(await readFile16(policyPath, "utf8"));
11661
12282
  if (typeof rawPolicy !== "object" || rawPolicy === null || Array.isArray(rawPolicy))
11662
12283
  throw new Error("Expected APT repository policy");
11663
12284
  const variant = rawPolicy;
@@ -11665,27 +12286,27 @@ async function stageAptRepositoryCommand(args) {
11665
12286
  const policies = multiarch ? variant.packages : [rawPolicy];
11666
12287
  if (!Array.isArray(policies) || policies.length !== (multiarch ? 2 : 1) || policies.some((policy) => !policy || typeof policy !== "object" || !/^[A-Za-z0-9][A-Za-z0-9_.+-]*\.deb$/.test(policy.assetName)))
11667
12288
  throw new Error("Invalid APT release package selection");
11668
- const inventory = JSON.parse(await readFile15(inventoryPath, "utf8"));
12289
+ const inventory = JSON.parse(await readFile16(inventoryPath, "utf8"));
11669
12290
  if (inventory.tag !== tag || !Array.isArray(inventory.assets))
11670
12291
  throw new Error("Verified inventory does not name requested release");
11671
12292
  if (multiarch) {
11672
- if (!(await lstat24(packagePath)).isDirectory())
12293
+ if (!(await lstat25(packagePath)).isDirectory())
11673
12294
  throw new Error("Multiarch APT requires one directory of two ordinary DEBs");
11674
12295
  const entries = await readdir16(packagePath, { withFileTypes: true });
11675
12296
  if (entries.length !== 2 || entries.some((entry) => !entry.isFile() || !policies.some((policy) => entry.name === policy.assetName)))
11676
12297
  throw new Error("Multiarch APT requires exactly the two selected ordinary DEBs");
11677
12298
  }
11678
- await mkdir14(output, { mode: 448 });
12299
+ await mkdir15(output, { mode: 448 });
11679
12300
  try {
11680
12301
  const now = new Date;
11681
12302
  const stagedInputs = [];
11682
12303
  for (const [index, policy] of policies.entries()) {
11683
- const input = multiarch ? join44(packagePath, policy.assetName) : packagePath;
11684
- if (!(await lstat24(input)).isFile())
12304
+ const input = multiarch ? join45(packagePath, policy.assetName) : packagePath;
12305
+ if (!(await lstat25(input)).isFile())
11685
12306
  throw new Error("Expected ordinary Debian package");
11686
- const deb = await readFile15(input);
11687
- const stagedInput = join44(output, `.input-${index}.deb`);
11688
- await writeFile16(stagedInput, deb, { mode: 384, flag: "wx" });
12307
+ const deb = await readFile16(input);
12308
+ const stagedInput = join45(output, `.input-${index}.deb`);
12309
+ await writeFile17(stagedInput, deb, { mode: 384, flag: "wx" });
11689
12310
  const control = cmd("dpkg-deb", ["--field", stagedInput], "Debian control inspection failed");
11690
12311
  stagedInputs.push({ policy, tag, assets: inventory.assets, deb, control, now, stagedInput });
11691
12312
  }
@@ -11694,12 +12315,12 @@ async function stageAptRepositoryCommand(args) {
11694
12315
  const { packagePath: stagedPackagePath, files, release } = stageAptMetadata(single);
11695
12316
  return { files, release, packages: [{ packagePath: stagedPackagePath, deb: single.deb }] };
11696
12317
  })();
11697
- const base = join44(output, "dists", single.policy.suite);
12318
+ const base = join45(output, "dists", single.policy.suite);
11698
12319
  for (const entry of staged.packages)
11699
- await add(join44(output, entry.packagePath), entry.deb);
12320
+ await add(join45(output, entry.packagePath), entry.deb);
11700
12321
  for (const [path, contents] of staged.files)
11701
- await add(join44(base, path), contents);
11702
- await add(join44(base, "Release"), staged.release);
12322
+ await add(join45(base, path), contents);
12323
+ await add(join45(base, "Release"), staged.release);
11703
12324
  const flags = [
11704
12325
  "--batch",
11705
12326
  "--no-tty",
@@ -11716,15 +12337,15 @@ async function stageAptRepositoryCommand(args) {
11716
12337
  ["InRelease", "--clearsign"],
11717
12338
  ["Release.gpg", "--detach-sign"]
11718
12339
  ]) {
11719
- cmd("gpg", [...flags, "--armor", "--output", join44(base, name), mode, join44(base, "Release")], `Could not produce ${name} with the pinned signing identity`);
12340
+ cmd("gpg", [...flags, "--armor", "--output", join45(base, name), mode, join45(base, "Release")], `Could not produce ${name} with the pinned signing identity`);
11720
12341
  }
11721
12342
  for (const { stagedInput } of stagedInputs)
11722
12343
  await unlink4(stagedInput);
11723
- await add(join44(output, "STAGED"), `${tag}
12344
+ await add(join45(output, "STAGED"), `${tag}
11724
12345
  `);
11725
12346
  return { tag, staged: true };
11726
12347
  } catch (error) {
11727
- await rm16(output, { recursive: true, force: true });
12348
+ await rm17(output, { recursive: true, force: true });
11728
12349
  throw error;
11729
12350
  }
11730
12351
  }
@@ -11732,7 +12353,7 @@ async function stageAptRepositoryCommand(args) {
11732
12353
  // src/library/release-retention-cli.ts
11733
12354
  import { constants as constants9 } from "fs";
11734
12355
  import { open as open16 } from "fs/promises";
11735
- import { isAbsolute as isAbsolute11 } from "path";
12356
+ import { isAbsolute as isAbsolute12 } from "path";
11736
12357
 
11737
12358
  // src/library/release-retention.ts
11738
12359
  import { createHash as createHash29 } from "crypto";
@@ -11907,7 +12528,7 @@ function assertRetirementPreflight(plan, fresh, approvedDigest) {
11907
12528
 
11908
12529
  // src/library/release-retention-cli.ts
11909
12530
  var document = async (path) => {
11910
- if (!path || !isAbsolute11(path))
12531
+ if (!path || !isAbsolute12(path))
11911
12532
  throw new Error("Expected an absolute evidence file path");
11912
12533
  const file = await open16(path, constants9.O_RDONLY | constants9.O_NOFOLLOW | constants9.O_NONBLOCK);
11913
12534
  try {
@@ -11940,9 +12561,9 @@ import { spawnSync as spawnSync4 } from "child_process";
11940
12561
  import { createHash as createHash30 } from "crypto";
11941
12562
  import { createReadStream as createReadStream4 } from "fs";
11942
12563
  import { constants as constants10, createWriteStream as createWriteStream2 } from "fs";
11943
- import { lstat as lstat25, mkdtemp as mkdtemp15, open as open17, readFile as readFile16, realpath as realpath13, rm as rm17 } from "fs/promises";
12564
+ import { lstat as lstat26, mkdtemp as mkdtemp15, open as open17, readFile as readFile17, realpath as realpath13, rm as rm18 } from "fs/promises";
11944
12565
  import { tmpdir as tmpdir8 } from "os";
11945
- import { basename as basename21, join as join45 } from "path";
12566
+ import { basename as basename21, join as join46 } from "path";
11946
12567
  import { pipeline as pipeline3 } from "stream/promises";
11947
12568
  import { pathToFileURL } from "url";
11948
12569
  function check4(ok, message) {
@@ -11950,7 +12571,7 @@ function check4(ok, message) {
11950
12571
  throw new Error(message);
11951
12572
  }
11952
12573
  async function hash3(path) {
11953
- check4((await lstat25(path)).isFile(), "artifact must be a regular file");
12574
+ check4((await lstat26(path)).isFile(), "artifact must be a regular file");
11954
12575
  const digest = createHash30("sha256");
11955
12576
  for await (const chunk of createReadStream4(path))
11956
12577
  digest.update(chunk);
@@ -11989,7 +12610,7 @@ async function verifyRpmStage(stage) {
11989
12610
  }
11990
12611
  const repo = await realpath13(stage.repository);
11991
12612
  const keyUrl = pathToFileURL(await realpath13(stage.publicKey)).href;
11992
- const config = options(await readFile16(stage.repoFile, "utf8"), stage.repoId);
12613
+ const config = options(await readFile17(stage.repoFile, "utf8"), stage.repoId);
11993
12614
  check4(config.get("baseurl") === pathToFileURL(repo).href, "expected the local repository");
11994
12615
  check4(config.get("gpgkey") === keyUrl, "expected the configured QA public key");
11995
12616
  for (const flag of ["pkg_gpgcheck", "repo_gpgcheck"]) {
@@ -11999,10 +12620,10 @@ async function verifyRpmStage(stage) {
11999
12620
  check4([...config.keys()].every((key) => allowed.has(key)), "unexpected repository options");
12000
12621
  for (const path of [
12001
12622
  stage.publicKey,
12002
- join45(repo, "repodata/repomd.xml"),
12003
- join45(repo, "repodata/repomd.xml.asc")
12623
+ join46(repo, "repodata/repomd.xml"),
12624
+ join46(repo, "repodata/repomd.xml.asc")
12004
12625
  ]) {
12005
- check4((await lstat25(path)).isFile(), "expected regular key and signed metadata files");
12626
+ check4((await lstat26(path)).isFile(), "expected regular key and signed metadata files");
12006
12627
  }
12007
12628
  const result = spawnSync4("rpm", ["-qp", "--queryformat", "%{NAME}|%{VERSION}|%{ARCH}", await realpath13(stage.rpm.path)], { encoding: "utf8", timeout: 1e4 });
12008
12629
  check4(result.error?.code !== "ENOENT", "rpm is required for RPM header verification");
@@ -12012,12 +12633,12 @@ async function verifyRpmStage(stage) {
12012
12633
  async function verifySignedRpmStage(stage, fingerprint) {
12013
12634
  check4(/^[A-F0-9]{40}$/.test(fingerprint), "expected an independently trusted full primary fingerprint");
12014
12635
  await verifyRpmStage(stage);
12015
- const root = await mkdtemp15(join45(tmpdir8(), "rpm-signature-proof-"));
12016
- const rpm = join45(root, "package.rpm");
12017
- const key = join45(root, "key.asc");
12018
- const metadata = join45(root, "repomd.xml");
12019
- const signature = join45(root, "repomd.xml.asc");
12020
- const originalMetadata = join45(stage.repository, "repodata/repomd.xml");
12636
+ const root = await mkdtemp15(join46(tmpdir8(), "rpm-signature-proof-"));
12637
+ const rpm = join46(root, "package.rpm");
12638
+ const key = join46(root, "key.asc");
12639
+ const metadata = join46(root, "repomd.xml");
12640
+ const signature = join46(root, "repomd.xml.asc");
12641
+ const originalMetadata = join46(stage.repository, "repodata/repomd.xml");
12021
12642
  const originalSignature = `${originalMetadata}.asc`;
12022
12643
  const snapshot = async (source, target, max) => {
12023
12644
  const file = await open17(source, constants10.O_RDONLY | constants10.O_NOFOLLOW);
@@ -12058,7 +12679,7 @@ async function verifySignedRpmStage(stage, fingerprint) {
12058
12679
  const signatures = verified.split(`
12059
12680
  `).filter((line) => line.startsWith("[GNUPG:] VALIDSIG "));
12060
12681
  check4(signatures.length === 1 && signatures[0].split(" ").at(-1) === fingerprint, "metadata signer does not match pinned primary fingerprint");
12061
- const db = join45(root, "rpmdb");
12682
+ const db = join46(root, "rpmdb");
12062
12683
  command("rpm", ["--dbpath", db, "--initdb"]);
12063
12684
  command("rpmkeys", ["--dbpath", db, "--import", key]);
12064
12685
  command("rpmkeys", ["--dbpath", db, "--define", "_pkgverify_level all", "--checksig", rpm]);
@@ -12086,10 +12707,10 @@ async function verifySignedRpmStage(stage, fingerprint) {
12086
12707
  signatureSha256
12087
12708
  };
12088
12709
  } finally {
12089
- await rm17(root, { recursive: true, force: true });
12710
+ await rm18(root, { recursive: true, force: true });
12090
12711
  }
12091
12712
  }
12092
- var systemTalkDenied = /^(org\.freedesktop\.(Flatpak|DBus|systemd1)|org\.gtk\.GDBus)(\.|$)/;
12713
+ var systemTalkDenied2 = /^(org\.freedesktop\.(Flatpak|DBus|systemd1)|org\.gtk\.GDBus)(\.|$)/;
12093
12714
  function verifyFlatpakCapabilities(policy, result) {
12094
12715
  check4(/^[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");
12095
12716
  check4(/^[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");
@@ -12098,7 +12719,7 @@ function verifyFlatpakCapabilities(policy, result) {
12098
12719
  const actual = result.effectivePermissions;
12099
12720
  check4(cap.sockets.every((name) => name === "wayland" || name === "pulseaudio"), "unsafe socket policy");
12100
12721
  check4(cap.devices.every((name) => name === "dri"), "unsafe device policy");
12101
- check4(cap.sessionTalkNames.every((name) => /^[A-Za-z_][\w-]*(\.[A-Za-z_][\w-]*)+$/.test(name) && !systemTalkDenied.test(name)), "unsafe session-bus policy");
12722
+ check4(cap.sessionTalkNames.every((name) => /^[A-Za-z_][\w-]*(\.[A-Za-z_][\w-]*)+$/.test(name) && !systemTalkDenied2.test(name)), "unsafe session-bus policy");
12102
12723
  check4(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");
12103
12724
  check4([
12104
12725
  result.localRepositoryInstall,
@@ -12117,13 +12738,13 @@ function verifyFlatpakCapabilities(policy, result) {
12117
12738
  import { spawnSync as spawnSync5 } from "child_process";
12118
12739
  import { createHash as createHash31 } from "crypto";
12119
12740
  import { constants as constants11 } from "fs";
12120
- import { lstat as lstat26, open as open18, realpath as realpath14 } from "fs/promises";
12121
- import { isAbsolute as isAbsolute12, join as join46, relative as relative7, resolve as resolve23 } from "path";
12741
+ import { lstat as lstat27, open as open18, realpath as realpath14 } from "fs/promises";
12742
+ import { isAbsolute as isAbsolute13, join as join47, relative as relative7, resolve as resolve23 } from "path";
12122
12743
  import { gunzipSync as gunzipSync2 } from "zlib";
12123
12744
  var maxCompressed = 16 * 1024 * 1024;
12124
12745
  var maxOpen = 32 * 1024 * 1024;
12125
12746
  var digest5 = (bytes) => createHash31("sha256").update(bytes).digest("hex");
12126
- function ensure(ok, reason) {
12747
+ function ensure2(ok, reason) {
12127
12748
  if (!ok)
12128
12749
  throw new Error(reason);
12129
12750
  }
@@ -12183,14 +12804,14 @@ function parseXml(kind, bytes, args = []) {
12183
12804
  maxBuffer: 64 * 1024,
12184
12805
  env: { PATH: "/usr/bin:/bin", LANG: "C" }
12185
12806
  });
12186
- ensure(result.status === 0, `Invalid ${kind} XML or package binding`);
12807
+ ensure2(result.status === 0, `Invalid ${kind} XML or package binding`);
12187
12808
  return JSON.parse(result.stdout);
12188
12809
  }
12189
12810
  async function readRegular(path, limit) {
12190
12811
  const file = await open18(path, constants11.O_RDONLY | constants11.O_NOFOLLOW);
12191
12812
  try {
12192
12813
  const stat = await file.stat();
12193
- ensure(stat.isFile() && stat.size > 0 && stat.size <= limit, "Invalid repository file");
12814
+ ensure2(stat.isFile() && stat.size > 0 && stat.size <= limit, "Invalid repository file");
12194
12815
  const bytes = Buffer.allocUnsafe(stat.size + 1);
12195
12816
  let total = 0;
12196
12817
  while (total < bytes.length) {
@@ -12199,7 +12820,7 @@ async function readRegular(path, limit) {
12199
12820
  break;
12200
12821
  total += bytesRead;
12201
12822
  }
12202
- ensure(total === stat.size, "Repository file changed while reading");
12823
+ ensure2(total === stat.size, "Repository file changed while reading");
12203
12824
  return bytes.subarray(0, total);
12204
12825
  } finally {
12205
12826
  await file.close();
@@ -12209,47 +12830,47 @@ async function digestRegular(path, expectedSize) {
12209
12830
  const file = await open18(path, constants11.O_RDONLY | constants11.O_NOFOLLOW);
12210
12831
  try {
12211
12832
  const stat = await file.stat();
12212
- ensure(stat.isFile() && stat.size === expectedSize && stat.size > 0 && stat.size <= 4 * 1024 * 1024 * 1024, "Invalid RPM file");
12833
+ ensure2(stat.isFile() && stat.size === expectedSize && stat.size > 0 && stat.size <= 4 * 1024 * 1024 * 1024, "Invalid RPM file");
12213
12834
  const hash = createHash31("sha256");
12214
12835
  let size = 0;
12215
12836
  for await (const chunk of file.createReadStream({ autoClose: false })) {
12216
12837
  size += chunk.length;
12217
- ensure(size <= expectedSize, "RPM changed while reading");
12838
+ ensure2(size <= expectedSize, "RPM changed while reading");
12218
12839
  hash.update(chunk);
12219
12840
  }
12220
- ensure(size === expectedSize, "RPM changed while reading");
12841
+ ensure2(size === expectedSize, "RPM changed while reading");
12221
12842
  return hash.digest("hex");
12222
12843
  } finally {
12223
12844
  await file.close();
12224
12845
  }
12225
12846
  }
12226
12847
  async function contained(repo, href) {
12227
- ensure(!isAbsolute12(href) && href.length <= 1024, "Invalid repository path");
12848
+ ensure2(!isAbsolute13(href) && href.length <= 1024, "Invalid repository path");
12228
12849
  const parts = href.split("/");
12229
- ensure(parts.every((part) => /^[A-Za-z0-9][A-Za-z0-9._+-]*$/.test(part)), "Invalid repository path");
12850
+ ensure2(parts.every((part) => /^[A-Za-z0-9][A-Za-z0-9._+-]*$/.test(part)), "Invalid repository path");
12230
12851
  let current = repo;
12231
12852
  for (let i = 0;i < parts.length; i++) {
12232
- current = join46(current, parts[i]);
12233
- const info = await lstat26(current);
12234
- ensure(i === parts.length - 1 ? info.isFile() : info.isDirectory(), "Unsafe repository path");
12853
+ current = join47(current, parts[i]);
12854
+ const info = await lstat27(current);
12855
+ ensure2(i === parts.length - 1 ? info.isFile() : info.isDirectory(), "Unsafe repository path");
12235
12856
  }
12236
- ensure(await realpath14(current) === current, "Repository path resolves outside its location");
12857
+ ensure2(await realpath14(current) === current, "Repository path resolves outside its location");
12237
12858
  return current;
12238
12859
  }
12239
12860
  async function verifyRpmRepository(stage, fingerprint) {
12240
12861
  const proof = await verifySignedRpmStage(stage, fingerprint);
12241
12862
  const repo = await realpath14(stage.repository);
12242
12863
  const metadata = await readRegular(await contained(repo, "repodata/repomd.xml"), 8 * 1024 * 1024);
12243
- ensure(digest5(metadata) === proof.metadataSha256, "Signed repomd changed");
12864
+ ensure2(digest5(metadata) === proof.metadataSha256, "Signed repomd changed");
12244
12865
  const record = parseXml("repomd", metadata);
12245
12866
  const href = record.href;
12246
12867
  const packedHash = record.checksum;
12247
12868
  const openHash = record.openChecksum;
12248
- ensure(typeof href === "string" && /^repodata\/[A-Za-z0-9][A-Za-z0-9._+-]*\.xml\.(?:gz|zst)$/.test(href), "Unsupported primary metadata location");
12249
- ensure(typeof packedHash === "string" && /^[a-f0-9]{64}$/.test(packedHash) && typeof openHash === "string" && /^[a-f0-9]{64}$/.test(openHash), "Invalid primary metadata checksum");
12250
- ensure(Number.isSafeInteger(record.size) && record.size > 0 && record.size <= maxCompressed && Number.isSafeInteger(record.openSize) && record.openSize > 0 && record.openSize <= maxOpen, "Primary metadata exceeds bounds");
12869
+ ensure2(typeof href === "string" && /^repodata\/[A-Za-z0-9][A-Za-z0-9._+-]*\.xml\.(?:gz|zst)$/.test(href), "Unsupported primary metadata location");
12870
+ ensure2(typeof packedHash === "string" && /^[a-f0-9]{64}$/.test(packedHash) && typeof openHash === "string" && /^[a-f0-9]{64}$/.test(openHash), "Invalid primary metadata checksum");
12871
+ ensure2(Number.isSafeInteger(record.size) && record.size > 0 && record.size <= maxCompressed && Number.isSafeInteger(record.openSize) && record.openSize > 0 && record.openSize <= maxOpen, "Primary metadata exceeds bounds");
12251
12872
  const packed = await readRegular(await contained(repo, href), maxCompressed);
12252
- ensure(packed.length === record.size && digest5(packed) === packedHash, "Primary metadata checksum mismatch");
12873
+ ensure2(packed.length === record.size && digest5(packed) === packedHash, "Primary metadata checksum mismatch");
12253
12874
  let plain;
12254
12875
  if (href.endsWith(".gz")) {
12255
12876
  try {
@@ -12264,16 +12885,16 @@ async function verifyRpmRepository(stage, fingerprint) {
12264
12885
  maxBuffer: maxOpen,
12265
12886
  env: { PATH: "/usr/bin:/bin", LANG: "C" }
12266
12887
  });
12267
- ensure(zstd.status === 0, "Cannot decompress zstd primary metadata within bounds");
12888
+ ensure2(zstd.status === 0, "Cannot decompress zstd primary metadata within bounds");
12268
12889
  plain = zstd.stdout;
12269
12890
  }
12270
- ensure(plain.length === record.openSize && digest5(plain) === openHash, "Uncompressed primary metadata checksum mismatch");
12891
+ ensure2(plain.length === record.openSize && digest5(plain) === openHash, "Uncompressed primary metadata checksum mismatch");
12271
12892
  const rpmPath = resolve23(stage.rpm.path);
12272
12893
  const rpmHref = relative7(repo, rpmPath);
12273
- ensure(!rpmHref.startsWith("../") && rpmHref !== "" && await contained(repo, rpmHref) === rpmPath, "RPM must be a regular file inside the local repository");
12274
- const rpmStat = await lstat26(rpmPath);
12894
+ ensure2(!rpmHref.startsWith("../") && rpmHref !== "" && await contained(repo, rpmHref) === rpmPath, "RPM must be a regular file inside the local repository");
12895
+ const rpmStat = await lstat27(rpmPath);
12275
12896
  parseXml("primary", plain, [...proof.rpmIdentity, rpmHref, proof.rpmSha256, String(rpmStat.size)]);
12276
- ensure(await digestRegular(rpmPath, rpmStat.size) === proof.rpmSha256, "RPM changed during repository verification");
12897
+ ensure2(await digestRegular(rpmPath, rpmStat.size) === proof.rpmSha256, "RPM changed during repository verification");
12277
12898
  return {
12278
12899
  ...proof,
12279
12900
  kind: "rpm-repository-proof",
@@ -12285,7 +12906,7 @@ async function verifyRpmRepository(stage, fingerprint) {
12285
12906
 
12286
12907
  // src/library/arch-publish.ts
12287
12908
  import { createHash as createHash32 } from "crypto";
12288
- import { join as join47 } from "path";
12909
+ import { join as join48 } from "path";
12289
12910
  import { tmpdir as tmpdir9 } from "os";
12290
12911
  import { Effect as Effect31 } from "effect";
12291
12912
 
@@ -12299,7 +12920,7 @@ function archBundle(appName) {
12299
12920
  assertPortableAppName(appName);
12300
12921
  return appName.replaceAll(" ", "");
12301
12922
  }
12302
- function shell(value) {
12923
+ function shell2(value) {
12303
12924
  if (/[\r\n]/.test(value))
12304
12925
  throw new Error("Arch package value spans lines");
12305
12926
  return `'${value.replaceAll("'", "'\\''")}'`;
@@ -12307,7 +12928,7 @@ function shell(value) {
12307
12928
  function array(name, values) {
12308
12929
  if (!values.length)
12309
12930
  return "";
12310
- const lines = values.map((value) => ` ${shell(value)}`).join(`
12931
+ const lines = values.map((value) => ` ${shell2(value)}`).join(`
12311
12932
  `);
12312
12933
  return `${name}=(
12313
12934
  ${lines}
@@ -12373,9 +12994,9 @@ function renderArchPackage(input) {
12373
12994
  `pkgname=${policy.pkgname}`,
12374
12995
  `pkgver=${pkgver}`,
12375
12996
  `pkgrel=${input.pkgrel}`,
12376
- `pkgdesc=${shell(policy.pkgdesc)}`,
12997
+ `pkgdesc=${shell2(policy.pkgdesc)}`,
12377
12998
  "arch=('x86_64')",
12378
- `url=${shell(policy.url)}`,
12999
+ `url=${shell2(policy.url)}`,
12379
13000
  array("license", policy.license),
12380
13001
  array("depends", policy.depends),
12381
13002
  array("optdepends", policy.optdepends),
@@ -12431,11 +13052,11 @@ function renderPacmanRepository(policy) {
12431
13052
  # sudo ADEA_PACMAN_TRUSTED_FINGERPRINT=<verified fingerprint> sh ./install.sh
12432
13053
  set -eu
12433
13054
 
12434
- repo=${shell(repository.name)}
12435
- package=${shell(policy.pkgname)}
12436
- server=${shell(repository.base)}
12437
- key_url=${shell(repository.publicKey)}
12438
- expected=${shell(repository.keyFingerprint)}
13055
+ repo=${shell2(repository.name)}
13056
+ package=${shell2(policy.pkgname)}
13057
+ server=${shell2(repository.base)}
13058
+ key_url=${shell2(repository.publicKey)}
13059
+ expected=${shell2(repository.keyFingerprint)}
12439
13060
 
12440
13061
  if [ "$(id -u)" -ne 0 ]; then
12441
13062
  echo "Run a trusted local copy as root with a verified repository fingerprint" >&2
@@ -12453,6 +13074,19 @@ if printf '%s\\n' "$repositories" | grep -Fxq -- "$repo"; then
12453
13074
  echo "Existing repository $repo requires manual migration before bootstrap" >&2
12454
13075
  exit 1
12455
13076
  fi
13077
+ # Keep explicit package names, but select them only from the newly verified repository.
13078
+ # The POSIX for list is captured before its body rotates the positional parameters.
13079
+ if [ "$#" -eq 0 ]; then set -- "$package"; fi
13080
+ for target do
13081
+ target=\${target#"$repo/"}
13082
+ case "$target" in
13083
+ ''|[!abcdefghijklmnopqrstuvwxyz0123456789]*|*[!abcdefghijklmnopqrstuvwxyz0123456789@+._-]*)
13084
+ echo "Pass only package names from the $repo repository" >&2
13085
+ exit 1 ;;
13086
+ esac
13087
+ shift
13088
+ set -- "$@" "$repo/$target"
13089
+ done
12456
13090
  tmp=$(mktemp)
12457
13091
  trap 'rm -f "$tmp"' EXIT
12458
13092
  curl -fsSL --proto '=https' --proto-redir '=https' "$key_url" -o "$tmp"
@@ -12469,9 +13103,8 @@ fingerprint=$(printf '%s\\n' "$key_records" | awk -F: '
12469
13103
  pacman-key --add "$tmp" >/dev/null
12470
13104
  pacman-key --lsign-key "$expected" >/dev/null
12471
13105
  printf '\\n[%s]\\nSigLevel = Required TrustedOnly\\nServer = %s$arch\\n' "$repo" "$server" >> /etc/pacman.conf
12472
- pacman -Sy --noconfirm >/dev/null
12473
- if [ "$#" -eq 0 ]; then set -- "$package"; fi
12474
- exec pacman -S --needed --noconfirm "$@"
13106
+ echo 'Pacman will refresh repositories and offer a full system upgrade before installing.'
13107
+ exec pacman -Syu --needed -- "$@"
12475
13108
  `;
12476
13109
  return { "install.sh": bootstrap, "pacman.conf": stanza };
12477
13110
  }
@@ -12629,7 +13262,7 @@ var publishArchPackageEffect = (options) => Effect31.gen(function* () {
12629
13262
  const directory = options.printDirectory;
12630
13263
  yield* step(() => fs.mkdir(directory, { recursive: true }));
12631
13264
  for (const [name, contents] of Object.entries({ ...files, ...repositoryFiles }))
12632
- yield* step(() => fs.writeFile(join47(directory, name), contents, { mode: 420 }));
13265
+ yield* step(() => fs.writeFile(join48(directory, name), contents, { mode: 420 }));
12633
13266
  }
12634
13267
  const base = { pkgname: policy.pkgname, pkgver: rendered.pkgver, pkgrel };
12635
13268
  if (options.dryRun)
@@ -12642,14 +13275,14 @@ var publishArchPackageEffect = (options) => Effect31.gen(function* () {
12642
13275
  if (!key.includes("PRIVATE KEY"))
12643
13276
  return yield* fail("AUR_SSH_PRIVATE_KEY_B64 is not a private key");
12644
13277
  return yield* Effect31.gen(function* () {
12645
- const work = yield* step(() => fs.mkdtemp(join47(tmpdir9(), "arch-package-")));
13278
+ const work = yield* step(() => fs.mkdtemp(join48(tmpdir9(), "arch-package-")));
12646
13279
  yield* Effect31.addFinalizer(() => Effect31.promise(() => fs.rm(work, { recursive: true, force: true }).then(() => {
12647
13280
  return;
12648
13281
  }, () => {
12649
13282
  return;
12650
13283
  })));
12651
- const keyFile = join47(work, "aur_id_ed25519");
12652
- const knownHosts = join47(work, "aur_known_hosts");
13284
+ const keyFile = join48(work, "aur_id_ed25519");
13285
+ const knownHosts = join48(work, "aur_known_hosts");
12653
13286
  yield* step(() => fs.mkdir(work, { recursive: true, mode: 448 }));
12654
13287
  yield* step(() => fs.writeFile(keyFile, key.endsWith(`
12655
13288
  `) ? key : `${key}
@@ -12657,7 +13290,7 @@ var publishArchPackageEffect = (options) => Effect31.gen(function* () {
12657
13290
  yield* step(() => fs.writeFile(knownHosts, `${AUR_HOST_KEY}
12658
13291
  `, { mode: 420 }));
12659
13292
  const ssh = `ssh -i "${keyFile}" -o IdentitiesOnly=yes -o UserKnownHostsFile="${knownHosts}" -o StrictHostKeyChecking=yes`;
12660
- const checkout = join47(work, policy.pkgname);
13293
+ const checkout = join48(work, policy.pkgname);
12661
13294
  yield* git2([
12662
13295
  "-c",
12663
13296
  `core.sshCommand=${ssh}`,
@@ -12670,7 +13303,7 @@ var publishArchPackageEffect = (options) => Effect31.gen(function* () {
12670
13303
  checkout
12671
13304
  ]);
12672
13305
  for (const [name, contents] of Object.entries(files))
12673
- yield* step(() => fs.writeFile(join47(checkout, name), contents, { mode: 420 }));
13306
+ yield* step(() => fs.writeFile(join48(checkout, name), contents, { mode: 420 }));
12674
13307
  yield* git2(["-C", checkout, "add", "--", ...Object.keys(files)]);
12675
13308
  const staged = yield* gitExit(["-C", checkout, "diff", "--cached", "--quiet"]);
12676
13309
  if (staged === 0)
@@ -13033,6 +13666,12 @@ var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; chec
13033
13666
  var prepareStableCatalog2 = (args) => runCommand((error) => `Unable to prepare Stable catalog: ${redactedErrorMessage(error)}`, Effect32.gen(function* () {
13034
13667
  yield* print(yield* step(() => prepareStableCatalogCommand(args)));
13035
13668
  }));
13669
+ var packageChannels = (args) => runCommand((error) => `Unable to plan package channels: ${redactedErrorMessage(error)}`, Effect32.gen(function* () {
13670
+ const result = yield* step(() => packageChannelsCommand(args));
13671
+ yield* print(result);
13672
+ if (result.failed.length)
13673
+ return yield* refuse("refused", `channels failed: ${result.failed.join(", ")}`);
13674
+ }));
13036
13675
  var stageAptRepository = (args) => runCommand((error) => `Unable to stage Apt repository: ${redactedErrorMessage(error)}`, Effect32.gen(function* () {
13037
13676
  yield* print(yield* step(() => stageAptRepositoryCommand(args)));
13038
13677
  }));
@@ -13074,6 +13713,7 @@ var commands = {
13074
13713
  "daily-matrix": dailyMatrix,
13075
13714
  finalize,
13076
13715
  "linux-channel-proof": linuxChannelProof,
13716
+ "package-channels": packageChannels,
13077
13717
  "plan-assets": planAssets,
13078
13718
  "prepare-stable-catalog": prepareStableCatalog2,
13079
13719
  "release-retention": releaseRetention,