fix: 使用固定便携包清单名称 (#102)

This commit is contained in:
chengma
2026-08-10 15:10:03 +08:00
parent 870c95a79d
commit 4dbe519029
7 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ _VERSION_PATTERN = re.compile(
def versioned_manifest_file_name(version: str) -> str:
"""返回版本化清单文件名,例如 ``autobuy_manifest_0.2.2.json``。"""
"""返回版本化清单文件名,例如 ``autobuy_manifest_0.1.0.json``。"""
normalized = version.strip()
if _VERSION_PATTERN.fullmatch(normalized) is None:
+1 -1
View File
@@ -181,7 +181,7 @@ VSVersionInfo(
$manifestPath = Join-Path $releaseRoot "autobuy_manifest.json"
Invoke-Checked -FailureMessage "Failed to generate the release manifest" -Command {
& $buildPython (Join-Path $clientRoot "build_tools\release_manifest.py") `
--version $version --update $updateZip --portable $portableZip `
--version $version --update $updateZip --portable $portableLatestZip `
--output $manifestPath
}
$versionedManifestPath = Join-Path $releaseRoot "autobuy_manifest_$version.json"
+1 -1
View File
@@ -3,4 +3,4 @@
发布脚本和程序界面需要版本号时都从这里读取,避免多个文件各写一份。
"""
__version__ = "0.2.2"
__version__ = "0.1.0"
+2 -1
View File
@@ -145,7 +145,7 @@ class ReleaseManifestTest(unittest.TestCase):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
update_zip = root / "CMAutoBuy_0.1.0.zip"
portable_zip = root / "自动采集采购工具_0.1.0.zip"
portable_zip = root / "自动采集采购工具.zip"
update_zip.write_bytes(b"update")
portable_zip.write_bytes(b"portable")
output = root / MANIFEST_FILE_NAME
@@ -160,6 +160,7 @@ class ReleaseManifestTest(unittest.TestCase):
manifest["update"]["sha256"],
hashlib.sha256(b"update").hexdigest(),
)
self.assertEqual(manifest["update"]["file"], "CMAutoBuy_0.1.0.zip")
self.assertEqual(manifest["portable"]["file"], portable_zip.name)
def test_versioned_manifest_name_is_stable_and_validated(self):
+1 -1
View File
@@ -258,7 +258,7 @@ class UpdateServiceTest(unittest.TestCase):
health = json.loads(
(self.update_directory / "healthy.json").read_text(encoding="utf-8")
)
self.assertEqual(health["version"], "0.2.2")
self.assertEqual(health["version"], "0.1.0")
if __name__ == "__main__":
+4 -4
View File
@@ -47,7 +47,7 @@ class FakeCredentialStore:
class FakeUpdateService:
def __init__(self, result=None, delay=0.0, download_error=None):
self.result = result or UpdateCheckResult("0.2.2", "0.2.2", False)
self.result = result or UpdateCheckResult("0.1.0", "0.1.0", False)
self.delay = delay
self.download_error = download_error
self.check_count = 0
@@ -58,7 +58,7 @@ class FakeUpdateService:
def check(
self,
manifest_url,
current_version="0.2.2",
current_version="0.1.0",
is_cancelled=None,
credentials=None,
):
@@ -142,7 +142,7 @@ class UpdateUiEventTest(unittest.TestCase):
def test_update_card_uses_safe_defaults_and_password_input(self):
page = self._page(FakeUpdateService())
self.assertEqual(page.currentVersionLabel.text(), "0.2.2")
self.assertEqual(page.currentVersionLabel.text(), "0.1.0")
self.assertEqual(
page.updateManifestUrlInput.text(), DEFAULT_UPDATE_MANIFEST_URL
)
@@ -313,7 +313,7 @@ class UpdateUiEventTest(unittest.TestCase):
sha256="0" * 64,
)
service = FakeUpdateService(
UpdateCheckResult("0.2.2", "0.3.0", True, update)
UpdateCheckResult("0.1.0", "0.3.0", True, update)
)
page = self._page(service)
self._save_configuration(page)
+3 -2
View File
@@ -218,8 +218,9 @@ CMAutoBuy/ 整个文件夹拷到任何机器都能用
- `autobuy_manifest.json`:Client 固定读取的在线更新清单;
- `autobuy_manifest_<版本号>.json`:与固定清单内容完全相同的归档副本。
清单中的更新包和便携包都引用带版本号的文件名,并记录版本、字节大小和 SHA256;
SHA256 用于发现下载损坏,不等同于发布者身份认证。
清单中的更新包引用带版本号的文件名,便携包固定引用
`自动采集采购工具.zip`,并记录版本、字节大小和 SHA256;SHA256 用于发现下载
损坏,不等同于发布者身份认证。
**在线更新:**设置页默认显示已确认的发布清单地址和账号,密码由操作人员首次
填写并保存到 Windows 凭据管理器;URL 和账号作为非敏感设置保存在 SQLite,密码