Skip to content

Commit 80a7e57

Browse files
authored
Merge pull request #2132 from Websoft9/feature/appstore-publish-migration
Feature/appstore publish migration
2 parents c060306 + e173510 commit 80a7e57

7 files changed

Lines changed: 44 additions & 10325 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ mk.sh
88
.claude
99
_bmad-output
1010

11-
# Pre-downloaded app sources
11+
# Pre-downloaded app sources
12+
13+
dist/

build/library_publish.py

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"rc": "library-rc.zip",
2323
"release": "library-latest.zip",
2424
}
25-
V2_FULL_PACKAGE_BASENAME = "library"
25+
V2_FULL_LATEST_NAME = "latest.zip"
2626
CATALOG_FILE_NAMES = (
2727
"catalog_en.json",
2828
"catalog_zh.json",
@@ -116,10 +116,6 @@ def summarize_versions(edition_list: list[dict]) -> list[str]:
116116
return versions
117117

118118

119-
def v2_full_package_names(channel: str, dataset_version: str) -> tuple[str, str]:
120-
return (f"{V2_FULL_PACKAGE_BASENAME}-{dataset_version}.zip", f"{V2_FULL_PACKAGE_BASENAME}-{channel}.zip")
121-
122-
123119
APP_PACKAGE_NAME = "latest.zip"
124120

125121

@@ -412,8 +408,7 @@ def validate_catalog_artifacts(output_dir: Path, manifest: dict) -> None:
412408

413409
def validate_library_artifacts(output_dir: Path, manifest: dict, changed_app_names: set[str] | None = None) -> None:
414410
for name in (
415-
manifest["fullPackage"]["versioned"],
416-
manifest["fullPackage"]["latest"],
411+
manifest["fullPackage"],
417412
manifest["appsIndex"],
418413
manifest["appsDelta"],
419414
"manifest.json",
@@ -567,16 +562,20 @@ def build_v2_appstore_artifacts(
567562
# ── catalog full package ─────────────────────────────────
568563
catalog_full_dir = catalog_dir / "full"
569564
catalog_full_dir.mkdir(parents=True, exist_ok=True)
570-
catalog_zip_name = f"catalog-{dataset_version}.zip"
565+
catalog_zip_latest_name = V2_FULL_LATEST_NAME
571566
with tempfile.TemporaryDirectory() as tmp_dir_name:
572567
tmp_dir = Path(tmp_dir_name)
573568
for file_name in CATALOG_FILE_NAMES:
574569
shutil.copy2(catalog_dir / file_name, tmp_dir / file_name)
575-
create_zip_from_directory(tmp_dir, catalog_full_dir / catalog_zip_name)
576-
catalog_zip_checksum = write_checksum_file(catalog_full_dir / catalog_zip_name)
577-
catalog_checksums["fullPackage"] = f"full/{catalog_zip_checksum}"
578-
579-
catalog_manifest = build_catalog_manifest(catalog_dsv, catalog_checksums, generated_at, f"full/{catalog_zip_name}")
570+
create_zip_from_directory(tmp_dir, catalog_full_dir / catalog_zip_latest_name)
571+
catalog_checksums["fullPackage"] = f"full/{write_checksum_file(catalog_full_dir / catalog_zip_latest_name)}"
572+
573+
catalog_manifest = build_catalog_manifest(
574+
catalog_dsv,
575+
catalog_checksums,
576+
generated_at,
577+
f"full/{catalog_zip_latest_name}",
578+
)
580579
write_json(catalog_dir / "manifest.json", catalog_manifest)
581580
write_checksum_file(catalog_dir / "manifest.json")
582581
validate_catalog_artifacts(catalog_dir, catalog_manifest)
@@ -586,20 +585,17 @@ def build_v2_appstore_artifacts(
586585
full_dir.mkdir(parents=True, exist_ok=True)
587586
apps_packages_dir.mkdir(parents=True, exist_ok=True)
588587

589-
full_versioned_name, full_latest_name = v2_full_package_names(channel, dataset_version)
588+
# ── library – compute index & delta BEFORE per-app zips ──
589+
apps_index = build_apps_index(catalog_dsv, channel, generated_at)
590+
serialized_index = json.dumps(apps_index, sort_keys=True, ensure_ascii=False)
591+
library_dsv = _hash_content(serialized_index)
592+
full_latest_name = V2_FULL_LATEST_NAME
590593

591594
with tempfile.TemporaryDirectory() as tmp_dir_name:
592595
tmp_dir = Path(tmp_dir_name)
593596
package_dir = tmp_dir / PACKAGE_ROOT_NAME
594597
copy_package_contents(package_dir, packaged_library_json)
595-
create_zip_from_directory(package_dir, full_dir / full_versioned_name)
596-
597-
shutil.copy2(full_dir / full_versioned_name, full_dir / full_latest_name)
598-
599-
# ── library – compute index & delta BEFORE per-app zips ──
600-
apps_index = build_apps_index(catalog_dsv, channel, generated_at)
601-
serialized_index = json.dumps(apps_index, sort_keys=True, ensure_ascii=False)
602-
library_dsv = _hash_content(serialized_index)
598+
create_zip_from_directory(package_dir, full_dir / full_latest_name)
603599

604600
apps_delta = build_apps_delta(
605601
apps_index=apps_index,
@@ -642,19 +638,15 @@ def build_v2_appstore_artifacts(
642638
write_json(library_dir / apps_delta_name, apps_delta)
643639

644640
library_checksums = {
645-
"fullPackageVersioned": f"full/{write_checksum_file(full_dir / full_versioned_name)}",
646-
"fullPackageLatest": f"full/{write_checksum_file(full_dir / full_latest_name)}",
641+
"fullPackage": f"full/{write_checksum_file(full_dir / full_latest_name)}",
647642
"appsIndex": write_checksum_file(library_dir / apps_index_name),
648643
"appsDelta": write_checksum_file(library_dir / apps_delta_name),
649644
}
650645

651646
library_manifest = build_library_manifest(
652647
dataset_version=library_dsv,
653648
channel=channel,
654-
full_package_names={
655-
"versioned": f"full/{full_versioned_name}",
656-
"latest": f"full/{full_latest_name}",
657-
},
649+
full_package_names=f"full/{full_latest_name}",
658650
apps_index_name=apps_index_name,
659651
apps_delta_name=apps_delta_name,
660652
checksum_names=library_checksums,
@@ -680,10 +672,7 @@ def build_v2_appstore_artifacts(
680672
},
681673
"library": {
682674
"manifest": "library/manifest.json",
683-
"fullPackage": {
684-
"versioned": f"full/{full_versioned_name}",
685-
"latest": f"full/{full_latest_name}",
686-
},
675+
"fullPackage": f"full/{full_latest_name}",
687676
"appPackagesBase": "apps/",
688677
"appsIndex": apps_index_name,
689678
"appsDelta": apps_delta_name,

dist/catalog-fixture/catalog_en.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)