The horrors of package formats, in Rust!
Flat files #
- Do I even need to say anything here? Horrible choice of package format, unless you’re distributing one file.
Tarballs #
- As far as I can tell, the
tar
crate can only unpack to a real directory on the filesystem, because nobody would ever have a use-case for extracting a tarball in-memory. - The
tar
crate follows symlinks by default. - Directories are an entry of type
Directory
and size0
. - Symlinks are an entry of type
Symlink
and size0
. - Symlinks have special extra metadata directly on the tar entry header.
- If you forget to set the checksum on an entry header, tooling may break in new and unhelpful ways.
Docker #
- lol
- Downloading an image, building an image, and uploading a rootfs tarball to the daemon are all the same command (
CreateImage
). - An exported Docker image is a tarball of tarballs (that may contain more tarballs as part of the layer!) + some metadata.
- An exported Docker image may contain more than one image.
- NOTE: I don’t remember the actual reason, but the metadata is an array which suggests that it’s possible.
- Everything about tarballs applies if you’re working with exporting or importing images.
- Yes, EVERYTHING.
- Docker’s external interface is basically just a glorified wrapper around tar. This is actually a good thing and doesn’t belong on this list.
Arch packages #
- All the metadata inside the package is optional, except for
.PKGINFO
..MTREE
and.BUILDINFO
are optional. - Version numbers MUST end in
-\d+$
or similar. I’m not certain why and couldn’t find an answer.pacman
will just refuse to install your package until you figure this out. -
.PKGINFO
does not support quoted strings. -
builddate
is optional and can be set to0
. -
size
is optional and can be set to0
.
Part 2 soon, where we meet .deb
, RPM, AppImage, and friends!