Skip to content

Commit a5a78ac

Browse files
fix: build script on linux to only zip the binary (#2275)
1 parent 0c42019 commit a5a78ac

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

Cross.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@ passthrough = [
77
"AMAZON_Q_BUILD_VARIANT",
88
"AMAZON_Q_BUILD_HASH",
99
"AMAZON_Q_BUILD_DATETIME",
10-
"AMAZON_Q_BUILD_SKIP_FISH_TESTS",
11-
"AMAZON_Q_BUILD_SKIP_SHELLCHECK_TESTS",
1210
"Q_TELEMETRY_CLIENT_ID",
1311
]

scripts/build.py

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -506,33 +506,29 @@ def generate_sha(path: pathlib.Path) -> pathlib.Path:
506506

507507
def build_linux(chat_path: pathlib.Path, signer: GpgSigner | None):
508508
"""
509-
Creates tar.gz, tar.xz, tar.zst, and zip archives under `BUILD_DIR`.
510-
511-
Each archive has the following structure:
512-
- archive/qchat
509+
Creates qchat.tar.gz and qchat.zip archives under `BUILD_DIR`.
513510
"""
514-
archive_name = CHAT_BINARY_NAME
515-
516-
archive_path = pathlib.Path(archive_name)
517-
archive_path.mkdir(parents=True, exist_ok=True)
518-
shutil.copy2(chat_path, archive_path / CHAT_BINARY_NAME)
511+
chat_dst = BUILD_DIR / CHAT_BINARY_NAME
512+
chat_dst.unlink(missing_ok=True)
513+
shutil.copy2(chat_path, chat_dst)
519514

520-
info(f"Building {archive_name}.tar.gz")
521-
tar_gz_path = BUILD_DIR / f"{archive_name}.tar.gz"
522-
run_cmd(["tar", "-czf", tar_gz_path, archive_path])
515+
tar_gz_path = BUILD_DIR / f"{CHAT_BINARY_NAME}.tar.gz"
516+
tar_gz_path.unlink(missing_ok=True)
517+
info(f"Creating tar output to {tar_gz_path}")
518+
run_cmd(["tar", "-czf", tar_gz_path, "-C", BUILD_DIR, chat_dst.name], cwd=BUILD_DIR)
523519
generate_sha(tar_gz_path)
524520
if signer:
525521
signer.sign_file(tar_gz_path)
526522

527-
info(f"Building {archive_name}.zip")
528-
zip_path = BUILD_DIR / f"{archive_name}.zip"
529-
run_cmd(["zip", "-r", zip_path, archive_path])
523+
zip_path = BUILD_DIR / f"{CHAT_BINARY_NAME}.zip"
524+
zip_path.unlink(missing_ok=True)
525+
info(f"Creating zip output to {zip_path}")
526+
run_cmd(["zip", "-j", zip_path, chat_dst], cwd=BUILD_DIR)
530527
generate_sha(zip_path)
531528
if signer:
532529
signer.sign_file(zip_path)
533530

534531
# clean up
535-
shutil.rmtree(archive_path)
536532
if signer:
537533
signer.clean()
538534

0 commit comments

Comments
 (0)