A .deb is an ar archive with three members in order: debian-binary (the text 2.0\n), control.tar.{gz,xz,zst} with package metadata, and data.tar.{gz,xz,zst} with the installed file tree. Current Debian and Ubuntu default to zstd for both tarballs.
There is no ar reader in the Go stdlib. The format is 8 bytes of global magic (!<arch>\n) followed by 60-byte fixed-width ASCII headers per member, so hand-rolling it is about 50 lines and avoids a dependency; blakesmith/ar is the usual third-party option if we would rather import one. Member names longer than 16 bytes use the GNU / + string-table convention but the three deb member names are all short so that can be skipped initially.
Present it like gems: unwrap data.tar.* as the root file tree and expose control.tar.* under a DEBIAN/ prefix so callers can read DEBIAN/control for metadata, matching the dpkg-deb -R layout.
Blocked on #23 for the zstd inner tarballs; gzip and xz members already work once ar parsing exists.
A
.debis an ar archive with three members in order:debian-binary(the text2.0\n),control.tar.{gz,xz,zst}with package metadata, anddata.tar.{gz,xz,zst}with the installed file tree. Current Debian and Ubuntu default to zstd for both tarballs.There is no ar reader in the Go stdlib. The format is 8 bytes of global magic (
!<arch>\n) followed by 60-byte fixed-width ASCII headers per member, so hand-rolling it is about 50 lines and avoids a dependency;blakesmith/aris the usual third-party option if we would rather import one. Member names longer than 16 bytes use the GNU/+ string-table convention but the three deb member names are all short so that can be skipped initially.Present it like gems: unwrap
data.tar.*as the root file tree and exposecontrol.tar.*under aDEBIAN/prefix so callers can readDEBIAN/controlfor metadata, matching thedpkg-deb -Rlayout.Blocked on #23 for the zstd inner tarballs; gzip and xz members already work once ar parsing exists.