提交记录修改scripts/bundle-qemu-sources.sh+2 −1看文件
修改scripts/bundle-qemu-sources.test.mjs+2 −1看文件
| @@ -10,12 +10,13 @@ for tool in "$node_command" git curl tar sha256sum find sort xargs pacman-key mk | ||
| 10 | 10 | command -v "$tool" >/dev/null 2>&1 || { echo "Missing source-collection tool: $tool" >&2; exit 1; } |
| 11 | 11 | done |
| 12 | 12 | commit=$("$node_command" -p "JSON.parse(require('fs').readFileSync(process.argv[1])).qemuSource.commit" "$repository/packaging/windows/dependencies.json") |
| 13 | 新增:source_repository=$("$node_command" -p "JSON.parse(require('fs').readFileSync(process.argv[1])).qemuSource.repository" "$repository/packaging/windows/dependencies.json") | |
| 13 | 14 | [[ $commit =~ ^[a-f0-9]{40}$ && -s "$runtime/build-source-packages.txt" ]] || { echo 'QEMU source/package identity is missing.' >&2; exit 1; } |
| 14 | 15 | stage=$(mktemp -d) |
| 15 | 16 | trap 'rm -rf "$stage"' EXIT |
| 16 | 17 | mkdir -p "$stage/source/packages" "$stage/source/cage" |
| 17 | 18 | git -c core.autocrlf=false init -q "$stage/source/qemu" |
| 18 | 删除:git -C "$stage/source/qemu" fetch --depth=1 https://github.com/stweil/qemu.git "$commit" | |
| 19 | 新增:git -C "$stage/source/qemu" fetch --depth=1 "$source_repository" "$commit" | |
| 19 | 20 | git -c core.autocrlf=false -C "$stage/source/qemu" checkout -q --detach FETCH_HEAD |
| 20 | 21 | [[ $(git -C "$stage/source/qemu" rev-parse HEAD) == "$commit" ]] |
| 21 | 22 | # All shipped firmware comes from QEMU's pinned ROM submodules. Include nested |
| @@ -12,7 +12,7 @@ test('source collector includes pinned firmware and authenticated package source | ||
| 12 | 12 | const repository=join(root,'repository'),runtime=join(root,'runtime'),bin=join(root,'bin'),artifact=join(root,'bundle.tar.gz'); |
| 13 | 13 | for(const path of [bin,runtime,join(repository,'packaging/windows'),join(repository,'scripts'),join(repository,'patches/qemu')])await mkdir(path,{recursive:true}); |
| 14 | 14 | const sha='a'.repeat(40),content='fixture source archive\n'; |
| 15 | 删除: await writeFile(join(repository,'packaging/windows/dependencies.json'),JSON.stringify({qemuSource:{commit:sha},qemuKeycodemap:{url:'https://source.invalid/keymap.tar.gz',hash:createHash('sha256').update(content).digest('hex')}})); | |
| 15 | 新增: await writeFile(join(repository,'packaging/windows/dependencies.json'),JSON.stringify({qemuSource:{repository:'https://source.invalid/locked-qemu.git',commit:sha},qemuKeycodemap:{url:'https://source.invalid/keymap.tar.gz',hash:createHash('sha256').update(content).digest('hex')}})); | |
| 16 | 16 | for(const name of ['build-source-packages.txt','build-packages.txt','cage-build.json'])await writeFile(join(runtime,name),name==='build-source-packages.txt'?'mingw-w64-fixture 1.2.3-1\n':'fixture'); |
| 17 | 17 | for(const name of ['build-qemu-windows.sh','build-qemu-windows.ps1','bundle-qemu-sources.sh'])await writeFile(join(repository,'scripts',name),'fixture build input'); |
| 18 | 18 | await writeFile(join(repository,'patches/qemu/fixture.patch'),'fixture patch'); |
| @@ -20,6 +20,7 @@ test('source collector includes pinned firmware and authenticated package source | ||
| 20 | 20 | await command('cygpath','printf "%s\\n" "$2"'); |
| 21 | 21 | await command('node','echo "The collector must use the explicit CAGE_NODE path" >&2; exit 99'); |
| 22 | 22 | await command('git',`if [[ "$*" == *' init '* ]];then mkdir -p "\${@: -1}/.git";fi |
| 23 | 新增: if [[ "$*" == *' fetch '* ]];then [[ "$*" == *'fetch --depth=1 https://source.invalid/locked-qemu.git ${sha}' ]] || exit 98;fi | |
| 23 | 24 | if [[ "$*" == *rev-parse* ]];then printf '${sha}\\n';fi |
| 24 | 25 | if [[ "$*" == *'submodule update'* ]];then for ((i=1;i<=$#;i++));do if [[ "\${!i}" == -C ]];then j=$((i+1));q="\${!j}";fi;done;mkdir -p "$q/roms/seabios";echo 'firmware code' > "$q/roms/seabios/code.c";echo 'gitdir: private' > "$q/roms/seabios/.git";fi |
| 25 | 26 | if [[ "$*" == *'submodule status'* ]];then printf ' ${sha} roms/seabios\\n';fi`); |

