ALPM-MTREE(5) | File Formats Manual | ALPM-MTREE(5) |
NAME
ALPM-MTREE - Package directory hierarchy description format.
DESCRIPTION
The mtree format is a textual format that describes the hierarchy and metadata of files in a directory.
mtree is a well-known format that can, for example, be used for installation instructions or to verify files' metadata and the hierarchy of a directory.
The ALPM-MTREE format adheres to the official mtree specification. However, .MTREE files used in the context of ALPM packages only use a subset of the official mtree format that makes sense in the scope of packaging.
Properties
.MTREE files that're generated by `makepkg` only contain the following properties:
- `type`
- `uid`
- `gid`
- `mode`
- `time`
- `size`
- `md5`
- `sha256`
- `link`
Furthermore, as `mtree` files are used in the scope of Arch Linux packaging and always relate to files inside of Arch Linux packages. Due to this, all paths inside an ALPM-MTREE must be relative to the package, except link destinations, which may point outside of a package.
Path Type Property
In contrast to all available types in mtree, ALPM-MTREE only allows three file types:
- `dir` A directory
- `file` A file
- `link` A symbolic link
The other types are forbidden, as they should not be included in package.
Required Fields by File Type
ALPM-MTREE requires specific values to be set for certain file types, which is something mtree doesn't enforce by spec.
The dir path type requires the following properties to be set:
- `path`
- `uid`
- `gid`
- `mode`
- `time`
The file path type requires the following properties to be set:
- `path`
- `uid`
- `gid`
- `mode`
- `size`
- `md5_digest`
- `sha256_digest`
- `time`
The link path type requires the following properties to be set:
- `path`
- `uid`
- `gid`
- `mode`
- `link`
- `time`
Usage in Pacman
In Pacman ALPM-MTREE files are solely used to verify that installed files are identical to the original files without having to keep the original package around. .MTREE files are implicitly generated and included when creating packages via `makepkg`. The gzip-compressed .MTREE file is located in the root of ALPM based packages
Versioning
The ALPM-MTREE format exists in multiple versions. The information in this document is for version 2, which is the current version. It has been introduced with the release of pacman 6.1.0 on 2024-03-04.
Changes since the last version
The md5 field is no longer generated, effectively making this a breaking change.
EXAMPLES
#mtree /set type=file uid=0 gid=0 mode=644 /set mode=755 type=dir
Generation
ALPM's mtree files are generated by calling:
bsdtar --format=mtree --options='!all,use-set,type,uid,gid,mode,time,size,sha256,link' $folder
Usages
In the context of ALPM and `pacman`, the `mtree` file's main purpose is to provide a performant way of getting a package's file metadata without having to extract and read the whole package.
This data is then used to verify installed files on the target system against the original files from the package. Take a look at `pacman`'s query check functionality for more detail.