From 35397a43e20c10185ec953f1733705de254ad87a Mon Sep 17 00:00:00 2001 From: Edward Frazer Date: Tue, 21 Apr 2026 18:06:55 -0700 Subject: [PATCH] fix: stage selected standalone archives once --- scripts/stage_npm_packages.py | 33 ++++++++++++------- .../stage_standalone_installer_archives.py | 15 +++++++-- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/scripts/stage_npm_packages.py b/scripts/stage_npm_packages.py index 119b23044a..5c7e38fbd9 100755 --- a/scripts/stage_npm_packages.py +++ b/scripts/stage_npm_packages.py @@ -143,18 +143,20 @@ def stage_standalone_installer_archives( release_version: str, vendor_src: Path, output_dir: Path, + packages: list[str], ) -> None: - run_command( - [ - str(STAGE_STANDALONE_INSTALLER_ARCHIVES), - "--release-version", - release_version, - "--vendor-src", - str(vendor_src), - "--output-dir", - str(output_dir), - ] - ) + cmd = [ + str(STAGE_STANDALONE_INSTALLER_ARCHIVES), + "--release-version", + release_version, + "--vendor-src", + str(vendor_src), + "--output-dir", + str(output_dir), + ] + for package in packages: + cmd.extend(["--package", package]) + run_command(cmd) def tarball_name_for_package(package: str, version: str) -> str: @@ -226,6 +228,14 @@ def main() -> int: "--standalone-output-dir requires staged native binaries, but no selected " "package installed native components." ) + standalone_packages = [ + package for package in packages if package in CODEX_PLATFORM_PACKAGES + ] + if not standalone_packages: + raise RuntimeError( + "--standalone-output-dir requires at least one selected Codex platform " + "package." + ) standalone_output_dir = args.standalone_output_dir standalone_output_dir.mkdir(parents=True, exist_ok=True) @@ -233,6 +243,7 @@ def main() -> int: args.release_version, vendor_src, standalone_output_dir, + standalone_packages, ) final_messages.append( f"Staged standalone installer archives in {standalone_output_dir}" diff --git a/scripts/stage_standalone_installer_archives.py b/scripts/stage_standalone_installer_archives.py index 65c024a5e7..27256ff0c0 100755 --- a/scripts/stage_standalone_installer_archives.py +++ b/scripts/stage_standalone_installer_archives.py @@ -41,6 +41,16 @@ def parse_args() -> argparse.Namespace: default=REPO_ROOT / "dist" / "installer", help="Directory where standalone archives should be written.", ) + parser.add_argument( + "--package", + dest="packages", + action="append", + choices=sorted(CODEX_PLATFORM_PACKAGES), + help=( + "Codex platform package to stage. May be provided multiple times. " + "Defaults to all platform packages." + ), + ) return parser.parse_args() @@ -85,7 +95,7 @@ def write_archive(staging_dir: Path, output_path: Path) -> None: output_path.parent.mkdir(parents=True, exist_ok=True) with tarfile.open(output_path, "w:gz") as archive: for path in sorted(staging_dir.rglob("*")): - archive.add(path, arcname=path.relative_to(staging_dir)) + archive.add(path, arcname=path.relative_to(staging_dir), recursive=False) def main() -> int: @@ -94,7 +104,8 @@ def main() -> int: output_dir = args.output_dir.resolve() output_dir.mkdir(parents=True, exist_ok=True) - for package in sorted(CODEX_PLATFORM_PACKAGES): + packages = args.packages or sorted(CODEX_PLATFORM_PACKAGES) + for package in sorted(set(packages)): package_config = CODEX_PLATFORM_PACKAGES[package] platform_tag = package_config["npm_tag"] target = package_config["target_triple"]