@@ -506,33 +506,29 @@ def generate_sha(path: pathlib.Path) -> pathlib.Path:
506
506
507
507
def build_linux (chat_path : pathlib .Path , signer : GpgSigner | None ):
508
508
"""
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`.
513
510
"""
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 )
519
514
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 )
523
519
generate_sha (tar_gz_path )
524
520
if signer :
525
521
signer .sign_file (tar_gz_path )
526
522
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 )
530
527
generate_sha (zip_path )
531
528
if signer :
532
529
signer .sign_file (zip_path )
533
530
534
531
# clean up
535
- shutil .rmtree (archive_path )
536
532
if signer :
537
533
signer .clean ()
538
534
0 commit comments