Crates.io | pkgar |
lib.rs | pkgar |
version | 0.1.15 |
source | src |
created_at | 2020-03-11 18:12:39.857162 |
updated_at | 2024-10-20 20:07:19.204513 |
description | Redox Package Archive |
homepage | |
repository | https://gitlab.redox-os.org/redox-os/pkgar |
max_upload_size | |
id | 217619 |
size | 73,256 |
pkgar refers to three related items - the file format, the library, and the command line executable.
The pkgar format is not designed to be the best format for all archive uses, only the best default format for packages on Redox OS. It is reproducible, meaning archiving a directory will produce the same results every time. It provides cryptographic signatures and integrity checking for package files. It also allows this functionality to be used without storing the entire package archive, by only storing the package header. Large files, compression, encryption, and random access are not optimized for. Little endian is currently assumed, as well as Unix mode flags.
This specification is currently a work in progress
pkgar is a format for packages may be delivered in a single file (.pkgar), or as
a header file (.pkgar_head) with an associated data file (.pkgar_data). The
purpose of this is to allow downloading a header only and verifying local files
before downloading file data. Concatenating the header and data files creates a
valid single file: cat example.pkgar_head example.pkgar_data > example.pkgar
The header portion is designed to contain the data required to verify files already installed on disk. It is signed using NaCl (or a compatible implementation such as libsodium), and contains the blake3, offset, size, mode, and name of each file. The user and group IDs are left out intentionally, to support the installation of a package either as root or as a user, for example, in the user's home directory.
The size of the header struct is 136 bytes. All fields are packed.
The size of the entry struct is 308 bytes. All fields are packed.
The data portion is used to look up file data only. It could be compressed to produce a .pkgar_data.gz file, for example. It can be removed after the install is completed. It is possible for it to contain holes, invalid data, or unreferenced data - so long as the blake3 of files identified in the header are still valid. This data should be removed when an archive is rebuilt.
A reader should first verify the header portion's signature matches that of a valid package source. Then, they should locate the entry for the file of interest. If desired, they can check if a locally cached file matches the referenced blake3. If this is not the case, they may access the data portion and verify that the data at the offset and length in the header entry matches the blake3. In that case, the data may be retrieved.
To run the integration tests, you'll need to have pkgar-keys in your $PATH (or the
$PATH of the test script). Clone the repo from
https://gitlab.redox-os.org/MggMuggins/pkgar-keys and run cargo install --path .
.
Use test.sh
to run the integration tests.