Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Stop generating release checksums automatically

Danield8f3c3bd7de8
diff --git a/scripts/build-release.py b/scripts/build-release.py
index 2ab451d051..c79258f242 100644
--- a/scripts/build-release.py
+++ b/scripts/build-release.py
@@ -374,11 +374,6 @@ class Builder:
VERIFY.verify_package(path, sevenzip=VERIFY.find_7z(self.args.sevenzip), version=self.version)
for artifact in self.artifacts:
copy_verified(artifact, output / artifact.name, output)
- checksums = "".join(f"{VERIFY.digest(artifact)} {artifact.name}\n" for artifact in sorted(existing + self.artifacts))
- sums = self.work / "SHA256SUMS.txt"
- with sums.open("w", encoding="utf-8", newline="\n") as stream:
- stream.write(checksums)
- copy_verified(sums, output / "SHA256SUMS.txt", output)
print(f"完成:{len(self.artifacts)} 个安装包已校验并收集到 {output}")
@@ -425,7 +420,7 @@ def main():
print("本地前端仅构建一次;Linux 前端在 WSL 中构建")
for platform in args.platforms:
print(f" {platform}: {descriptions[platform]}")
- print("最后逐个验证安装包,全部通过后复制产物并生成 SHA256SUMS.txt")
+ print("最后逐个验证安装包,全部通过后复制产物")
if not args.execute:
print("当前仅显示计划,没有执行构建或修改文件;添加 --execute 开始")
return 0
diff --git a/scripts/test_build_release.py b/scripts/test_build_release.py
index 24b3347b6c..ab81e4e6f9 100644
--- a/scripts/test_build_release.py
+++ b/scripts/test_build_release.py
@@ -184,20 +184,26 @@ class BuildTests(unittest.TestCase):
self.builder.finish()
self.assertFalse(self.args.output.exists())
- def test_add_platform_updates_checksums_without_overwriting_packages(self):
+ def test_add_platform_preserves_existing_packages_and_checksums(self):
existing = self.write(self.args.output / "siyuan-3.8.4-win.exe", b"signed windows")
artifact = self.write(self.builder.work / "siyuan-3.8.4.apk", b"android")
self.write(self.args.output / "SHA256SUMS.txt", b"old sums")
self.builder.artifacts = [artifact]
with patch.object(build.VERIFY, "verify_package"), contextlib.redirect_stdout(io.StringIO()):
self.builder.finish()
- sums = (self.args.output / "SHA256SUMS.txt").read_text(encoding="utf-8")
- self.assertIn(build.VERIFY.digest(existing), sums)
- self.assertIn(build.VERIFY.digest(artifact), sums)
- self.assertIn(" siyuan-3.8.4.apk\n", sums)
+ self.assertEqual((self.args.output / "SHA256SUMS.txt").read_bytes(), b"old sums")
self.assertTrue((self.args.output / "siyuan-3.8.4.apk").is_file())
self.assertEqual(existing.read_bytes(), b"signed windows")
+ def test_finish_does_not_generate_checksums(self):
+ artifact = self.write(self.builder.work / "siyuan-3.8.4.apk", b"android")
+ self.builder.artifacts = [artifact]
+ with patch.object(build.VERIFY, "verify_package"), contextlib.redirect_stdout(io.StringIO()):
+ self.builder.finish()
+ self.assertEqual((self.args.output / artifact.name).read_bytes(), b"android")
+ self.assertFalse((self.args.output / "SHA256SUMS.txt").exists())
+ self.assertFalse((self.builder.work / "SHA256SUMS.txt").exists())
+
def test_default_plan_does_not_run_commands(self):
with patch.object(build.sys, "argv", ["build-release.py"]), patch.object(build, "run") as command, \
contextlib.redirect_stdout(io.StringIO()):