提交记录修改.github/workflows/macos-build.yml+3 −1看文件
修改NOTICE+7 −0看文件
修改docs/releases/v0.1.7-rc.1.md+2 −0看文件
修改scripts/build-app.sh+2 −0看文件
修改scripts/guest-os/build-macos-sshfs.sh+8 −22看文件
新增scripts/guest-os/collect-macos-sshfs-sources.mjs+139 −0看文件
新增scripts/guest-os/macos-sshfs-dependencies.json+36 −0看文件
新增scripts/guest-os/macos-sshfs-source-README+61 −0看文件
修改scripts/guest-os/package-macos-guest.sh+6 −1看文件
新增scripts/guest-os/rebuild-macos-sshfs.sh+30 −0看文件
新增scripts/macos-sshfs-sources.test.mjs+61 −0看文件
修改scripts/package-macos.sh+9 −2看文件
修改scripts/prepare-release-assets.mjs+3 −1看文件
修改scripts/prepare-release-assets.test.mjs+12 −2看文件
修改scripts/release-control.test.mjs+1 −1看文件
修改www/scripts/sync-release.mjs+1 −0看文件
修改www/scripts/sync-release.test.mjs+1 −1看文件
| @@ -53,7 +53,9 @@ jobs: | ||
| 53 | 53 | cache-dependency-path: ui/package-lock.json |
| 54 | 54 | - uses: astral-sh/[email protected] |
| 55 | 55 | - name: Application version consistency |
| 56 | 删除: run: node scripts/check-version.mjs | |
| 56 | 新增: run: | | |
| 57 | 新增: node scripts/check-version.mjs | |
| 58 | 新增: node --test scripts/macos-sshfs-sources.test.mjs | |
| 57 | 59 | - name: Build the macOS application without release credentials |
| 58 | 60 | env: |
| 59 | 61 | CAGE_SIGNING_IDENTITY: '-' |
| @@ -7,6 +7,13 @@ noVNC (MPL-2.0, including the modifications in internal/cage/novnc-patch.py), | ||
| 7 | 7 | and the separately executed Mihomo core (GPL-3.0). |
| 8 | 8 | Their license texts and source notices are distributed in Contents/Resources/licenses. |
| 9 | 9 | Mihomo's corresponding source is distributed alongside the macOS release. |
| 10 | 新增:The macOS guest also includes Cage-modified SSHFS (GNU GPL version 2), with | |
| 11 | 新增:statically linked GLib and GNU gettext libintl (LGPL-2.1-or-later), and PCRE2 | |
| 12 | 新增:(BSD-3-Clause WITH PCRE2-exception, and SLJIT under BSD-2-Clause). Their license | |
| 13 | 新增:texts are in Contents/Resources/licenses/sshfs. | |
| 14 | 新增:Their complete corresponding source, patches, build recipes and static relink | |
| 15 | 新增:materials are in the cage-macos-guest-VERSION-source.tar.gz release asset, | |
| 16 | 新增:also retained in Contents/Resources/guest-os/sources inside the macOS App. | |
| 10 | 17 | The root MIT license does not replace these third-party license terms. |
| 11 | 18 | |
| 12 | 19 | agent-vm |
| @@ -54,3 +54,5 @@ | ||
| 54 | 54 | - 真实账号授权、特定主机权限、音频设备、显示缩放、第三方输入法以及手机网络环境仍可能有差异。自动化、构建及隔离网络测试不等于所有设备组合的实机验收。 |
| 55 | 55 | |
| 56 | 56 | 完整使用说明见 [Cage 使用文档](https://lee-xeo.github.io/Claude-Cage/docs/)。本版本公开安装包、校验清单与对应源码以本发行条目的附件为准。 |
| 57 | 新增: | |
| 58 | 新增:[查看相较 v0.1.6-alpha-preview 的完整提交对比](https://github.com/Lee-xeo/Claude-Cage/compare/v0.1.6-alpha-preview...v0.1.7-rc.1)。 | |
| @@ -60,6 +60,8 @@ cp _output/bin/cage "$bundle/Contents/Resources/cage" | ||
| 60 | 60 | if [[ "$(uname -m)" == arm64 ]]; then "$bundle/Contents/Resources/cage" verify-macos-guest; fi |
| 61 | 61 | if [[ "$(uname -m)" == arm64 ]]; then |
| 62 | 62 | bash scripts/guest-os/package-macos-guest.sh "$bundle/Contents/Resources/guest-os" |
| 63 | 新增: mkdir -p "$bundle/Contents/Resources/licenses/sshfs" | |
| 64 | 新增: cp -R "$bundle/Contents/Resources/guest-os/licenses/sshfs/." "$bundle/Contents/Resources/licenses/sshfs/" | |
| 63 | 65 | # The kit signs all nested native code before this outer App is sealed. |
| 64 | 66 | # Do not generate or reuse an unsigned component manifest here: installation |
| 65 | 67 | # hashes the final signed kit, including each nested bundle's CodeResources. |
| @@ -2,29 +2,15 @@ | ||
| 2 | 2 | # Build the FSKit-compatible SSHFS against the SDK from the signed macFUSE |
| 3 | 3 | # installer. Pass its extracted usr/local directory; no host driver is installed. |
| 4 | 4 | set -euo pipefail |
| 5 | 删除:[[ $# == 2 && $(uname -sm) == 'Darwin arm64' ]] || { echo 'Usage: build-macos-sshfs.sh /absolute/macfuse-sdk/usr/local /absolute/cage-sshfs' >&2; exit 2; } | |
| 5 | 新增:[[ ( $# == 2 || $# == 3 ) && $(uname -sm) == 'Darwin arm64' ]] || { echo 'Usage: build-macos-sshfs.sh /absolute/macfuse-sdk/usr/local /absolute/cage-sshfs [/absolute/source-materials]' >&2; exit 2; } | |
| 6 | 6 | sdk=$1 |
| 7 | 7 | output=$2 |
| 8 | 8 | script_dir=$(cd "$(dirname "$0")" && pwd) |
| 9 | 9 | [[ $sdk == /* && $output == /* && -f $sdk/include/fuse3/fuse.h && ! -e $output ]] |
| 10 | 删除:src=$(mktemp -d) | |
| 11 | 删除:trap 'rm -rf "$src"' EXIT | |
| 12 | 删除:commit=9b68e5f1b978c1d3c6ef7632b68d580a52ec0232 | |
| 13 | 删除:curl -fLsS --retry 2 "https://codeload.github.com/libfuse/sshfs/tar.gz/$commit" -o "$src/sshfs.tgz" | |
| 14 | 删除:cd "$src" | |
| 15 | 删除:echo '9be20256ac841c6e5b4cd8aefbf57c325f93e9ff01f7c7691edfe9f02700338b sshfs.tgz' | shasum -a 256 -c - >/dev/null | |
| 16 | 删除:tar xzf sshfs.tgz --strip-components 1 | |
| 17 | 删除:patch -p1 < "$script_dir/sshfs-openwith.patch" | |
| 18 | 删除:cat > config.h <<'HEADER' | |
| 19 | 删除:#define PACKAGE_VERSION "3.7.6" | |
| 20 | 删除:#define IDMAP_DEFAULT "user" | |
| 21 | 删除:HEADER | |
| 22 | 删除:glib=$(brew --prefix glib) | |
| 23 | 删除:intl=$(brew --prefix gettext) | |
| 24 | 删除:pcre=$(brew --prefix pcre2) | |
| 25 | 删除:clang -arch arm64 -O2 -D_REENTRANT -DHAVE_CONFIG_H -DFUSE_DARWIN_ENABLE_EXTENSIONS=0 -DFUSE_USE_VERSION=31 \ | |
| 26 | 删除: -I. -Icompat -I"$sdk/include/fuse3" -I"$glib/include/glib-2.0" -I"$glib/lib/glib-2.0/include" -I"$intl/include" \ | |
| 27 | 删除: sshfs.c cache.c compat/darwin_compat.c "$glib/lib/libgthread-2.0.a" "$glib/lib/libglib-2.0.a" "$intl/lib/libintl.a" "$pcre/lib/libpcre2-8.a" \ | |
| 28 | 删除: -L"$sdk/lib" -lfuse3 -liconv -framework Foundation -framework CoreFoundation -framework AppKit -framework Carbon -o cage-sshfs | |
| 29 | 删除:codesign -s - --force cage-sshfs | |
| 30 | 删除:install -m 755 cage-sshfs "$output" | |
| 10 | 新增:work=$(mktemp -d) | |
| 11 | 新增:trap 'rm -rf "$work"' EXIT | |
| 12 | 新增:materials=${3:-$work/source} | |
| 13 | 新增:node "$script_dir/collect-macos-sshfs-sources.mjs" prepare "$sdk" "$materials" | |
| 14 | 新增:bash "$script_dir/rebuild-macos-sshfs.sh" "$materials" "$sdk" "$work/cage-sshfs" | |
| 15 | 新增:codesign -s - --force "$work/cage-sshfs" | |
| 16 | 新增:install -m 755 "$work/cage-sshfs" "$output" | |
| @@ -0,0 +1,139 @@ | ||
| 1 | 新增:import { createHash } from 'node:crypto'; | |
| 2 | 新增:import { execFileSync } from 'node:child_process'; | |
| 3 | 新增:import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from 'node:fs'; | |
| 4 | 新增:import { tmpdir } from 'node:os'; | |
| 5 | 新增:import { basename, dirname, join, resolve } from 'node:path'; | |
| 6 | 新增:import { fileURLToPath, pathToFileURL } from 'node:url'; | |
| 7 | 新增: | |
| 8 | 新增:const here = dirname(fileURLToPath(import.meta.url)); | |
| 9 | 新增:const lock = JSON.parse(readFileSync(join(here, 'macos-sshfs-dependencies.json'))); | |
| 10 | 新增:const sha256 = file => createHash('sha256').update(readFileSync(file)).digest('hex'); | |
| 11 | 新增:const run = (command, args) => execFileSync(command, args, { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024 }); | |
| 12 | 新增:const saveJSON = (file, value) => writeFileSync(file, `${JSON.stringify(value, null, 2)}\n`); | |
| 13 | 新增:const copy = (source, dest) => { mkdirSync(dirname(dest), { recursive: true }); cpSync(source, dest, { recursive: true, dereference: true }); }; | |
| 14 | 新增: | |
| 15 | 新增:function files(root, relative = '') { | |
| 16 | 新增: return readdirSync(join(root, relative)).sort().flatMap(name => { | |
| 17 | 新增: const path = relative ? `${relative}/${name}` : name; | |
| 18 | 新增: return statSync(join(root, path)).isDirectory() ? files(root, path) : [path]; | |
| 19 | 新增: }); | |
| 20 | 新增:} | |
| 21 | 新增: | |
| 22 | 新增:export function inspectDependency(name, prefix) { | |
| 23 | 新增: const spec = lock[name]; | |
| 24 | 新增: const formula = join(prefix, '.brew', `${name}.rb`); | |
| 25 | 新增: const receipt = JSON.parse(readFileSync(join(prefix, 'INSTALL_RECEIPT.json'))); | |
| 26 | 新增: if (sha256(formula) !== spec.formulaSha256 || receipt.source?.spec !== 'stable' || receipt.source?.versions?.stable !== spec.version) { | |
| 27 | 新增: throw new Error(`${name}: installed formula/version differs from the reviewed SSHFS dependency lock; update the source lock before building.`); | |
| 28 | 新增: } | |
| 29 | 新增: // The raw receipt can contain personal paths. Keep only build identity fields. | |
| 30 | 新增: const selected = Object.fromEntries(['homebrew_version', 'compiler', 'arch', 'built_as_bottle', 'poured_from_bottle', 'built_on', 'used_options', 'runtime_dependencies'].map(key => [key, receipt[key]])); | |
| 31 | 新增: return { spec, formula, receipt: { ...selected, source: { spec: 'stable', version: spec.version, tap: receipt.source.tap, tap_git_head: receipt.source.tap_git_head } } }; | |
| 32 | 新增:} | |
| 33 | 新增: | |
| 34 | 新增:function download(url, expected, dest) { | |
| 35 | 新增: mkdirSync(dirname(dest), { recursive: true }); | |
| 36 | 新增: run('curl', ['--fail', '--location', '--silent', '--show-error', '--proto', '=https', '--proto-redir', '=https', '--retry', '2', '--connect-timeout', '20', '--max-time', '240', url, '-o', dest]); | |
| 37 | 新增: if (sha256(dest) !== expected) throw new Error(`Source checksum mismatch: ${basename(dest)}`); | |
| 38 | 新增:} | |
| 39 | 新增: | |
| 40 | 新增:export function extractLicenses(archive, output, component) { | |
| 41 | 新增: const selectors = { | |
| 42 | 新增: sshfs: [/^(COPYING|AUTHORS|LICENSE[^/]*)$/], | |
| 43 | 新增: glib: [/^COPYING$/, /^LICENSES\//], | |
| 44 | 新增: gettext: [/^COPYING$/, /^gettext-runtime\/(COPYING|intl\/(COPYING.LIB|AUTHORS))$/], | |
| 45 | 新增: pcre2: [/^COPYING$/, /^LICENCE(?:\.md)?$/, /^deps\/sljit\/LICENSE$/], | |
| 46 | 新增: }[component]; | |
| 47 | 新增: const names = run('tar', ['-tf', archive]).trim().split('\n'); | |
| 48 | 新增: const selected = names.filter(name => !name.endsWith('/') && selectors.some(match => match.test(name.replace(/^[^/]+\//, '')))); | |
| 49 | 新增: if (!selected.length) throw new Error(`No license material in ${basename(archive)}`); | |
| 50 | 新增: const temp = mkdtempSync(join(tmpdir(), 'cage-sshfs-licenses-')); | |
| 51 | 新增: try { | |
| 52 | 新增: // GLib's COPYING is a symlink to LICENSES/. Extract together and read its | |
| 53 | 新增: // target instead of publishing the empty output of tar -xOf on a symlink. | |
| 54 | 新增: run('tar', ['-xf', archive, '-C', temp, ...selected]); | |
| 55 | 新增: for (const name of selected) { | |
| 56 | 新增: const relative = name.replace(/^[^/]+\//, ''); | |
| 57 | 新增: const dest = join(output, relative); | |
| 58 | 新增: mkdirSync(dirname(dest), { recursive: true }); | |
| 59 | 新增: writeFileSync(dest, readFileSync(join(temp, name))); | |
| 60 | 新增: } | |
| 61 | 新增: } finally { rmSync(temp, { recursive: true, force: true }); } | |
| 62 | 新增:} | |
| 63 | 新增: | |
| 64 | 新增:export function prepare(sdk, output) { | |
| 65 | 新增: if (existsSync(output)) throw new Error('Source materials destination already exists.'); | |
| 66 | 新增: // Resolve and verify all installed recipes before downloading or compiling. | |
| 67 | 新增: const installed = Object.fromEntries(['glib', 'gettext', 'pcre2'].map(name => { | |
| 68 | 新增: const prefix = realpathSync(run('brew', ['--prefix', name]).trim()); | |
| 69 | 新增: return [name, { prefix, ...inspectDependency(name, prefix) }]; | |
| 70 | 新增: })); | |
| 71 | 新增: mkdirSync(output, { recursive: true }); | |
| 72 | 新增: copy(join(here, 'rebuild-macos-sshfs.sh'), join(output, 'rebuild-macos-sshfs.sh')); | |
| 73 | 新增: copy(join(here, '../../LICENSE'), join(output, 'cage/LICENSE')); | |
| 74 | 新增: for (const file of ['sshfs-openwith.patch', 'macos-fuse-media.sh', 'macos-sshfs-dependencies.json']) copy(join(here, file), join(output, 'cage', file)); | |
| 75 | 新增: copy(join(here, 'macos-sshfs-source-README'), join(output, 'README')); | |
| 76 | 新增: download(lock.sshfs.url, lock.sshfs.sha256, join(output, 'upstream/sshfs.tar.gz')); | |
| 77 | 新增: extractLicenses(join(output, 'upstream/sshfs.tar.gz'), join(output, 'licenses/sshfs'), 'sshfs'); | |
| 78 | 新增: const archives = { glib: 'glib.tar.xz', gettext: 'gettext.tar.gz', pcre2: 'pcre2.tar.bz2' }; | |
| 79 | 新增: const inputs = { glib: ['lib/libgthread-2.0.a', 'lib/libglib-2.0.a', 'include/glib-2.0', 'lib/glib-2.0/include'], gettext: ['lib/libintl.a', 'include/libintl.h'], pcre2: ['lib/libpcre2-8.a', 'include/pcre2.h', 'include/pcre2posix.h'] }; | |
| 80 | 新增: for (const [name, { prefix, spec, formula, receipt }] of Object.entries(installed)) { | |
| 81 | 新增: copy(formula, join(output, 'homebrew', `${name}.rb`)); | |
| 82 | 新增: saveJSON(join(output, 'homebrew', `${name}-receipt.json`), receipt); | |
| 83 | 新增: const archive = join(output, 'upstream', archives[name]); | |
| 84 | 新增: download(spec.url, spec.sha256, archive); | |
| 85 | 新增: extractLicenses(archive, join(output, 'licenses', name), name); | |
| 86 | 新增: for (const resource of spec.resources ?? []) download(resource.url, resource.sha256, join(output, 'upstream', `${resource.name}.tar.xz`)); | |
| 87 | 新增: for (const patch of spec.patches ?? []) download(patch.url, patch.sha256, join(output, 'homebrew', patch.file)); | |
| 88 | 新增: for (const file of inputs[name]) { | |
| 89 | 新增: const target = join(output, 'dependencies', name, file); | |
| 90 | 新增: copy(join(prefix, file), target); | |
| 91 | 新增: // Detect an in-place package update during the snapshot. Compilation uses | |
| 92 | 新增: // the frozen copy, never /opt/homebrew/opt symlinks that can change later. | |
| 93 | 新增: for (const path of statSync(target).isDirectory() ? files(target) : ['']) { | |
| 94 | 新增: if (sha256(join(target, path)) !== sha256(join(prefix, file, path))) throw new Error(`${name}: dependency changed while collecting sources.`); | |
| 95 | 新增: } | |
| 96 | 新增: } | |
| 97 | 新增: } | |
| 98 | 新增: download('https://raw.githubusercontent.com/Homebrew/homebrew-core/68093a0680c21eb19fb034af0d8c5104848315e7/LICENSE.txt', 'f80329e58613ad669c0e73cb132d8060b9b2c55e339c73848068e4d1567f4627', join(output, 'licenses/homebrew/LICENSE.txt')); | |
| 99 | 新增: const sdkFiles = [...files(join(sdk, 'include')).map(path => `include/${path}`), 'lib/libfuse3.dylib']; | |
| 100 | 新增: saveJSON(join(output, 'build.json'), { | |
| 101 | 新增: cageVersion: readFileSync(join(here, '../../VERSION'), 'utf8').trim(), | |
| 102 | 新增: dependencies: lock, | |
| 103 | 新增: toolchain: { clang: run('clang', ['--version']).split('\n')[0], sdk: run('xcrun', ['--show-sdk-version']).trim(), deploymentTarget: process.env.MACOSX_DEPLOYMENT_TARGET ?? '14.0' }, | |
| 104 | 新增: macfuse: { version: '5.5.0', url: 'https://github.com/macfuse/macfuse/releases/download/macfuse-5.5.0/macfuse-5.5.0.dmg', sha256: '92c21ef2db4199bcf5bddc8e6efb57b23ecb9715f74ab38cba2c77ab226d3830', files: sdkFiles.map(path => ({ path, sha256: sha256(join(sdk, path)) })) }, | |
| 105 | 新增: }); | |
| 106 | 新增: writeFileSync(join(output, 'NOTICE'), `Cage macOS SSHFS corresponding source and relink materials\n\nSSHFS ${lock.sshfs.version} (${lock.sshfs.commit}): GNU GPL version 2 (see licenses/sshfs/COPYING).\nCage changes: cage/sshfs-openwith.patch (guest-local file-opening metadata).\nStatically linked GLib ${lock.glib.version} and GNU gettext libintl ${lock.gettext.version}: LGPL-2.1-or-later.\nPCRE2 ${lock.pcre2.version}: BSD-3-Clause WITH PCRE2-exception; bundled SLJIT: BSD-2-Clause.\nUpstream copyright and license notices are retained in licenses/ and the complete upstream archives.\nHomebrew recipes are under the BSD 2-Clause license in licenses/homebrew/LICENSE.txt.\nThe source archive includes the exact static libraries and headers used by the build.\nThe external macFUSE runtime is installed separately; its pinned SDK acquisition instructions are in README.\nThe final signed executable hash and every distributed source/relink input hash are in manifest.json.\n`); | |
| 107 | 新增:} | |
| 108 | 新增: | |
| 109 | 新增:export function finish(materials, binary, archive, licenses) { | |
| 110 | 新增: const build = JSON.parse(readFileSync(join(materials, 'build.json'))); | |
| 111 | 新增: const manifest = { format: 1, cageVersion: build.cageVersion, executable: { path: 'project/cage-sshfs', sha256: sha256(binary) }, files: files(materials).filter(path => path !== 'manifest.json').map(path => ({ path, sha256: sha256(join(materials, path)) })) }; | |
| 112 | 新增: saveJSON(join(materials, 'manifest.json'), manifest); | |
| 113 | 新增: copy(join(materials, 'licenses'), licenses); | |
| 114 | 新增: copy(join(materials, 'NOTICE'), join(licenses, 'NOTICE')); | |
| 115 | 新增: copy(join(materials, 'build.json'), join(licenses, 'build.json')); | |
| 116 | 新增: mkdirSync(dirname(archive), { recursive: true }); | |
| 117 | 新增: run('tar', ['-czf', archive, '-C', materials, '.']); | |
| 118 | 新增: verifyArchive(archive, binary, build.cageVersion); | |
| 119 | 新增:} | |
| 120 | 新增: | |
| 121 | 新增:export function verifyArchive(archive, binary, version) { | |
| 122 | 新增: const temp = mkdtempSync(join(tmpdir(), 'cage-sshfs-source-verify-')); | |
| 123 | 新增: try { | |
| 124 | 新增: run('tar', ['-xzf', archive, '-C', temp]); | |
| 125 | 新增: const manifest = JSON.parse(readFileSync(join(temp, 'manifest.json'))); | |
| 126 | 新增: if (manifest.format !== 1 || manifest.cageVersion !== version || manifest.executable?.sha256 !== sha256(binary)) throw new Error('macOS guest source does not match this signed executable/version.'); | |
| 127 | 新增: for (const item of manifest.files) { | |
| 128 | 新增: if (!item.path.split('/').every(part => part && part !== '.' && part !== '..') || item.path.startsWith('/') || sha256(join(temp, item.path)) !== item.sha256) throw new Error(`macOS guest source integrity check failed: ${item.path}`); | |
| 129 | 新增: } | |
| 130 | 新增: } finally { rmSync(temp, { recursive: true, force: true }); } | |
| 131 | 新增:} | |
| 132 | 新增: | |
| 133 | 新增:if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) { | |
| 134 | 新增: const [action, ...args] = process.argv.slice(2); | |
| 135 | 新增: if (action === 'prepare' && args.length === 2) prepare(...args); | |
| 136 | 新增: else if (action === 'finish' && args.length === 4) finish(...args); | |
| 137 | 新增: else if (action === 'verify' && args.length === 3) verifyArchive(...args); | |
| 138 | 新增: else throw new Error('Usage: collect-macos-sshfs-sources.mjs prepare SDK DIRECTORY | finish DIRECTORY BINARY ARCHIVE LICENSES | verify ARCHIVE BINARY VERSION'); | |
| 139 | 新增:} | |
| @@ -0,0 +1,36 @@ | ||
| 1 | 新增:{ | |
| 2 | 新增: "sshfs": { | |
| 3 | 新增: "version": "3.7.6", | |
| 4 | 新增: "commit": "9b68e5f1b978c1d3c6ef7632b68d580a52ec0232", | |
| 5 | 新增: "url": "https://codeload.github.com/libfuse/sshfs/tar.gz/9b68e5f1b978c1d3c6ef7632b68d580a52ec0232", | |
| 6 | 新增: "sha256": "9be20256ac841c6e5b4cd8aefbf57c325f93e9ff01f7c7691edfe9f02700338b" | |
| 7 | 新增: }, | |
| 8 | 新增: "glib": { | |
| 9 | 新增: "version": "2.90.1", | |
| 10 | 新增: "formulaSha256": "7352a67a6a1a15554d996d38886812e858bebbbcbf3985901724cab444ee3b3b", | |
| 11 | 新增: "url": "https://download.gnome.org/sources/glib/2.90/glib-2.90.1.tar.xz", | |
| 12 | 新增: "sha256": "93c941aa17d5eb1d53fe838365f29a8b4e539c222a256d974ec8f30fc413e396", | |
| 13 | 新增: "resources": [{ | |
| 14 | 新增: "name": "gobject-introspection", | |
| 15 | 新增: "url": "https://download.gnome.org/sources/gobject-introspection/1.86/gobject-introspection-1.86.0.tar.xz", | |
| 16 | 新增: "sha256": "920d1a3fcedeadc32acff95c2e203b319039dd4b4a08dd1a2dfd283d19c0b9ae" | |
| 17 | 新增: }], | |
| 18 | 新增: "patches": [{ | |
| 19 | 新增: "file": "Patches/glib/hardcoded-paths.diff", | |
| 20 | 新增: "url": "https://raw.githubusercontent.com/Homebrew/homebrew-core/68093a0680c21eb19fb034af0d8c5104848315e7/Patches/glib/hardcoded-paths.diff", | |
| 21 | 新增: "sha256": "d846efd0bf62918350da94f850db33b0f8727fece9bfaf8164566e3094e80c97" | |
| 22 | 新增: }] | |
| 23 | 新增: }, | |
| 24 | 新增: "gettext": { | |
| 25 | 新增: "version": "1.0", | |
| 26 | 新增: "formulaSha256": "dd8d1b5914bb96c9c59140dd8cf76ad1d270f65a88111a395f79fe22106367c6", | |
| 27 | 新增: "url": "https://ftp.gnu.org/gnu/gettext/gettext-1.0.tar.gz", | |
| 28 | 新增: "sha256": "85d99b79c981a404874c02e0342176cf75c7698e2b51fe41031cf6526d974f1a" | |
| 29 | 新增: }, | |
| 30 | 新增: "pcre2": { | |
| 31 | 新增: "version": "10.49", | |
| 32 | 新增: "formulaSha256": "94c19a0d869da4990a8f3f371e37c986ad72124d2d94032e061c4a9019f9e174", | |
| 33 | 新增: "url": "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.49/pcre2-10.49.tar.bz2", | |
| 34 | 新增: "sha256": "53c156e1ba416a20da8e65395daa132da0d80e76910424caca3fcdae7831d384" | |
| 35 | 新增: } | |
| 36 | 新增:} | |
| @@ -0,0 +1,61 @@ | ||
| 1 | 新增:Cage macOS guest: SSHFS source and relink materials | |
| 2 | 新增: | |
| 3 | 新增:This distribution contains the complete SSHFS, GLib, GNU gettext and PCRE2 | |
| 4 | 新增:upstream source archives, the Cage SSHFS patch, installed Homebrew recipes and | |
| 5 | 新增:their external patch/resource, and the exact static libraries and headers used | |
| 6 | 新增:to link Cage's SSHFS helper. build.json records source URLs, SHA256 digests, | |
| 7 | 新增:versions and the build toolchain. manifest.json binds all these files to the | |
| 8 | 新增:final signed project/cage-sshfs executable. Receipts retain build identity | |
| 9 | 新增:without the developer's personal filesystem paths. | |
| 10 | 新增: | |
| 11 | 新增:Rebuild or modify SSHFS on an Apple Silicon Mac with Xcode command-line tools: | |
| 12 | 新增: | |
| 13 | 新增:1. Obtain the external macFUSE 5.5.0 SDK from its official installer. It is not | |
| 14 | 新增: installed by these commands. The pinned image and package hashes are checked | |
| 15 | 新增: by the included extraction script. Set SOURCE to this extracted directory, | |
| 16 | 新增: and WORK to a new, empty absolute directory: | |
| 17 | 新增: | |
| 18 | 新增: mkdir -p "$WORK" | |
| 19 | 新增: curl -fL https://github.com/macfuse/macfuse/releases/download/macfuse-5.5.0/macfuse-5.5.0.dmg -o "$WORK/macfuse.dmg" | |
| 20 | 新增: bash "$SOURCE/cage/macos-fuse-media.sh" "$WORK/macfuse.dmg" "$WORK/fuse.pkg" | |
| 21 | 新增: pkgutil --expand-full "$WORK/fuse.pkg" "$WORK/sdk" | |
| 22 | 新增: | |
| 23 | 新增:2. Relink using the frozen static libraries and headers: | |
| 24 | 新增: | |
| 25 | 新增: bash "$SOURCE/rebuild-macos-sshfs.sh" "$SOURCE" "$WORK/sdk/Core.pkg/Payload/usr/local" "$WORK/cage-sshfs" | |
| 26 | 新增: codesign --force --sign - "$WORK/cage-sshfs" | |
| 27 | 新增: | |
| 28 | 新增: No Homebrew installation or network access is needed for this compile step. | |
| 29 | 新增: To modify SSHFS, first extract upstream/sshfs.tar.gz, apply | |
| 30 | 新增: cage/sshfs-openwith.patch with patch -p1, edit the files, then pass that source | |
| 31 | 新增: directory as the fourth argument to rebuild-macos-sshfs.sh. | |
| 32 | 新增: | |
| 33 | 新增:The helper dynamically loads the separately installed macFUSE runtime. macFUSE | |
| 34 | 新增:must be available on the machine where it runs. Xcode, the macOS SDK and macFUSE | |
| 35 | 新增:are external system/build prerequisites; they are not redistributed here. | |
| 36 | 新增:Rebuilding with another compiler or replacing the Developer ID signature will | |
| 37 | 新增:change the executable hash. The manifest describes the shipped executable. | |
| 38 | 新增: | |
| 39 | 新增:To rebuild the static dependencies, the complete upstream archives are in | |
| 40 | 新增:upstream/. The exact Homebrew install methods, configure/Meson flags, inline | |
| 41 | 新增:source changes, and versions used for the installed bottles are preserved in | |
| 42 | 新增:homebrew/{glib,gettext,pcre2}.rb. GLib's separate introspection resource and | |
| 43 | 新增:hardcoded-paths patch are also included. With Homebrew and its recipe build | |
| 44 | 新增:tools, copy these recipes to a local tap (Formula/ and Patches/ retain their | |
| 45 | 新增:relative paths) and run: | |
| 46 | 新增: | |
| 47 | 新增: brew install --build-from-source your/local/pcre2 | |
| 48 | 新增: brew install --build-from-source your/local/gettext | |
| 49 | 新增: brew install --build-from-source your/local/glib | |
| 50 | 新增: | |
| 51 | 新增:The formula install methods list their build prerequisites. As with ordinary | |
| 52 | 新增:Homebrew builds, these general-purpose tools and the other formula runtime | |
| 53 | 新增:dependencies can be installed separately. The source archives and required | |
| 54 | 新增:GLib patch/resource are frozen here; configure local source URLs if building | |
| 55 | 新增:without network access. Replace dependencies/* with your rebuilt static | |
| 56 | 新增:libraries/headers before relinking. The frozen originals are provided so users | |
| 57 | 新增:can relink modified SSHFS immediately, without having to reproduce Homebrew's | |
| 58 | 新增:bottle build environment. | |
| 59 | 新增: | |
| 60 | 新增:Copyright and license texts are under licenses/ and within each complete | |
| 61 | 新增:upstream archive. See NOTICE for the shipped components and Cage modification. | |
| @@ -21,7 +21,7 @@ else | ||
| 21 | 21 | fi |
| 22 | 22 | bash "$src/macos-fuse-media.sh" "$fuse" "$work/fuse.pkg" |
| 23 | 23 | pkgutil --expand-full "$work/fuse.pkg" "$work/sdk" |
| 24 | 删除:bash "$src/build-macos-sshfs.sh" "$work/sdk/Core.pkg/Payload/usr/local" "$dest/project/cage-sshfs" | |
| 24 | 新增:bash "$src/build-macos-sshfs.sh" "$work/sdk/Core.pkg/Payload/usr/local" "$dest/project/cage-sshfs" "$work/sshfs-source" | |
| 25 | 25 | xcrun clang -arch arm64 -mmacosx-version-min=14.0 -O2 -fobjc-arc -framework Foundation -framework OpenDirectory \ |
| 26 | 26 | "$src/macos-setup-account.m" -o "$dest/cage-finish-initial-setup" |
| 27 | 27 | xcrun clang -arch arm64 -O2 "$src/macos-ipv6-check.c" -o "$dest/cage-macos-ipv6-check" |
| @@ -36,3 +36,8 @@ cp "$src/configure-macos-session.sh" "$dest/" | ||
| 36 | 36 | # Final signing runs after every helper has been built. Component manifests are |
| 37 | 37 | # computed from these final bytes by RequiredNativeComponents at installation. |
| 38 | 38 | bash "$src/sign-macos-guest.sh" "$dest" "${CAGE_SIGNING_IDENTITY:--}" |
| 39 | 新增:# Bind the source distribution to the final Developer ID bytes, after the kit | |
| 40 | 新增:# has signed SSHFS. The outer host App signature does not change this helper. | |
| 41 | 新增:version=$(tr -d '\n\r' < "$src/../../VERSION") | |
| 42 | 新增:node "$src/collect-macos-sshfs-sources.mjs" finish "$work/sshfs-source" "$dest/project/cage-sshfs" \ | |
| 43 | 新增: "$dest/sources/cage-macos-guest-$version-source.tar.gz" "$dest/licenses/sshfs" | |
| @@ -0,0 +1,30 @@ | ||
| 1 | 新增:#!/bin/bash | |
| 2 | 新增:# Relink SSHFS from the frozen source distribution. An optional fourth argument | |
| 3 | 新增:# selects an already extracted/patched source tree for local modifications. | |
| 4 | 新增:set -euo pipefail | |
| 5 | 新增:[[ $# == 3 || $# == 4 ]] || { echo 'Usage: rebuild-macos-sshfs.sh /source-bundle /macfuse-sdk/usr/local /output [patched-source-tree]' >&2; exit 2; } | |
| 6 | 新增:materials=$1 | |
| 7 | 新增:sdk=$2 | |
| 8 | 新增:output=$3 | |
| 9 | 新增:[[ $materials == /* && $sdk == /* && $output == /* && ! -e $output && -f $sdk/include/fuse3/fuse.h ]] | |
| 10 | 新增:work=$(mktemp -d) | |
| 11 | 新增:trap 'rm -rf "$work"' EXIT | |
| 12 | 新增:if [[ $# == 4 ]]; then | |
| 13 | 新增: cd "$4" | |
| 14 | 新增:else | |
| 15 | 新增: tar -xf "$materials/upstream/sshfs.tar.gz" -C "$work" --strip-components 1 | |
| 16 | 新增: cd "$work" | |
| 17 | 新增: patch -p1 < "$materials/cage/sshfs-openwith.patch" | |
| 18 | 新增:fi | |
| 19 | 新增:cat > config.h <<'HEADER' | |
| 20 | 新增:#define PACKAGE_VERSION "3.7.6" | |
| 21 | 新增:#define IDMAP_DEFAULT "user" | |
| 22 | 新增:HEADER | |
| 23 | 新增:export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-14.0} | |
| 24 | 新增:glib=$materials/dependencies/glib | |
| 25 | 新增:intl=$materials/dependencies/gettext | |
| 26 | 新增:pcre=$materials/dependencies/pcre2 | |
| 27 | 新增:clang -arch arm64 -O2 -D_REENTRANT -DHAVE_CONFIG_H -DFUSE_DARWIN_ENABLE_EXTENSIONS=0 -DFUSE_USE_VERSION=31 \ | |
| 28 | 新增: -I. -Icompat -I"$sdk/include/fuse3" -I"$glib/include/glib-2.0" -I"$glib/lib/glib-2.0/include" -I"$intl/include" \ | |
| 29 | 新增: sshfs.c cache.c compat/darwin_compat.c "$glib/lib/libgthread-2.0.a" "$glib/lib/libglib-2.0.a" "$intl/lib/libintl.a" "$pcre/lib/libpcre2-8.a" \ | |
| 30 | 新增: -L"$sdk/lib" -lfuse3 -liconv -framework Foundation -framework CoreFoundation -framework AppKit -framework Carbon -o "$output" | |
| @@ -0,0 +1,61 @@ | ||
| 1 | 新增:import test from 'node:test'; | |
| 2 | 新增:import assert from 'node:assert/strict'; | |
| 3 | 新增:import { execFileSync } from 'node:child_process'; | |
| 4 | 新增:import { mkdirSync, mkdtempSync, readFileSync, rmSync, symlinkSync, writeFileSync } from 'node:fs'; | |
| 5 | 新增:import { tmpdir } from 'node:os'; | |
| 6 | 新增:import { join } from 'node:path'; | |
| 7 | 新增:import { extractLicenses, finish, inspectDependency, verifyArchive } from './guest-os/collect-macos-sshfs-sources.mjs'; | |
| 8 | 新增: | |
| 9 | 新增:test('macOS guest source is bound to the final signed binary and release version', t => { | |
| 10 | 新增: const root = mkdtempSync(join(tmpdir(), 'cage-sshfs-source-test-')); | |
| 11 | 新增: t.after(() => rmSync(root, { recursive: true, force: true })); | |
| 12 | 新增: const source = join(root, 'source'); | |
| 13 | 新增: mkdirSync(join(source, 'licenses'), { recursive: true }); | |
| 14 | 新增: writeFileSync(join(source, 'build.json'), JSON.stringify({ cageVersion: '0.1.7-rc.1' })); | |
| 15 | 新增: writeFileSync(join(source, 'NOTICE'), 'copyright and license notices'); | |
| 16 | 新增: writeFileSync(join(source, 'licenses/LICENSE'), 'upstream license'); | |
| 17 | 新增: writeFileSync(join(source, 'dependency.a'), 'the actual linked static library'); | |
| 18 | 新增: const binary = join(root, 'cage-sshfs'); | |
| 19 | 新增: writeFileSync(binary, 'final Developer ID signed executable'); | |
| 20 | 新增: const archive = join(root, 'source.tar.gz'); | |
| 21 | 新增: finish(source, binary, archive, join(root, 'app-licenses')); | |
| 22 | 新增: assert.equal(readFileSync(join(root, 'app-licenses/LICENSE'), 'utf8'), 'upstream license'); | |
| 23 | 新增: assert.doesNotThrow(() => verifyArchive(archive, binary, '0.1.7-rc.1')); | |
| 24 | 新增: assert.throws(() => verifyArchive(archive, binary, '0.1.7-rc.2'), /does not match/); | |
| 25 | 新增: writeFileSync(binary, 'earlier ad-hoc signed executable'); | |
| 26 | 新增: assert.throws(() => verifyArchive(archive, binary, '0.1.7-rc.1'), /does not match/); | |
| 27 | 新增: writeFileSync(binary, 'final Developer ID signed executable'); | |
| 28 | 新增: writeFileSync(join(source, 'dependency.a'), 'different static library'); | |
| 29 | 新增: execFileSync('tar', ['-czf', archive, '-C', source, '.']); | |
| 30 | 新增: assert.throws(() => verifyArchive(archive, binary, '0.1.7-rc.1'), /integrity check failed: dependency.a/); | |
| 31 | 新增:}); | |
| 32 | 新增: | |
| 33 | 新增:test('same-version Homebrew formula changes cannot silently substitute another build', t => { | |
| 34 | 新增: const root = mkdtempSync(join(tmpdir(), 'cage-sshfs-formula-test-')); | |
| 35 | 新增: t.after(() => rmSync(root, { recursive: true, force: true })); | |
| 36 | 新增: mkdirSync(join(root, '.brew')); | |
| 37 | 新增: writeFileSync(join(root, 'INSTALL_RECEIPT.json'), JSON.stringify({ source: { spec: 'stable', versions: { stable: '2.90.1' } } })); | |
| 38 | 新增: writeFileSync(join(root, '.brew/glib.rb'), 'same version, unreviewed upstream patch'); | |
| 39 | 新增: assert.throws(() => inspectDependency('glib', root), /installed formula\/version differs/); | |
| 40 | 新增:}); | |
| 41 | 新增: | |
| 42 | 新增:test('upstream license symlinks and PCRE2 LICENCE.md are distributed as readable texts', t => { | |
| 43 | 新增: const root = mkdtempSync(join(tmpdir(), 'cage-sshfs-license-test-')); | |
| 44 | 新增: t.after(() => rmSync(root, { recursive: true, force: true })); | |
| 45 | 新增: const upstream = join(root, 'upstream'); | |
| 46 | 新增: mkdirSync(join(upstream, 'glib/LICENSES'), { recursive: true }); | |
| 47 | 新增: writeFileSync(join(upstream, 'glib/LICENSES/LGPL-2.1-or-later.txt'), 'full LGPL text'); | |
| 48 | 新增: symlinkSync('LICENSES/LGPL-2.1-or-later.txt', join(upstream, 'glib/COPYING')); | |
| 49 | 新增: mkdirSync(join(upstream, 'pcre2/deps/sljit'), { recursive: true }); | |
| 50 | 新增: writeFileSync(join(upstream, 'pcre2/COPYING'), 'See LICENCE.md'); | |
| 51 | 新增: writeFileSync(join(upstream, 'pcre2/LICENCE.md'), 'BSD-3-Clause WITH PCRE2-exception'); | |
| 52 | 新增: writeFileSync(join(upstream, 'pcre2/deps/sljit/LICENSE'), 'SLJIT license'); | |
| 53 | 新增: for (const component of ['glib', 'pcre2']) { | |
| 54 | 新增: const archive = join(root, `${component}.tar.gz`); | |
| 55 | 新增: execFileSync('tar', ['-czf', archive, '-C', upstream, component]); | |
| 56 | 新增: extractLicenses(archive, join(root, 'licenses', component), component); | |
| 57 | 新增: } | |
| 58 | 新增: assert.equal(readFileSync(join(root, 'licenses/glib/COPYING'), 'utf8'), 'full LGPL text'); | |
| 59 | 新增: assert.equal(readFileSync(join(root, 'licenses/pcre2/LICENCE.md'), 'utf8'), 'BSD-3-Clause WITH PCRE2-exception'); | |
| 60 | 新增: assert.equal(readFileSync(join(root, 'licenses/pcre2/deps/sljit/LICENSE'), 'utf8'), 'SLJIT license'); | |
| 61 | 新增:}); | |
| @@ -31,6 +31,13 @@ if [[ "$actual_version" != "$version" ]]; then echo 'App version differs from VE | ||
| 31 | 31 | codesign --verify --deep --strict --verbose=2 "$bundle" |
| 32 | 32 | xcrun stapler validate "$bundle" |
| 33 | 33 | spctl --assess --type execute --verbose=2 "$bundle" |
| 34 | 新增:guest_source="cage-macos-guest-$version-source.tar.gz" | |
| 35 | 新增:guest_materials="$bundle/Contents/Resources/guest-os/sources/$guest_source" | |
| 36 | 新增:node scripts/guest-os/collect-macos-sshfs-sources.mjs verify "$guest_materials" \ | |
| 37 | 新增: "$bundle/Contents/Resources/guest-os/project/cage-sshfs" "$version" | |
| 38 | 新增:# Copy only the source frozen by this App build, including the final signed | |
| 39 | 新增:# helper hash. Packaging must not substitute newer Homebrew source material. | |
| 40 | 新增:cp "$guest_materials" "$release/$guest_source" | |
| 34 | 41 | |
| 35 | 42 | stage="$(mktemp -d "$PWD/_output/dmg-stage.XXXXXX")" |
| 36 | 43 | trap 'rm -rf "$stage"' EXIT |
| @@ -78,6 +85,6 @@ curl --fail --location --retry 2 --connect-timeout 15 --max-time 180 \ | ||
| 78 | 85 | -o "$release/$core_source.part" |
| 79 | 86 | mv "$release/$core_source.part" "$release/$core_source" |
| 80 | 87 | tar -tzf "$release/$core_source" > /dev/null |
| 81 | 删除:(cd "$release" && shasum -a 256 "$artifact" "$core_source" > SHA256SUMS) | |
| 88 | 新增:(cd "$release" && shasum -a 256 "$artifact" "$core_source" "$guest_source" > SHA256SUMS) | |
| 82 | 89 | node scripts/cleanup-apps.mjs --keep "$bundle" --root "$PWD/_output" |
| 83 | 删除:printf 'Verified release artifacts:\n%s/%s\n%s/%s\n%s/SHA256SUMS\n' "$release" "$artifact" "$release" "$core_source" "$release" | |
| 90 | 新增:printf 'Verified release artifacts:\n%s/%s\n%s/%s\n%s/%s\n%s/SHA256SUMS\n' "$release" "$artifact" "$release" "$core_source" "$release" "$guest_source" "$release" | |
| @@ -31,6 +31,7 @@ async function releaseNames() { | ||
| 31 | 31 | linux: `Cage-${version}-linux-amd64.deb`, |
| 32 | 32 | linuxSource: linuxDependencies.mihomoSource.file, |
| 33 | 33 | macSource: `mihomo-${macCore}-source.tar.gz`, |
| 34 | 新增: macGuestSource: `cage-macos-guest-${version}-source.tar.gz`, | |
| 34 | 35 | windowsSource: `mihomo-${dependencies.mihomo.version}-source.tar.gz`, |
| 35 | 36 | qemuPrefix: `qemu-${dependencies.qemu.version}-windows-full-source.`, |
| 36 | 37 | qemuSource: `${dependencies.qemuSource.file}.gz`, |
| @@ -116,12 +117,13 @@ export async function prepareReleaseAssets({ inputs, output }) { | ||
| 116 | 117 | if (!mac && !windows && !linux) throw new Error(`No supported package name for VERSION ${names.version}: ${directory}`); |
| 117 | 118 | if (linux && !entries.has(names.linuxSource)) throw new Error(`Missing Linux Mihomo source in SHA256SUMS: ${directory}`); |
| 118 | 119 | if (mac && !entries.has(names.macSource)) throw new Error(`Missing macOS Mihomo source in SHA256SUMS: ${directory}`); |
| 120 | 新增: if (mac && !entries.has(names.macGuestSource)) throw new Error(`Missing macOS guest corresponding source in SHA256SUMS: ${directory}`); | |
| 119 | 121 | if (windows && (!entries.has(names.windowsSource) || ![...entries.keys()].some(name => isQemuArchive(name, names)))) { |
| 120 | 122 | throw new Error(`Windows release requires its Mihomo and complete QEMU source archives in the same SHA256SUMS: ${directory}`); |
| 121 | 123 | } |
| 122 | 124 | for (const [name, digest] of entries) { |
| 123 | 125 | const installer = name === names.mac || name === names.windows || name === names.linux; |
| 124 | 删除: if (!installer && ![names.macSource, names.windowsSource, names.linuxSource, names.qemuSource, names.qemuKeymap, names.qemuChanges].includes(name) && !isQemuArchive(name, names)) { | |
| 126 | 新增: if (!installer && ![names.macSource, names.macGuestSource, names.windowsSource, names.linuxSource, names.qemuSource, names.qemuKeymap, names.qemuChanges].includes(name) && !isQemuArchive(name, names)) { | |
| 125 | 127 | throw new Error(`Unsupported asset or version in SHA256SUMS: ${name}`); |
| 126 | 128 | } |
| 127 | 129 | const existing = all.get(name); |
| @@ -14,6 +14,7 @@ const names = { | ||
| 14 | 14 | mac: `Cage-${version}-macos-arm64.dmg`, |
| 15 | 15 | windows: `Cage-${version}-windows-amd64-setup.exe`, |
| 16 | 16 | macSource: `mihomo-${macCore}-source.tar.gz`, |
| 17 | 新增: macGuestSource: `cage-macos-guest-${version}-source.tar.gz`, | |
| 17 | 18 | windowsSource: `mihomo-${dependencies.mihomo.version}-source.tar.gz`, |
| 18 | 19 | qemu: `qemu-${dependencies.qemu.version}-windows-full-source.zip`, |
| 19 | 20 | }; |
| @@ -31,7 +32,7 @@ async function platform(directory, assets) { | ||
| 31 | 32 | await writeFile(join(directory, 'SHA256SUMS'), Object.entries(assets).map(([name, data]) => `${digest(data)} ${name}\n`).join('')); |
| 32 | 33 | } |
| 33 | 34 | |
| 34 | 删除:const macAssets = () => ({ [names.mac]: 'mac package fixture', [names.macSource]: 'Mihomo source fixture' }); | |
| 35 | 新增:const macAssets = () => ({ [names.mac]: 'mac package fixture', [names.macSource]: 'Mihomo source fixture', [names.macGuestSource]: 'macOS guest source fixture' }); | |
| 35 | 36 | const windowsAssets = () => ({ [names.windows]: 'Windows package fixture', [names.windowsSource]: 'Mihomo source fixture', [names.qemu]: 'complete QEMU source fixture' }); |
| 36 | 37 | |
| 37 | 38 | test('includes Linux deb only with its verified corresponding source and merges common sources', async t => { |
| @@ -75,7 +76,7 @@ test('supports a single Windows or macOS platform with its corresponding sources | ||
| 75 | 76 | const f = await fixture(t); |
| 76 | 77 | await platform(f.mac, macAssets()); |
| 77 | 78 | await platform(f.windows, windowsAssets()); |
| 78 | 删除: assert.equal((await prepareReleaseAssets({ inputs: [f.mac], output: f.output })).assets.length, 2); | |
| 79 | 新增: assert.equal((await prepareReleaseAssets({ inputs: [f.mac], output: f.output })).assets.length, 3); | |
| 79 | 80 | assert.equal((await prepareReleaseAssets({ inputs: [f.windows], output: join(f.root, 'windows-only') })).assets.length, 3); |
| 80 | 81 | }); |
| 81 | 82 | |
| @@ -125,6 +126,15 @@ test('requires Windows complete QEMU source in the same verified manifest', asyn | ||
| 125 | 126 | await assert.rejects(prepareReleaseAssets({ inputs: [f.windows], output: f.output }), /complete QEMU source/); |
| 126 | 127 | }); |
| 127 | 128 | |
| 129 | 新增:test('requires the shipped macOS guest corresponding source in the verified manifest', async t => { | |
| 130 | 新增: const f = await fixture(t); | |
| 131 | 新增: const assets = macAssets(); | |
| 132 | 新增: delete assets[names.macGuestSource]; | |
| 133 | 新增: await platform(f.mac, assets); | |
| 134 | 新增: await writeFile(join(f.mac, names.macGuestSource), 'unlisted source is not verified'); | |
| 135 | 新增: await assert.rejects(prepareReleaseAssets({ inputs: [f.mac], output: f.output }), /macOS guest corresponding source/); | |
| 136 | 新增:}); | |
| 137 | 新增: | |
| 128 | 138 | test('rejects wrong versions and manifest paths outside the release directory', async t => { |
| 129 | 139 | const f = await fixture(t); |
| 130 | 140 | await platform(f.mac, { ...macAssets(), 'Cage-99.0.0-macos-arm64.dmg': 'wrong version' }); |
| @@ -264,7 +264,7 @@ async function artifactFixture(t) { | ||
| 264 | 264 | const root = await temporary(t); |
| 265 | 265 | const commitSha = 'a'.repeat(40); |
| 266 | 266 | const packages = { |
| 267 | 删除: macos: { [`Cage-${currentVersion}-macos-arm64.dmg`]: 'mac installer', [`mihomo-${macCoreVersion}-source.tar.gz`]: 'same core source' }, | |
| 267 | 新增: macos: { [`Cage-${currentVersion}-macos-arm64.dmg`]: 'mac installer', [`mihomo-${macCoreVersion}-source.tar.gz`]: 'same core source', [`cage-macos-guest-${currentVersion}-source.tar.gz`]: 'mac guest corresponding source' }, | |
| 268 | 268 | windows: { [`Cage-${currentVersion}-windows-amd64-setup.exe`]: 'windows installer', [`mihomo-${windowsDependencies.mihomo.version}-source.tar.gz`]: 'same core source', [`qemu-${windowsDependencies.qemu.version}-windows-full-source.zip`]: 'complete qemu source' }, |
| 269 | 269 | linux: { [`Cage-${currentVersion}-linux-amd64.deb`]: 'linux installer', [linuxDependencies.mihomoSource.file]: 'same core source' }, |
| 270 | 270 | }; |
| @@ -12,6 +12,7 @@ const repository = 'Lee-xeo/Claude-Cage'; | ||
| 12 | 12 | const repoURL = `https://github.com/${repository}`; |
| 13 | 13 | const apiURL = `https://api.github.com/repos/${repository}/releases`; |
| 14 | 14 | const sourceArchive = name => /^mihomo-v[\d.]+-source\.tar\.gz$/.test(name) || |
| 15 | 新增: /^cage-macos-guest-\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?-source\.tar\.gz$/.test(name) || | |
| 15 | 16 | /^qemu-[0-9a-f]{40}-source\.tar\.gz$/.test(name) || |
| 16 | 17 | /^qemu-keycodemapdb-[0-9a-f]{40}-source\.tar\.gz$/.test(name) || |
| 17 | 18 | /^qemu-\d+\.\d+\.\d+-cage-changes-source\.tar\.gz$/.test(name) || |
| @@ -198,7 +198,7 @@ test('macOS verification checks both owned archives without requiring other-plat | ||
| 198 | 198 | |
| 199 | 199 | test('explicit RC manifest exposes signed Windows and all platforms with complete QEMU sources', async () => { |
| 200 | 200 | const tag = 'v0.1.7-rc.1', version = tag.slice(1); |
| 201 | 删除: const names = [`Cage-${version}-macos-arm64.dmg`, `Cage-${version}-windows-amd64-setup.exe`, `Cage-${version}-linux-amd64.deb`, 'mihomo-v1.19.33-source.tar.gz', 'qemu-11.1.0-windows-full-source.tar.gz', `qemu-${'a'.repeat(40)}-source.tar.gz`, `qemu-keycodemapdb-${'b'.repeat(40)}-source.tar.gz`, 'qemu-11.1.0-cage-changes-source.tar.gz']; | |
| 201 | 新增: const names = [`Cage-${version}-macos-arm64.dmg`, `Cage-${version}-windows-amd64-setup.exe`, `Cage-${version}-linux-amd64.deb`, `cage-macos-guest-${version}-source.tar.gz`, 'mihomo-v1.19.33-source.tar.gz', 'qemu-11.1.0-windows-full-source.tar.gz', `qemu-${'a'.repeat(40)}-source.tar.gz`, `qemu-keycodemapdb-${'b'.repeat(40)}-source.tar.gz`, 'qemu-11.1.0-cage-changes-source.tar.gz']; | |
| 202 | 202 | const manifest = names.map(name => `${hash} ${name}\n`).join(''); |
| 203 | 203 | const release = await publicManifestRelease(tag, async (url, options = {}) => { |
| 204 | 204 | assert.equal(options.headers?.Authorization, undefined); |

