Skip to content

Commit 5b7c5fb

Browse files
bordeuxclaude
andcommitted
fix: add SHA1 checksums to data tar for apk-tools 3.0 compatibility
Alpine apk-tools 3.0 requires embedded SHA1 checksums in PAX headers. Use abuild-tar --hash to generate these checksums, which is compatible with both apk-tools v2 (warning) and v3 (required). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ac127b2 commit 5b7c5fb

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/generate_repo.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,14 @@ def build_apk_from_binary(
532532
f"builddate = {builddate}",
533533
]
534534

535-
# Create data tar using abuild-tar --cut to remove EOF markers (Alpine APK format)
535+
# Create data tar using abuild-tar --hash --cut for proper APK format
536536
data_tar_gz = tmpdir / "data.tar.gz"
537537

538-
# Use tar + abuild-tar --cut + gzip pipeline for proper APK format
539-
# abuild-tar --cut removes the end-of-archive zero blocks that standard tar adds
540-
# Use 'usr' instead of '.' to avoid ./usr paths - Alpine expects 'usr/bin/...' not './usr/bin/...'
541-
tar_cmd = f"tar -C {data_dir} -cf - usr | abuild-tar --cut | gzip -n -9 > {data_tar_gz}"
538+
# Use tar + abuild-tar --hash --cut + gzip pipeline
539+
# --hash: Adds SHA1 checksums as PAX headers (required for apk-tools 3.0)
540+
# --cut: Removes the end-of-archive zero blocks
541+
# Use 'usr' instead of '.' to avoid ./usr paths
542+
tar_cmd = f"tar -C {data_dir} -cf - usr | abuild-tar --hash --cut | gzip -n -9 > {data_tar_gz}"
542543
subprocess.run(tar_cmd, shell=True, timeout=120, check=True)
543544

544545
# Calculate datahash

0 commit comments

Comments
 (0)