@@ -532,27 +532,12 @@ def build_apk_from_binary(
532532 f"builddate = { builddate } " ,
533533 ]
534534
535- # Create data tar with checksums
536- data_tar = tmpdir / "data.tar"
535+ # Create data tar (simple format without abuild-tar for compatibility)
537536 data_tar_gz = tmpdir / "data.tar.gz"
538537
539- tar_cmd = ["tar" , "-C" , str (data_dir ), "-cf" , "-" , "." ]
540- abuild_tar_cmd = ["abuild-tar" , "--hash" , "--cut" ]
541-
542- with open (data_tar , "wb" ) as out_file :
543- tar_proc = subprocess .Popen (tar_cmd , stdout = subprocess .PIPE , stderr = subprocess .DEVNULL )
544- abuild_proc = subprocess .Popen (
545- abuild_tar_cmd ,
546- stdin = tar_proc .stdout ,
547- stdout = out_file
548- )
549- tar_proc .stdout .close ()
550- abuild_proc .communicate (timeout = 120 )
551-
552- # Compress data tar
553- with open (data_tar , "rb" ) as f_in :
554- with open (data_tar_gz , "wb" ) as f_out :
555- subprocess .run (["gzip" , "-9" , "-n" ], stdin = f_in , stdout = f_out , timeout = 60 )
538+ # Use tar directly - simpler format works better with older apk-tools
539+ tar_cmd = ["tar" , "-C" , str (data_dir ), "-czf" , str (data_tar_gz ), "." ]
540+ subprocess .run (tar_cmd , timeout = 120 , check = True )
556541
557542 # Calculate datahash
558543 datahash = hashlib .sha256 (data_tar_gz .read_bytes ()).hexdigest ()
@@ -562,27 +547,11 @@ def build_apk_from_binary(
562547 pkginfo_file = control_dir / ".PKGINFO"
563548 pkginfo_file .write_text ("\n " .join (pkginfo_lines ) + "\n " )
564549
565- # Create control tar with checksums
566- control_tar = tmpdir / "control.tar"
550+ # Create control tar (simple format)
567551 control_tar_gz = tmpdir / "control.tar.gz"
568552
569- tar_cmd = ["tar" , "-C" , str (control_dir ), "-cf" , "-" , ".PKGINFO" ]
570- abuild_tar_cmd = ["abuild-tar" , "--hash" , "--cut" ]
571-
572- with open (control_tar , "wb" ) as out_file :
573- tar_proc = subprocess .Popen (tar_cmd , stdout = subprocess .PIPE , stderr = subprocess .DEVNULL )
574- abuild_proc = subprocess .Popen (
575- abuild_tar_cmd ,
576- stdin = tar_proc .stdout ,
577- stdout = out_file
578- )
579- tar_proc .stdout .close ()
580- abuild_proc .communicate (timeout = 60 )
581-
582- # Compress control tar
583- with open (control_tar , "rb" ) as f_in :
584- with open (control_tar_gz , "wb" ) as f_out :
585- subprocess .run (["gzip" , "-9" , "-n" ], stdin = f_in , stdout = f_out , timeout = 60 )
553+ tar_cmd = ["tar" , "-C" , str (control_dir ), "-czf" , str (control_tar_gz ), ".PKGINFO" ]
554+ subprocess .run (tar_cmd , timeout = 60 , check = True )
586555
587556 # Build final APK
588557 final_apk = tmpdir / "final.apk"
@@ -609,25 +578,9 @@ def build_apk_from_binary(
609578 sig_name = f".SIGN.RSA.{ key_name } .rsa.pub"
610579 shutil .copy (sig_file , sig_tar_dir / sig_name )
611580
612- sig_tar = tmpdir / "sig.tar"
613581 sig_tar_gz = tmpdir / "sig.tar.gz"
614-
615- tar_cmd = ["tar" , "-C" , str (sig_tar_dir ), "-cf" , "-" , sig_name ]
616- abuild_tar_cmd = ["abuild-tar" , "--cut" ]
617-
618- with open (sig_tar , "wb" ) as out_file :
619- tar_proc = subprocess .Popen (tar_cmd , stdout = subprocess .PIPE , stderr = subprocess .DEVNULL )
620- abuild_proc = subprocess .Popen (
621- abuild_tar_cmd ,
622- stdin = tar_proc .stdout ,
623- stdout = out_file
624- )
625- tar_proc .stdout .close ()
626- abuild_proc .communicate (timeout = 60 )
627-
628- with open (sig_tar , "rb" ) as f_in :
629- with open (sig_tar_gz , "wb" ) as f_out :
630- subprocess .run (["gzip" , "-9" , "-n" ], stdin = f_in , stdout = f_out , timeout = 60 )
582+ tar_cmd = ["tar" , "-C" , str (sig_tar_dir ), "-czf" , str (sig_tar_gz ), sig_name ]
583+ subprocess .run (tar_cmd , timeout = 60 , check = True )
631584
632585 # Concatenate: signature + control + data (3 gzip streams)
633586 with open (final_apk , "wb" ) as out :
0 commit comments