CI / fmt (rustfmt --check) (push) Waiting to run
CI / clippy (ubuntu-latest) (push) Waiting to run
CI / clippy (windows-latest) (push) Waiting to run
CI / test (ubuntu-latest) (push) Waiting to run
CI / test (windows-latest) (push) Waiting to run
CI / build release (ubuntu-latest) (push) Waiting to run
CI / build release (windows-latest) (push) Waiting to run
CI / runtime smoke (ubuntu x64, xvfb) (push) Waiting to run
CI / runtime smoke (macos arm64, probe) (push) Skipped
CI / update-e2e (windows x64) (push) Waiting to run
GPU evidence / GPU 判据自测(不需 GPU;跳过 ≠ 已验证) (push) Waiting to run
GPU evidence / GPU 证据 — 探测可用产物与硬件适配器 (push) Waiting to run
Guards / core 零 UI 守门 (push) Waiting to run
Guards / presenter 零 UI 守门 (push) Waiting to run
Guards / design 零第三方依赖守门 (push) Waiting to run
Guards / unsafe 落点守门(集合必须恰好等于期望) (push) Waiting to run
Guards / 文件行数 ≤400 守门 (push) Waiting to run
Guards / 依赖许可与来源(cargo-deny) (push) Waiting to run
Release guard / 发布标记语义守门(push tag → 稳定版) (push) Waiting to run
Signing status(播报,不是门禁) / 判据自测(三行/退出码/变异重放/接线) (push) Waiting to run
Signing status(播报,不是门禁) / 签名就绪度(播报) (push) Waiting to run
Release / 选槽位(默认四个:Windows 两档 + Linux 两档) (push) Waiting to run
本批内容见 CHANGELOG.md 的 0.2.4 段。按 D41 用孤儿快照推 main,保留「公开史只有里程碑」的模型。
70 lines
3.2 KiB
Rust
70 lines
3.2 KiB
Rust
//! 更新 e2e 夹具的**签名**部分(M190):用 `packaging/sign_manifest.py` 给清单签 `.sig`。
|
|
//!
|
|
//! 为什么单独一个文件:`support/update_e2e.rs` 已经贴着全仓 400 行红线(M190 r1 复审 P1-3),
|
|
//! 而签名这一摊只被 `Fixture::publish` 用到。搬出来是纯搬家,语义未改。
|
|
//!
|
|
//! 为什么走**真脚本**而不是在测试里再写一份签名:这样这套端到端用例同时是「发布侧签名脚本 ⇒
|
|
//! 真二进制验签」的跨实现证据(Python 签、Rust 验)。脚本零第三方依赖,CI runner 与开发机都自带
|
|
//! python3/python;找不到 python 时这套用例**直接红**(不静默跳过——跳过等于这条链没有证据)。
|
|
|
|
use std::path::Path;
|
|
|
|
/// 测试签名钥的种子(**公开**:只对 `update-test-source` 构建有意义,正式信任表里没有这把钥,
|
|
/// 见 `crates/core/src/update/trust.rs::TEST_ONLY`)。
|
|
const TEST_KEY_SEED: &str = "ull-m190-test-key-seed-000000001";
|
|
/// 测试钥的 `key_id`(与 `trust.rs::TEST_ONLY` 一致)。
|
|
const TEST_KEY_ID: &str = "test-only-key";
|
|
|
|
/// 用 `packaging/sign_manifest.py` 给刚落盘的清单签一份 `.sig`(M190)。
|
|
///
|
|
/// 为什么走**真脚本**而不是在测试里再写一份签名:这样这套端到端用例同时是「发布侧签名脚本 ⇒
|
|
/// 真二进制验签」的跨实现证据(Python 签、Rust 验)。脚本零第三方依赖,CI runner 与开发机都自带
|
|
/// python3/python;找不到 python 时这套用例**直接红**(不静默跳过——跳过等于这条链没有证据)。
|
|
pub fn write_signature(manifest_path: &Path) {
|
|
let script = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../packaging/sign_manifest.py");
|
|
assert!(script.is_file(), "找不到签名脚本:{}", script.display());
|
|
let seed_hex: String = TEST_KEY_SEED
|
|
.as_bytes()
|
|
.iter()
|
|
.map(|byte| format!("{byte:02x}"))
|
|
.collect();
|
|
let secret = format!(r#"{{"key_id":"{TEST_KEY_ID}","seed_hex":"{seed_hex}"}}"#);
|
|
let mut command = None;
|
|
for candidate in ["python3", "python"] {
|
|
if std::process::Command::new(candidate)
|
|
.arg("--version")
|
|
.output()
|
|
.is_ok_and(|output| output.status.success())
|
|
{
|
|
command = Some(candidate);
|
|
break;
|
|
}
|
|
}
|
|
let python = command.unwrap_or_else(|| panic!("这套用例需要 python3/python 跑 {script:?}"));
|
|
let output = std::process::Command::new(python)
|
|
.arg(&script)
|
|
.arg("--sign")
|
|
.arg(manifest_path)
|
|
.env("ULL_MANIFEST_SIGNING_KEY", &secret)
|
|
.output()
|
|
.expect("跑签名脚本");
|
|
assert!(
|
|
output.status.success(),
|
|
"签名脚本失败:stdout={} stderr={}",
|
|
String::from_utf8_lossy(&output.stdout),
|
|
String::from_utf8_lossy(&output.stderr)
|
|
);
|
|
assert!(
|
|
manifest_path
|
|
.with_file_name(format!(
|
|
"{}.sig",
|
|
manifest_path
|
|
.file_name()
|
|
.map(|name| name.to_string_lossy().into_owned())
|
|
.unwrap_or_default()
|
|
))
|
|
.is_file(),
|
|
"签名脚本没产出 .sig"
|
|
);
|
|
}
|