xref: /haiku/docs/develop/packages/FileFormat.rst (revision a22fa0c977d48d26c3d7394b9e188a52e2bf11e2)
103d384bbSLeorize=========================
203d384bbSLeorizeHaiku Package File Format
303d384bbSLeorize=========================
403d384bbSLeorize
503d384bbSLeorize.. contents::
603d384bbSLeorize  :depth: 2
703d384bbSLeorize  :backlinks: none
803d384bbSLeorize
903d384bbSLeorizeThis document specifies the Haiku Package (HPKG) file format, which was designed
1003d384bbSLeorizefor efficient use by Haiku's package file system. It is somewhat inspired by the
1103d384bbSLeorize`XAR format`_ (separate TOC and data heap), but aims for greater compactness
1203d384bbSLeorize(no XML for the TOC).
1303d384bbSLeorize
1403d384bbSLeorize.. _XAR format: http://code.google.com/p/xar/
1503d384bbSLeorize
1603d384bbSLeorizeThree stacked format layers can be identified:
1703d384bbSLeorize
1803d384bbSLeorize- A generic container format for structured data.
1903d384bbSLeorize- An archive format specifying how file system data are stored in the container.
2003d384bbSLeorize- A package format, extending the archive format with attributes for package
2103d384bbSLeorize  management.
2203d384bbSLeorize
2303d384bbSLeorizeThe Data Container Format
2403d384bbSLeorize=========================
2503d384bbSLeorizeA HPKG file consists of four sections:
2603d384bbSLeorize
2703d384bbSLeorizeHeader
2803d384bbSLeorize  Identifies the file as HPKG file and provides access to the other sections.
2903d384bbSLeorize
3003d384bbSLeorizeHeap
3103d384bbSLeorize  Contains arbitrary (mostly unstructured) data referenced by the next two
3203d384bbSLeorize  sections.
3303d384bbSLeorize
3403d384bbSLeorizeTOC (table of contents)
3503d384bbSLeorize  The main section, containing structured data with references to unstructured
3603d384bbSLeorize  data in the heap section.
3703d384bbSLeorize
3803d384bbSLeorizePackage Attributes
3903d384bbSLeorize  A section similar to the TOC. Rather than describing the data contained in
4003d384bbSLeorize  the file, it specifies meta data of the package as a whole.
4103d384bbSLeorize
4203d384bbSLeorizeThe TOC and Package Attributes sections aren't really separate sections, as they
4303d384bbSLeorizeare stored at the end of the heap.
4403d384bbSLeorize
4503d384bbSLeorizeAll numbers in the HPKG are stored in big endian format or `LEB128`_ encoding.
4603d384bbSLeorize
4703d384bbSLeorize.. _LEB128: http://en.wikipedia.org/wiki/LEB128
4803d384bbSLeorize
4903d384bbSLeorizeHeader
5003d384bbSLeorize------
5103d384bbSLeorizeThe header has the following structure::
5203d384bbSLeorize
5303d384bbSLeorize  struct hpkg_header {
5403d384bbSLeorize  	uint32	magic;
5503d384bbSLeorize  	uint16	header_size;
5603d384bbSLeorize  	uint16	version;
5703d384bbSLeorize  	uint64	total_size;
5803d384bbSLeorize  	uint16	minor_version;
5903d384bbSLeorize
6003d384bbSLeorize  	uint16	heap_compression;
6103d384bbSLeorize  	uint32	heap_chunk_size;
6203d384bbSLeorize  	uint64	heap_size_compressed;
6303d384bbSLeorize  	uint64	heap_size_uncompressed;
6403d384bbSLeorize
6503d384bbSLeorize  	uint32	attributes_length;
6603d384bbSLeorize  	uint32	attributes_strings_length;
6703d384bbSLeorize  	uint32	attributes_strings_count;
6803d384bbSLeorize  	uint32	reserved1;
6903d384bbSLeorize
7003d384bbSLeorize  	uint64	toc_length;
7103d384bbSLeorize  	uint64	toc_strings_length;
7203d384bbSLeorize  	uint64	toc_strings_count;
7303d384bbSLeorize  };
7403d384bbSLeorize
7503d384bbSLeorizemagic
7603d384bbSLeorize  The string 'hpkg' (B_HPKG_MAGIC).
7703d384bbSLeorize
7803d384bbSLeorizeheader_size
7903d384bbSLeorize  The size of the header. This is also the absolute offset of the heap.
8003d384bbSLeorize
8103d384bbSLeorizeversion
8203d384bbSLeorize  The version of the HPKG format the file conforms to. The current version is
8303d384bbSLeorize  2 (B_HPKG_VERSION).
8403d384bbSLeorize
8503d384bbSLeorizetotal_size
8603d384bbSLeorize  The total file size.
8703d384bbSLeorize
8803d384bbSLeorizeminor_version
8903d384bbSLeorize  The minor version of the HPKG format the file conforms to. The current minor
90*a22fa0c9SAlexander G. M. Smith  version is 1 (B_HPKG_MINOR_VERSION). Additions of new attributes to the
9103d384bbSLeorize  attributes or TOC sections should generally only increment the minor version.
9203d384bbSLeorize  When a file with a greater minor version is encountered, the reader should
9303d384bbSLeorize  ignore unknown attributes.
9403d384bbSLeorize
9503d384bbSLeorize..
9603d384bbSLeorize
9703d384bbSLeorizeheap_compression
9803d384bbSLeorize  Compression format used for the heap.
9903d384bbSLeorize
10003d384bbSLeorizeheap_chunk_size
10103d384bbSLeorize  The size of the chunks the uncompressed heap data are divided into.
10203d384bbSLeorize
10303d384bbSLeorizeheap_size_compressed
10403d384bbSLeorize  The compressed size of the heap. This includes all administrative data (the
10503d384bbSLeorize  chunk size array).
10603d384bbSLeorize
10703d384bbSLeorizeheap_size_uncompressed
10803d384bbSLeorize  The uncompressed size of the heap. This is only the size of the raw data
10903d384bbSLeorize  (including the TOC and attributes section), not including administrative data
11003d384bbSLeorize  (the chunk size array).
11103d384bbSLeorize
11203d384bbSLeorize..
11303d384bbSLeorize
11403d384bbSLeorizeattributes_length
11503d384bbSLeorize  The uncompressed size of the package attributes section.
11603d384bbSLeorize
11703d384bbSLeorizeattributes_strings_length
11803d384bbSLeorize  The size of the strings subsection of the package attributes section.
11903d384bbSLeorize
12003d384bbSLeorizeattributes_strings_count
12103d384bbSLeorize  The number of entries in the strings subsection of the package attributes
12203d384bbSLeorize  section.
12303d384bbSLeorize
12403d384bbSLeorize..
12503d384bbSLeorize
12603d384bbSLeorizereserved1
12703d384bbSLeorize  Reserved for later use.
12803d384bbSLeorize
12903d384bbSLeorize..
13003d384bbSLeorize
13103d384bbSLeorizetoc_length
13203d384bbSLeorize  The uncompressed size of the TOC section.
13303d384bbSLeorize
13403d384bbSLeorizetoc_strings_length
13503d384bbSLeorize  The size of the strings subsection of the TOC section.
13603d384bbSLeorize
13703d384bbSLeorizetoc_strings_count
13803d384bbSLeorize  The number of entries in the strings subsection of the TOC section.
13903d384bbSLeorize
14003d384bbSLeorizeHeap
14103d384bbSLeorize----
14203d384bbSLeorizeThe heap provides storage for arbitrary data. Data from various sources are
14303d384bbSLeorizeconcatenated without padding or separator, forming the uncompressed heap. A
14403d384bbSLeorizespecific section of data is usually referenced (e.g. in the TOC and attributes
14503d384bbSLeorizesections) by an offset and the number of bytes. These references always point
14603d384bbSLeorizeinto the uncompressed heap, even if the heap is actually stored in a compressed
14703d384bbSLeorizeformat. The ``heap_compression`` field in the header specifies which format is
14803d384bbSLeorizeused. The following values are defined:
14903d384bbSLeorize
15003d384bbSLeorize= ======================= =======================
15103d384bbSLeorize0 B_HPKG_COMPRESSION_NONE no compression
15203d384bbSLeorize1 B_HPKG_COMPRESSION_ZLIB zlib (LZ77) compression
15303d384bbSLeorize= ======================= =======================
15403d384bbSLeorize
15503d384bbSLeorizeThe uncompressed heap data are divided into equally sized chunks (64 KiB). The
15603d384bbSLeorizelast chunk in the heap may have a different uncompressed length from the
15703d384bbSLeorizepreceding chunks. The uncompressed length of the last chunk can be derived. Each
15803d384bbSLeorizeindividual chunk may be stored compressed or not.
15903d384bbSLeorize
16003d384bbSLeorizeUnless B_HPKG_COMPRESSION_NONE is specified, a uint16 array at the end of the
16103d384bbSLeorizeheap contains the actual in-file (compressed) size of each chunk (minus 1 -- 0
16203d384bbSLeorizemeans 1 byte), save for the last one, which is omitted since it is implied. A
16303d384bbSLeorizechunk is only stored compressed, if compression actually saves space. That is
16403d384bbSLeorizeif the chunk's compressed size equals its uncompressed size, the data aren't
16503d384bbSLeorizecompressed. If B_HPKG_COMPRESSION_NONE is specified, the chunk size table is
16603d384bbSLeorizeomitted entirely.
16703d384bbSLeorize
16803d384bbSLeorizeThe TOC and the package attributes sections are stored (in this order) at the
16903d384bbSLeorizeend of the uncompressed heap. The offset of the package attributes section data
17003d384bbSLeorizeis therefore ``heap_size_uncompressed - attributes_length`` and the offset of
17103d384bbSLeorizethe TOC section data
17203d384bbSLeorize``heap_size_uncompressed - attributes_length - toc_length``.
17303d384bbSLeorize
17403d384bbSLeorizeTOC
17503d384bbSLeorize---
17603d384bbSLeorizeThe TOC section contains a list of attribute trees. An attribute has an ID, a
17703d384bbSLeorizedata type, and a value, and can have child attributes. E.g.:
17803d384bbSLeorize
17903d384bbSLeorize- ATTRIBUTE_ID_SHOPPING_LIST : string : "bakery"
18003d384bbSLeorize
18103d384bbSLeorize  - ATTRIBUTE_ID_ITEM : string : "rye bread"
18203d384bbSLeorize  - ATTRIBUTE_ID_ITEM : string : "bread roll"
18303d384bbSLeorize
18403d384bbSLeorize    - ATTRIBUTE_ID_COUNT : int : 10
18503d384bbSLeorize
18603d384bbSLeorize  - ATTRIBUTE_ID_ITEM : string : "cookie"
18703d384bbSLeorize
18803d384bbSLeorize    - ATTRIBUTE_ID_COUNT : int : 5
18903d384bbSLeorize
19003d384bbSLeorize- ATTRIBUTE_ID_SHOPPING_LIST : string : "hardware store"
19103d384bbSLeorize
19203d384bbSLeorize  - ATTRIBUTE_ID_ITEM : string : "hammer"
19303d384bbSLeorize  - ATTRIBUTE_ID_ITEM : string : "nail"
19403d384bbSLeorize
19503d384bbSLeorize    - ATTRIBUTE_ID_SIZE : int : 10
19603d384bbSLeorize    - ATTRIBUTE_ID_COUNT : int : 100
19703d384bbSLeorize
19803d384bbSLeorizeThe main TOC section refers to any attribute by its unique ID (see below) and
19903d384bbSLeorizestores the attribute's value, either as a reference into the heap or as inline
20003d384bbSLeorizedata.
20103d384bbSLeorize
20203d384bbSLeorizeAn optimization exists for shared string attribute values. A string value used
20303d384bbSLeorizeby more than one attribute is stored in the strings subsection and is referenced
20403d384bbSLeorizeby an index.
20503d384bbSLeorize
20603d384bbSLeorizeHence the TOC section consists of two subsections:
20703d384bbSLeorize
20803d384bbSLeorizeStrings
20903d384bbSLeorize  A table of commonly used strings.
21003d384bbSLeorize
21103d384bbSLeorizeMain TOC
21203d384bbSLeorize  The attribute trees.
21303d384bbSLeorize
21403d384bbSLeorizeAttribute Data Types
21503d384bbSLeorize`````````````````````
21603d384bbSLeorizeThese are the specified data type values for attributes:
21703d384bbSLeorize
21803d384bbSLeorize= ============================= =================
21903d384bbSLeorize0 B_HPKG_ATTRIBUTE_TYPE_INVALID invalid
22003d384bbSLeorize1 B_HPKG_ATTRIBUTE_TYPE_INT     signed integer
22103d384bbSLeorize2 B_HPKG_ATTRIBUTE_TYPE_UINT    unsigned integer
22203d384bbSLeorize3 B_HPKG_ATTRIBUTE_TYPE_STRING  UTF-8 string
22303d384bbSLeorize4 B_HPKG_ATTRIBUTE_TYPE_RAW     raw data
22403d384bbSLeorize= ============================= =================
22503d384bbSLeorize
22603d384bbSLeorizeStrings
22703d384bbSLeorize```````
22803d384bbSLeorizeThe strings subsections consists of a list of null-terminated UTF-8 strings. The
22903d384bbSLeorizesection itself is terminated by a 0 byte.
23003d384bbSLeorize
23103d384bbSLeorizeEach string is implicitly assigned the (null-based) index at which it appears in
23203d384bbSLeorizethe list, i.e. the nth string has the index n - 1. The string is referenced by
23303d384bbSLeorizethis index in the main TOC subsection.
23403d384bbSLeorize
23503d384bbSLeorizeMain TOC
23603d384bbSLeorize````````
23703d384bbSLeorizeThe main TOC subsection consists of a list of attribute entries terminated by a
23803d384bbSLeorize0 byte. An attribute entry is stored as:
23903d384bbSLeorize
24003d384bbSLeorizeAttribute tag
24103d384bbSLeorize  An unsigned LEB128 encoded number.
24203d384bbSLeorize
24303d384bbSLeorizeAttribute value
24403d384bbSLeorize  The value of the attribute encoded as described below.
24503d384bbSLeorize
24603d384bbSLeorizeAttribute child list
24703d384bbSLeorize  Only if this attribute is marked to have children: A list of attribute entries
24803d384bbSLeorize  terminated by a 0 byte.
24903d384bbSLeorize
25003d384bbSLeorizeThe attribute tag encodes four pieces of information::
25103d384bbSLeorize
25203d384bbSLeorize  (encoding << 11) + (hasChildren << 10) + (dataType << 7) + id + 1
25303d384bbSLeorize
25403d384bbSLeorizeencoding
25503d384bbSLeorize  Specifies the encoding of the attribute value as described below.
25603d384bbSLeorize
25703d384bbSLeorizehasChildren
25803d384bbSLeorize  1, if the attribute has children, 0 otherwise.
25903d384bbSLeorize
26003d384bbSLeorizedataType
26103d384bbSLeorize  The data type of the attribute (B_HPKG_ATTRIBUTE_TYPE\_...).
26203d384bbSLeorize
26303d384bbSLeorizeid
26403d384bbSLeorize  The ID of the attribute (B_HPKG_ATTRIBUTE_ID\_...).
26503d384bbSLeorize
26603d384bbSLeorizeAttribute Values
26703d384bbSLeorize````````````````
26803d384bbSLeorizeA value of each of the data types can be encoded in different ways, which is
26903d384bbSLeorizedefined by the encoding value:
27003d384bbSLeorize
27103d384bbSLeorize- B_HPKG_ATTRIBUTE_TYPE_INT and B_HPKG_ATTRIBUTE_TYPE_UINT:
27203d384bbSLeorize
27303d384bbSLeorize  = ==================================== ============
27403d384bbSLeorize  0 B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT  int8/uint8
27503d384bbSLeorize  1 B_HPKG_ATTRIBUTE_ENCODING_INT_16_BIT int16/uint16
27603d384bbSLeorize  2 B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT int32/uint32
27703d384bbSLeorize  3 B_HPKG_ATTRIBUTE_ENCODING_INT_64_BIT int64/uint64
27803d384bbSLeorize  = ==================================== ============
27903d384bbSLeorize
28003d384bbSLeorize- B_HPKG_ATTRIBUTE_TYPE_STRING:
28103d384bbSLeorize
28203d384bbSLeorize  = ======================================= ==================================
28303d384bbSLeorize  0 B_HPKG_ATTRIBUTE_ENCODING_STRING_INLINE null-terminated UTF-8 string
28403d384bbSLeorize  1 B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE  unsigned LEB128: index into string
28503d384bbSLeorize                                            table
28603d384bbSLeorize  = ======================================= ==================================
28703d384bbSLeorize
28803d384bbSLeorize- B_HPKG_ATTRIBUTE_TYPE_RAW:
28903d384bbSLeorize
29003d384bbSLeorize  = ==================================== =======================================
29103d384bbSLeorize  0 B_HPKG_ATTRIBUTE_ENCODING_RAW_INLINE unsigned LEB128: size; followed by raw
29203d384bbSLeorize                                         bytes
29303d384bbSLeorize  1 B_HPKG_ATTRIBUTE_ENCODING_RAW_HEAP   unsigned LEB128: size; unsigned LEB128:
29403d384bbSLeorize                                         offset into the uncompressed heap
29503d384bbSLeorize  = ==================================== =======================================
29603d384bbSLeorize
29703d384bbSLeorizePackage Attributes
29803d384bbSLeorize------------------
29903d384bbSLeorizeThe package attributes section contains a list of attribute trees, just like the
30003d384bbSLeorizeTOC section. The structure of this section follows the TOC, i.e. there's a
30103d384bbSLeorizesubsection for shared strings and a subsection that stores a list of attribute
30203d384bbSLeorizeentries terminated by a 0 byte. An entry has the same format as the ones in the
30303d384bbSLeorizeTOC (only using different attribute IDs).
30403d384bbSLeorize
30503d384bbSLeorizeThe Archive Format
30603d384bbSLeorize==================
30703d384bbSLeorizeThis section specifies how file system objects (files, directories, symlinks)
30803d384bbSLeorizeare stored in a HPKG file. It builds on top of the container format, defining
30903d384bbSLeorizethe types of attributes, their order, and allowed values.
31003d384bbSLeorize
31103d384bbSLeorizeE.g. a "bin" directory, containing a symlink and a file::
31203d384bbSLeorize
31303d384bbSLeorize  bin           0  2009-11-13 12:12:09  drwxr-xr-x
31403d384bbSLeorize    awk         0  2009-11-13 12:11:16  lrwxrwxrwx  -> gawk
31503d384bbSLeorize    gawk   301699  2009-11-13 12:11:16  -rwxr-xr-x
31603d384bbSLeorize
31703d384bbSLeorizecould be represented by this attribute tree:
31803d384bbSLeorize
31903d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_DIR_ENTRY : string : "bin"
32003d384bbSLeorize
32103d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_FILE_TYPE : uint : 1 (0x1)
32203d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_FILE_MTIME : uint : 1258110729 (0x4afd3f09)
32303d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_DIR_ENTRY : string : "awk"
32403d384bbSLeorize
32503d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_TYPE : uint : 2 (0x2)
32603d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_MTIME : uint : 1258110676 (0x4afd3ed4)
32703d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH : string : "gawk"
32803d384bbSLeorize
32903d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_DIR_ENTRY : string : "gawk"
33003d384bbSLeorize
33103d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS : uint : 493 (0x1ed)
33203d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_MTIME : uint : 1258110676 (0x4afd3ed4)
33303d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_DATA : raw : size: 301699, offset: 0
33403d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE : string : "BEOS:APP_VERSION"
33503d384bbSLeorize
33603d384bbSLeorize      - B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE : uint : 1095782486 (0x41505056)
33703d384bbSLeorize      - B_HPKG_ATTRIBUTE_ID_DATA : raw : size: 680, offset: 301699
33803d384bbSLeorize
33903d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE : string : "BEOS:TYPE"
34003d384bbSLeorize
34103d384bbSLeorize      - B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE : uint : 1296649555 (0x4d494d53)
34203d384bbSLeorize      - B_HPKG_ATTRIBUTE_ID_DATA : raw : size: 35, offset: 302379
34303d384bbSLeorize
34403d384bbSLeorizeAttribute IDs
34503d384bbSLeorize-------------
34603d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY ("dir:entry")
34703d384bbSLeorize  :Type: string
34803d384bbSLeorize  :Value: File name of the entry.
34903d384bbSLeorize  :Allowed Values: Any valid file (not path!) name, save "." and "..".
35003d384bbSLeorize  :Child Attributes:
35103d384bbSLeorize
35203d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_TYPE: The file type of the entry.
35303d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS: The file permissions of the entry.
35403d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_USER: The owning user of the entry.
35503d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_GROUP: The owning group of the entry.
35603d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_ATIME[_NANOS]: The entry's file access time.
35703d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_MTIME[_NANOS]: The entry's file modification
35803d384bbSLeorize      time.
35903d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_CRTIME[_NANOS]: The entry's file creation time.
36003d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE: An extended file attribute associated
36103d384bbSLeorize      with entry.
36203d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_DATA: Only if the entry is a file: The file data.
36303d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_SYMLINK_PATH: Only if the entry is a symlink: The path
36403d384bbSLeorize      the symlink points to.
36503d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY: Only if the entry is a directory: A
36603d384bbSLeorize      child entry in that directory.
36703d384bbSLeorize
36803d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_TYPE ("file\:type")
36903d384bbSLeorize  :Type: uint
37003d384bbSLeorize  :Value: Type of the entry.
37103d384bbSLeorize  :Allowed Values:
37203d384bbSLeorize
37303d384bbSLeorize    = ========================== =========
37403d384bbSLeorize    0 B_HPKG_FILE_TYPE_FILE      file
37503d384bbSLeorize    1 B_HPKG_FILE_TYPE_DIRECTORY directory
37603d384bbSLeorize    2 B_HPKG_FILE_TYPE_SYMLINK   symlink
37703d384bbSLeorize    = ========================== =========
37803d384bbSLeorize
37903d384bbSLeorize  :Default Value: B_HPKG_FILE_TYPE_FILE
38003d384bbSLeorize  :Child Attributes: none
38103d384bbSLeorize
38203d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_PERMISSIONS ("file\:permissions")
38303d384bbSLeorize  :Type: uint
38403d384bbSLeorize  :Value: File permissions.
38503d384bbSLeorize  :Allowed Values: Any valid permission mask.
38603d384bbSLeorize  :Default Value:
38703d384bbSLeorize
38803d384bbSLeorize    - For files: 0644 (octal).
38903d384bbSLeorize    - For directories: 0755 (octal).
39003d384bbSLeorize    - For symlinks: 0777 (octal).
39103d384bbSLeorize
39203d384bbSLeorize  :Child Attributes: none
39303d384bbSLeorize
39403d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_USER ("file\:user")
39503d384bbSLeorize  :Type: string
39603d384bbSLeorize  :Value: Name of the user owning the file.
39703d384bbSLeorize  :Allowed Values: Any non-empty string.
39803d384bbSLeorize  :Default Value: The user owning the installation location where the package is
39903d384bbSLeorize    activated.
40003d384bbSLeorize  :Child Attributes: none
40103d384bbSLeorize
40203d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_GROUP ("file\:group")
40303d384bbSLeorize  :Type: string
40403d384bbSLeorize  :Value: Name of the group owning the file.
40503d384bbSLeorize  :Allowed Values: Any non-empty string.
40603d384bbSLeorize  :Default Value: The group owning the installation location where the package
40703d384bbSLeorize    is activated.
40803d384bbSLeorize  :Child Attributes: none
40903d384bbSLeorize
41003d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_ATIME ("file\:atime")
41103d384bbSLeorize  :Type: uint
41203d384bbSLeorize  :Value: File access time (seconds since the Epoch).
41303d384bbSLeorize  :Allowed Values: Any value.
41403d384bbSLeorize  :Child Attributes: none
41503d384bbSLeorize
41603d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_ATIME_NANOS ("file\:mtime:nanos")
41703d384bbSLeorize  :Type: uint
41803d384bbSLeorize  :Value: The nano seconds fraction of the file access time.
41903d384bbSLeorize  :Allowed Values: Any value in [0, 999999999].
42003d384bbSLeorize  :Default Value: 0
42103d384bbSLeorize  :Child Attributes: none
42203d384bbSLeorize
42303d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_MTIME ("file\:mtime")
42403d384bbSLeorize  :Type: uint
42503d384bbSLeorize  :Value: File modified time (seconds since the Epoch).
42603d384bbSLeorize  :Allowed Values: Any value.
42703d384bbSLeorize  :Child Attributes: none
42803d384bbSLeorize
42903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_MTIME_NANOS ("file\:mtime:nanos")
43003d384bbSLeorize  :Type: uint
43103d384bbSLeorize  :Value: The nano seconds fraction of the file modified time.
43203d384bbSLeorize  :Allowed Values: Any value in [0, 999999999].
43303d384bbSLeorize  :Default Value: 0
43403d384bbSLeorize  :Child Attributes: none
43503d384bbSLeorize
43603d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_CRTIME ("file\:crtime")
43703d384bbSLeorize  :Type: uint
43803d384bbSLeorize  :Value: File creation time (seconds since the Epoch).
43903d384bbSLeorize  :Allowed Values: Any value.
44003d384bbSLeorize  :Child Attributes: none
44103d384bbSLeorize
44203d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_CRTIM_NANOS ("file\:crtime:nanos")
44303d384bbSLeorize  :Type: uint
44403d384bbSLeorize  :Value: The nano seconds fraction of the file creation time.
44503d384bbSLeorize  :Allowed Values: Any value in [0, 999999999].
44603d384bbSLeorize  :Default Value: 0
44703d384bbSLeorize  :Child Attributes: none
44803d384bbSLeorize
44903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE ("file\:attribute")
45003d384bbSLeorize  :Type: string
45103d384bbSLeorize  :Value: Name of the extended file attribute.
45203d384bbSLeorize  :Allowed Values: Any valid attribute name.
45303d384bbSLeorize  :Child Attributes:
45403d384bbSLeorize
45503d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE: The type of the file attribute.
45603d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_DATA: The file attribute data.
45703d384bbSLeorize
45803d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_FILE_ATTRIBUTE_TYPE ("file\:attribute:type")
45903d384bbSLeorize  :Type: uint
46003d384bbSLeorize  :Value: Type of the file attribute.
46103d384bbSLeorize  :Allowed Values: Any value in [0, 0xffffffff].
46203d384bbSLeorize  :Child Attributes: none
46303d384bbSLeorize
46403d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_DATA ("data")
46503d384bbSLeorize  :Type: data
46603d384bbSLeorize  :Value: Raw data of a file or attribute.
46703d384bbSLeorize  :Allowed Values: Any value.
46803d384bbSLeorize
46903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_SYMLINK_PATH ("symlink:path")
47003d384bbSLeorize  :Type: string
47103d384bbSLeorize  :Value: The path the symlink refers to.
47203d384bbSLeorize  :Allowed Values: Any valid symlink path.
47303d384bbSLeorize  :Default Value: Empty string.
47403d384bbSLeorize  :Child Attributes: none
47503d384bbSLeorize
47603d384bbSLeorizeTOC Attributes
47703d384bbSLeorize--------------
47803d384bbSLeorizeThe TOC can directly contain any number of attributes of the
47903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_DIRECTORY_ENTRY type, which in turn contain descendant
48003d384bbSLeorizeattributes as specified in the previous section. Any other attributes are
48103d384bbSLeorizeignored.
48203d384bbSLeorize
48303d384bbSLeorizeThe Package Format
48403d384bbSLeorize==================
48503d384bbSLeorizeThis section specifies how informative package attributes (package-name,
48603d384bbSLeorizeversion, provides, requires, ...) are stored in a HPKG file. It builds on top of
48703d384bbSLeorizethe container format, defining the types of attributes, their order, and allowed
48803d384bbSLeorizevalues.
48903d384bbSLeorize
49003d384bbSLeorizeE.g. a ".PackageInfo" file, containing a package description that is being
49103d384bbSLeorizeconverted into a package file::
49203d384bbSLeorize
49303d384bbSLeorize  name		mypackage
49403d384bbSLeorize  version	0.7.2-1
49503d384bbSLeorize  architecture	x86
49603d384bbSLeorize  summary	"is a very nice package"
49703d384bbSLeorize  description	"has lots of cool features\nand is written in MyC++"
49803d384bbSLeorize  vendor	"Me, Myself & I, Inc."
49903d384bbSLeorize  packager	"me@test.com"
50003d384bbSLeorize  copyrights	{ "(C) 2009-2011, Me, Myself & I, Inc." }
50103d384bbSLeorize  licenses	{ "Me, Myself & I Commercial License"; "MIT" }
50203d384bbSLeorize  provides {
50303d384bbSLeorize  	cmd:me
50403d384bbSLeorize  	lib:libmyself = 0.7
50503d384bbSLeorize  }
50603d384bbSLeorize  requires {
50703d384bbSLeorize  	haiku >= r1
50803d384bbSLeorize  	wget
50903d384bbSLeorize  }
51003d384bbSLeorize
51103d384bbSLeorizecould be represented by this attribute tree:
51203d384bbSLeorize
51303d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_NAME : string : "mypackage"
51403d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR : string : "0"
51503d384bbSLeorize
51603d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR : string : "7"
51703d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO : string : "2"
51803d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION : uint : 1
51903d384bbSLeorize
52003d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE : uint : 1
52103d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY : string : "is a very nice package"
52203d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION : string : "has lots of cool features
52303d384bbSLeorize  \nand is written in MyC++"
52403d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR : string : "Me, Myself & I, Inc."
52503d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER : string : "me@test.com"
52603d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT : string : "(C) 2009-2011, Me, Myself &
52703d384bbSLeorize  I, Inc."
52803d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE : string : "Me, Myself & I Commercial
52903d384bbSLeorize  License"
53003d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE : string : "MIT"
53103d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES : string : "cmd:me"
53203d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES : string : "lib:libmyself"
53303d384bbSLeorize
53403d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR : string : "0"
53503d384bbSLeorize
53603d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR : string : "7"
53703d384bbSLeorize
53803d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES : string : "haiku"
53903d384bbSLeorize
54003d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR : uint : 4
54103d384bbSLeorize  - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR : string : "r1"
54203d384bbSLeorize
54303d384bbSLeorize- B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES : string : "wget"
54403d384bbSLeorize
54503d384bbSLeorize.. _The Package Format/Attribute IDs:
54603d384bbSLeorize
54703d384bbSLeorizeAttribute IDs
54803d384bbSLeorize-------------
54903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_NAME ("package:name")
55003d384bbSLeorize  :Type: string
55103d384bbSLeorize  :Value: Name of the package.
55203d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+, with
55303d384bbSLeorize    <entity_name_char> being any character but '-', '/', '=', '!', '<', '>', or
55403d384bbSLeorize    whitespace.
55503d384bbSLeorize  :Child Attributes: none
55603d384bbSLeorize
55703d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_SUMMARY ("package:summary")
55803d384bbSLeorize  :Type: string
55903d384bbSLeorize  :Value: Short description of the package.
56003d384bbSLeorize  :Allowed Values: Any single-lined string.
56103d384bbSLeorize  :Child Attributes: none
56203d384bbSLeorize
56303d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_DESCRIPTION ("package:description")
56403d384bbSLeorize  :Type: string
56503d384bbSLeorize  :Value: Long description of the package.
56603d384bbSLeorize  :Allowed Values: Any string (may contain multiple lines).
56703d384bbSLeorize  :Child Attributes: none
56803d384bbSLeorize
56903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_VENDOR ("package:vendor")
57003d384bbSLeorize  :Type: string
57103d384bbSLeorize  :Value: Name of the person/organization that is publishing this package.
57203d384bbSLeorize  :Allowed Values: Any single-lined string.
57303d384bbSLeorize  :Child Attributes: none
57403d384bbSLeorize
57503d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_PACKAGER ("package:packager")
57603d384bbSLeorize  :Type: string
57703d384bbSLeorize  :Value: E-Mail address of person that created this package.
57803d384bbSLeorize  :Allowed Values: Any single-lined string, but e-mail preferred.
57903d384bbSLeorize  :Child Attributes: none
58003d384bbSLeorize
58103d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_BASE_PACKAGE ("package:base-package")
58203d384bbSLeorize  :Type: string
58303d384bbSLeorize  :Value: Name of the package that is the base package for this package. The
58403d384bbSLeorize    base package must also be listed as a requirement for this package (cf.
58503d384bbSLeorize    B_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES). The package manager shall ensure that
58603d384bbSLeorize    this package is installed in the same installation location as its base
58703d384bbSLeorize    package.
58803d384bbSLeorize  :Allowed Values: Valid package names.
58903d384bbSLeorize  :Child Attributes: none
59003d384bbSLeorize
59103d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_FLAGS ("package:flags")
59203d384bbSLeorize  :Type: uint
59303d384bbSLeorize  :Value: Set of boolean flags applying to package.
59403d384bbSLeorize  :Allowed Values: Any combination of the following.
59503d384bbSLeorize
59603d384bbSLeorize    = ============================== ==========================================
59703d384bbSLeorize    1 B_PACKAGE_FLAG_APPROVE_LICENSE this package's license requires approval
59803d384bbSLeorize                                     (i.e. must be shown to and acknowledged by
59903d384bbSLeorize                                     user before installation)
60003d384bbSLeorize    2 B_PACKAGE_FLAG_SYSTEM_PACKAGE  this is a system package (i.e. lives under
60103d384bbSLeorize                                     /boot/system)
60203d384bbSLeorize    = ============================== ==========================================
60303d384bbSLeorize
60403d384bbSLeorize  :Default Value: 0
60503d384bbSLeorize  :Child Attributes: none
60603d384bbSLeorize
60703d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_ARCHITECTURE ("package:architecture")
60803d384bbSLeorize  :Type: uint
60903d384bbSLeorize  :Value: System architecture this package was built for.
61003d384bbSLeorize  :Allowed Values:
61103d384bbSLeorize
61203d384bbSLeorize    = =============================== =========================================
61303d384bbSLeorize    0 B_PACKAGE_ARCHITECTURE_ANY      this package doesn't depend on the system
61403d384bbSLeorize                                      architecture
61503d384bbSLeorize    1 B_PACKAGE_ARCHITECTURE_X86      x86, 32-bit, built with gcc4
61603d384bbSLeorize    2 B_PACKAGE_ARCHITECTURE_X86_GCC2 x86, 32-bit, built with gcc2
61703d384bbSLeorize    3 B_PACKAGE_ARCHITECTURE_SOURCE   source code, doesn't depend on the system
61803d384bbSLeorize                                      architecture
61903d384bbSLeorize    4 B_PACKAGE_ARCHITECTURE_X86_64   x86-64
62003d384bbSLeorize    5 B_PACKAGE_ARCHITECTURE_PPC      PowerPC
62103d384bbSLeorize    6 B_PACKAGE_ARCHITECTURE_ARM      ARM
62203d384bbSLeorize    7 B_PACKAGE_ARCHITECTURE_M68K     m68k
6235629675aSAdrien Destugues    8 B_PACKAGE_ARCHITECTURE_SPARC    sparc
62403d384bbSLeorize    = =============================== =========================================
62503d384bbSLeorize
62603d384bbSLeorize  :Child Attributes: none
62703d384bbSLeorize
62803d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR ("package:version.major")
62903d384bbSLeorize :Type: string
63003d384bbSLeorize  :Value: Major (first) part of package version.
63103d384bbSLeorize  :Allowed Values: Any single-lined string, composed of <alphanum_underline>
63203d384bbSLeorize  :Child Attributes:
63303d384bbSLeorize
63403d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR: The minor part of the package
63503d384bbSLeorize     version.
63603d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO: The micro part of the package
63703d384bbSLeorize     version.
63803d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE: The pre-release part of
63903d384bbSLeorize     the package version.
64003d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION: The revision part of the
64103d384bbSLeorize     package version.
64203d384bbSLeorize
64303d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR ("package:version.minor")
64403d384bbSLeorize :Type: string
64503d384bbSLeorize :Value: Minor (second) part of package version.
64603d384bbSLeorize :Allowed Values: Any single-lined string, composed of <alphanum_underline>.
64703d384bbSLeorize :Child Attributes: none
64803d384bbSLeorize
64903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO ("package:version.micro")
65003d384bbSLeorize  :Type: string
65103d384bbSLeorize  :Value: Micro (third) part of package version.
65203d384bbSLeorize  :Allowed Values: Any single-lined string, composed of
65303d384bbSLeorize    <alphanum_underline_dot>.
65403d384bbSLeorize  :Child Attributes: none
65503d384bbSLeorize
65603d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE ("package:version.prerelease")
65703d384bbSLeorize  :Type: string
65803d384bbSLeorize  :Value: Pre-release (fourth) part of package version. Typically something like
65903d384bbSLeorize    "alpha1", "beta2", "rc3".
66003d384bbSLeorize  :Allowed Values: Any single-lined string, composed of
66103d384bbSLeorize    <alphanum_underline_dot>.
66203d384bbSLeorize  :Child Attributes: none
66303d384bbSLeorize
66403d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION ("package:version.revision")
66503d384bbSLeorize  :Type: uint
66603d384bbSLeorize  :Value: Revision (fifth) part of package version.
66703d384bbSLeorize  :Allowed Values: Any integer greater than 0.
66803d384bbSLeorize  :Child Attributes: none
66903d384bbSLeorize
67003d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT ("package:copyright")
67103d384bbSLeorize  :Type: string
67203d384bbSLeorize  :Value: Copyright applying to the software contained in this package.
67303d384bbSLeorize  :Allowed Values: Any (preferably single-lined) string.
67403d384bbSLeorize  :Child Attributes: none
67503d384bbSLeorize
67603d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE ("package:license")
67703d384bbSLeorize  :Type: string
67803d384bbSLeorize  :Value: Name of license applying to the software contained in this package.
67903d384bbSLeorize  :Allowed Values: Any single-lined string.
68003d384bbSLeorize  :Child Attributes: none
68103d384bbSLeorize
68203d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_URL ("package:url")
68303d384bbSLeorize  :Type: string
68403d384bbSLeorize  :Value: URL of the packaged software's project home page.
68503d384bbSLeorize  :Allowed Values: A regular URL or an email-like named URL (e.g.
68603d384bbSLeorize    "Project Foo <http://foo.example.com>").
68703d384bbSLeorize  :Child Attributes: none
68803d384bbSLeorize
68903d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_SOURCE_URL ("package:source-url")
69003d384bbSLeorize  :Type: string
69103d384bbSLeorize  :Value: URL of the packaged software's source code or build instructions.
69203d384bbSLeorize  :Allowed Values: A regular URL or an email-like named URL (e.g.
69303d384bbSLeorize    "Project Foo <http://foo.example.com>").
69403d384bbSLeorize  :Child Attributes: none
69503d384bbSLeorize
69603d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES ("package:provides")
69703d384bbSLeorize  :Type: string
69803d384bbSLeorize  :Value: Name of a (optionally typed) entity that is being provided by this
69903d384bbSLeorize    package.
70003d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+.
70103d384bbSLeorize  :Child Attributes:
70203d384bbSLeorize
70303d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR: The major part of the resolvable
70403d384bbSLeorize     version.
70503d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_COMPATIBLE: The major part of the
70603d384bbSLeorize     resolvable compatible version.
70703d384bbSLeorize
70803d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES_COMPATIBLE ("package:provides.compatible")
70903d384bbSLeorize  :Type: string
71003d384bbSLeorize  :Value: Major (first) part of the resolvable compatible version, structurally
71103d384bbSLeorize    identical to B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR.
71203d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+.
71303d384bbSLeorize  :Child Attributes:
71403d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR: The minor part of the resolvable
71503d384bbSLeorize     compatible version.
71603d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO: The micro part of the resolvable
71703d384bbSLeorize     compatible version.
71803d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE: The pre-release part of
71903d384bbSLeorize     the resolvable compatible version.
72003d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION: The revision part of the
72103d384bbSLeorize     resolvable compatible version.
72203d384bbSLeorize
72303d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_REQUIRES ("package:requires")
72403d384bbSLeorize  :Type: string
72503d384bbSLeorize  :Value: Name of an entity that is required by this package (and hopefully
72603d384bbSLeorize    being provided by another).
72703d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+.
72803d384bbSLeorize  :Child Attributes:
72903d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR: The resolvable operator as
73003d384bbSLeorize     int.
73103d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR: The major part of the resolvable
73203d384bbSLeorize     version.
73303d384bbSLeorize
73403d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR ("package:resolvable.operator")
73503d384bbSLeorize  :Type: uint
73603d384bbSLeorize  :Value: Comparison operator for versions.
73703d384bbSLeorize  :Allowed Values:
73803d384bbSLeorize
73903d384bbSLeorize    = ===================================== ===================================
74003d384bbSLeorize    0 B_PACKAGE_RESOLVABLE_OP_LESS          less than the specified version
74103d384bbSLeorize    1 B_PACKAGE_RESOLVABLE_OP_LESS_EQUAL    less than or equal to the specified
74203d384bbSLeorize                                            version
74303d384bbSLeorize    2 B_PACKAGE_RESOLVABLE_OP_EQUAL         equal to the specified version
74403d384bbSLeorize    3 B_PACKAGE_RESOLVABLE_OP_NOT_EQUAL     not equal to the specified version
74503d384bbSLeorize    4 B_PACKAGE_RESOLVABLE_OP_GREATER_EQUAL greater than the specified version
74603d384bbSLeorize    5 B_PACKAGE_RESOLVABLE_OP_GREATER       greater than or equal to the
74703d384bbSLeorize                                            specified version
74803d384bbSLeorize    = ===================================== ===================================
74903d384bbSLeorize
75003d384bbSLeorize  :Child Attributes: none
75103d384bbSLeorize
75203d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_SUPPLEMENTS ("package:supplements")
75303d384bbSLeorize  :Type: string
75403d384bbSLeorize  :Value: Name of an entity that is supplemented by this package (i.e. this
75503d384bbSLeorize    package will automatically be selected for installation if the supplemented
75603d384bbSLeorize    resolvables are already installed).
75703d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+.
75803d384bbSLeorize  :Child Attributes:
75903d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR: The resolvable operator as
76003d384bbSLeorize     int.
76103d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR: The major part of the resolvable
76203d384bbSLeorize     version.
76303d384bbSLeorize
76403d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_CONFLICTS ("package:conflicts")
76503d384bbSLeorize  :Type: string
76603d384bbSLeorize  :Value: Name of an entity that this package conflicts with (i.e. only one of
76703d384bbSLeorize    both can be installed at any time).
76803d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+.
76903d384bbSLeorize  :Child Attributes:
77003d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR: The resolvable operator as
77103d384bbSLeorize     int.
77203d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR: The major part of the resolvable
77303d384bbSLeorize     version.
77403d384bbSLeorize
77503d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_FRESHENS ("package:freshens")
77603d384bbSLeorize  :Type: string
77703d384bbSLeorize  :Value: Name of an entity that is being freshened by this package (i.e. this
77803d384bbSLeorize    package will patch one or more files of the package that provide this
77903d384bbSLeorize    resolvable).
78003d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+.
78103d384bbSLeorize  :Child Attributes:
78203d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_RESOLVABLE_OPERATOR: The resolvable operator as
78303d384bbSLeorize     int.
78403d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR: The major part of the resolvable
78503d384bbSLeorize     version.
78603d384bbSLeorize
78703d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_REPLACES ("package:replaces")
78803d384bbSLeorize  :Type: string
78903d384bbSLeorize  :Value: Name of an entity that is being replaced by this package (used if the
79003d384bbSLeorize    name of a package changes, or if a package has been split).
79103d384bbSLeorize  :Allowed Values: Any string matching <entity_name_char>+.
79203d384bbSLeorize  :Child Attributes: none
79303d384bbSLeorize
79403d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_CHECKSUM ("package:checksum")
79503d384bbSLeorize  :Type: string
79603d384bbSLeorize  :Value: SHA256-chechsum of this package, in hexdump format. N.B.: this
79703d384bbSLeorize    attribute can only be found in package repository files, not in package
79803d384bbSLeorize    files.
79903d384bbSLeorize  :Allowed Values: 64-bytes of hexdump.
80003d384bbSLeorize  :Child Attributes: none
80103d384bbSLeorize
80203d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_GLOBAL_WRITABLE_FILE ("package:global-writable-file")
80303d384bbSLeorize  :Type: string
80403d384bbSLeorize  :Value: Relative path of a global writable file either included in the package
80503d384bbSLeorize    or created by the included software. If the file is included in the package,
80603d384bbSLeorize    it will be installed upon activation. In this case the attribute must
80703d384bbSLeorize    contain a B_HPKG_ATTRIBUTE_ID_PACKAGE_WRITABLE_FILE_UPDATE_TYPE child
80803d384bbSLeorize    attribute. The file may actually be a directory, which is indicated by the
80903d384bbSLeorize    B_HPKG_ATTRIBUTE_ID_PACKAGE_IS_WRITABLE_DIRECTORY child attribute.
81003d384bbSLeorize  :Allowed Values: Installation location relative path (e.g. "settings/...").
81103d384bbSLeorize  :Child Attributes:
81203d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_PACKAGE_WRITABLE_FILE_UPDATE_TYPE: Specifies what to do
81303d384bbSLeorize      with the writable file on package update.
81403d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_PACKAGE_IS_WRITABLE_DIRECTORY: Specifies whether the
81503d384bbSLeorize      file is actually a directory.
81603d384bbSLeorize
81703d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_USER_SETTINGS_FILE ("package:user-settings-file")
81803d384bbSLeorize  :Type: string
81903d384bbSLeorize  :Value: Relative path of a user settings file created by the included software
82003d384bbSLeorize    or required by the software to be created by the user. The file may actually
82103d384bbSLeorize    be a directory, which is indicated by the
82203d384bbSLeorize    B_HPKG_ATTRIBUTE_ID_PACKAGE_IS_WRITABLE_DIRECTORY child attribute.
82303d384bbSLeorize  :Allowed Values: Installation location relative path (i.e. "settings/...").
82403d384bbSLeorize  :Child Attributes:
82503d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_PACKAGE_SETTINGS_FILE_TEMPLATE: A template for the
82603d384bbSLeorize      settings file.
82703d384bbSLeorize    - B_HPKG_ATTRIBUTE_ID_PACKAGE_IS_WRITABLE_DIRECTORY: Specifies whether the
82803d384bbSLeorize      file is actually a directory.
82903d384bbSLeorize
83003d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_WRITABLE_FILE_UPDATE_TYPE ("package:writable-file-update-type")
83103d384bbSLeorize  :Type: uint
83203d384bbSLeorize  :Value: Specifies what to do on package update when the writable file provided
83303d384bbSLeorize    by the package has been changed by the user.
83403d384bbSLeorize  :Allowed Values:
83503d384bbSLeorize
83603d384bbSLeorize    = ====================================== ==================================
83703d384bbSLeorize    0 B_WRITABLE_FILE_UPDATE_TYPE_KEEP_OLD   the old file shall be kept
83803d384bbSLeorize    1 B_WRITABLE_FILE_UPDATE_TYPE_MANUAL     the old file needs to be updated
83903d384bbSLeorize                                             manually
84003d384bbSLeorize    2 B_WRITABLE_FILE_UPDATE_TYPE_AUTO_MERGE an automatic three-way merge shall
84103d384bbSLeorize                                             be attempted
84203d384bbSLeorize    = ====================================== ==================================
84303d384bbSLeorize
84403d384bbSLeorize  :Child Attributes: none
84503d384bbSLeorize
84603d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_IS_WRITABLE_DIRECTORY ("package:is-writable-directory")
84703d384bbSLeorize  :Type: uint
84803d384bbSLeorize  :Value: Specifies whether the parent global writable file or user settings file attribute actually refers to a directory.
84903d384bbSLeorize  :Allowed Values:
85003d384bbSLeorize
85103d384bbSLeorize    = ===========================================
85203d384bbSLeorize    0 The parent attribute refers to a file.
85303d384bbSLeorize    1 The parent attribute refers to a directory.
85403d384bbSLeorize    = ===========================================
85503d384bbSLeorize
85603d384bbSLeorize  :Child Attributes: none
85703d384bbSLeorize
85803d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_SETTINGS_FILE_TEMPLATE ("package:settings-file-template")
85903d384bbSLeorize  :Type: string
86003d384bbSLeorize  :Value: Relative path of an included template file for the user settings file.
86103d384bbSLeorize  :Allowed Values: Installation location relative path of a file included in the
86203d384bbSLeorize    package.
86303d384bbSLeorize  :Child Attributes: none
86403d384bbSLeorize
86503d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_USER ("package:user")
86603d384bbSLeorize  :Type: string
86703d384bbSLeorize  :Value: Name of a user required by the package. Upon package activation the
86803d384bbSLeorize    user will be created, if necessary.
86903d384bbSLeorize  :Allowed Values: Any valid user name, i.e. must be non-empty composed of
87003d384bbSLeorize    <alphanum_underline>.
87103d384bbSLeorize  :Child Attributes:
87203d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_USER_REAL_NAME: The user's real name.
87303d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_USER_HOME: The user's home directory.
87403d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_USER_SHELL: The user's shell.
87503d384bbSLeorize   - B_HPKG_ATTRIBUTE_ID_PACKAGE_USER_GROUP: The user's group(s).
87603d384bbSLeorize
87703d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_USER_REAL_NAME ("package:user.real-name")
87803d384bbSLeorize  :Type: string
87903d384bbSLeorize  :Value: The real name of the user.
88003d384bbSLeorize  :Allowed Values: Any string.
88103d384bbSLeorize  :Default Value: The user name.
88203d384bbSLeorize  :Child Attributes: none
88303d384bbSLeorize
88403d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_USER_HOME ("package:user.home")
88503d384bbSLeorize  :Type: string
88603d384bbSLeorize  :Value: The path to the home directory of the user.
88703d384bbSLeorize  :Allowed Values: Any valid path.
88803d384bbSLeorize  :Child Attributes: none
88903d384bbSLeorize
89003d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_USER_SHELL ("package:user.shell")
89103d384bbSLeorize  :Type: string
89203d384bbSLeorize  :Value: The path to the shell to be used for the user.
89303d384bbSLeorize  :Allowed Values: Any valid path.
89403d384bbSLeorize  :Default Value: "/bin/bash".
89503d384bbSLeorize  :Child Attributes: none
89603d384bbSLeorize
89703d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_USER_GROUP ("package:user.group")
89803d384bbSLeorize  :Type: string
89903d384bbSLeorize  :Value: A group the user belongs to. At least one must be specified.
90003d384bbSLeorize  :Allowed Values: Any valid group name, i.e. must be non-empty composed of
90103d384bbSLeorize    <alphanum_underline>.
90203d384bbSLeorize  :Default Value: The default group for users.
90303d384bbSLeorize  :Child Attributes: none
90403d384bbSLeorize
90503d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_GROUP ("package:group")
90603d384bbSLeorize  :Type: string
90703d384bbSLeorize  :Value: Name of a group required by the package. Upon package activation the
90803d384bbSLeorize    group will be created, if necessary.
90903d384bbSLeorize  :Allowed Values: Any valid group name, i.e. must be non-empty composed of
91003d384bbSLeorize    <alphanum_underline>.
91103d384bbSLeorize  :Child Attributes: none
91203d384bbSLeorize
91303d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE_POST_INSTALL_SCRIPT ("package:post-install-script")
91403d384bbSLeorize  :Type: string
91503d384bbSLeorize  :Value: Relative path of a script that shall be executed after package
91603d384bbSLeorize    activation.
91703d384bbSLeorize  :Allowed Values: Installation location relative path of a file included in the
918*a22fa0c9SAlexander G. M. Smith    package.  Must start with "boot/post-install/", so besides being run after
919*a22fa0c9SAlexander G. M. Smith    package installation, it also gets run on the first boot after the OS is
920*a22fa0c9SAlexander G. M. Smith    installed.
921*a22fa0c9SAlexander G. M. Smith  :Child Attributes: none
922*a22fa0c9SAlexander G. M. Smith
923*a22fa0c9SAlexander G. M. SmithB_HPKG_ATTRIBUTE_ID_PACKAGE_PRE_UNINSTALL_SCRIPT ("package:pre-uninstall-script")
924*a22fa0c9SAlexander G. M. Smith  :Type: string
925*a22fa0c9SAlexander G. M. Smith  :Value: Relative path of a script that shall be executed before package
926*a22fa0c9SAlexander G. M. Smith    deactivation.
927*a22fa0c9SAlexander G. M. Smith  :Allowed Values: Installation location relative path of a file included in
928*a22fa0c9SAlexander G. M. Smith    the package.  For consistency, it is recommended to start with
929*a22fa0c9SAlexander G. M. Smith    "boot/pre-uninstall/".
93003d384bbSLeorize  :Child Attributes: none
93103d384bbSLeorize
93203d384bbSLeorizeHaiku Package Repository Format
93303d384bbSLeorize===============================
93403d384bbSLeorizeVery similar to the package format, there's a Haiku Package Repository (HPKR)
93503d384bbSLeorizefile format. Such a file contains informative attributes about the package
93603d384bbSLeorizerepository and package attributes for all packages contained in the repository.
93703d384bbSLeorizeHowever, this format does not contain any files.
93803d384bbSLeorize
93903d384bbSLeorizeTwo stacked format layers can be identified:
94003d384bbSLeorize
94103d384bbSLeorize- A generic container format for structured data.
94203d384bbSLeorize- A package format, extending the archive format with attributes for package
94303d384bbSLeorize  management.
94403d384bbSLeorize
94503d384bbSLeorizeThe Data Container Format
94603d384bbSLeorize-------------------------
94703d384bbSLeorizeA HPKR file consists of three sections:
94803d384bbSLeorize
94903d384bbSLeorizeHeader
95003d384bbSLeorize  Identifies the file as HPKR file and provides access to the other sections.
95103d384bbSLeorize
95203d384bbSLeorizeHeap
95303d384bbSLeorize  Contains the next two sections.
95403d384bbSLeorize
95503d384bbSLeorizeRepository Info
95603d384bbSLeorize  A section containing an archived BMessage of a BRepositoryInfo object.
95703d384bbSLeorize
95803d384bbSLeorizePackage Attributes
95903d384bbSLeorize  A section just like the package attributes section of the HPKG, only that this
96003d384bbSLeorize  section contains the package attributes of all the packages contained in the
96103d384bbSLeorize  repository (not just one).
96203d384bbSLeorize
96303d384bbSLeorizeThe Repository Info and Package Attributes sections aren't really separate
96403d384bbSLeorizesections, as they are stored at the end of the heap.
96503d384bbSLeorize
96603d384bbSLeorizeHeader
96703d384bbSLeorize``````
96803d384bbSLeorizeThe header has the following structure::
96903d384bbSLeorize
97003d384bbSLeorize  struct hpkg_repo_header {
97103d384bbSLeorize  	uint32	magic;
97203d384bbSLeorize  	uint16	header_size;
97303d384bbSLeorize  	uint16	version;
97403d384bbSLeorize  	uint64	total_size;
97503d384bbSLeorize  	uint16	minor_version;
97603d384bbSLeorize
97703d384bbSLeorize  	// heap
97803d384bbSLeorize  	uint16	heap_compression;
97903d384bbSLeorize  	uint32	heap_chunk_size;
98003d384bbSLeorize  	uint64	heap_size_compressed;
98103d384bbSLeorize  	uint64	heap_size_uncompressed;
98203d384bbSLeorize
98303d384bbSLeorize  	// repository info section
98403d384bbSLeorize  	uint32	info_length;
98503d384bbSLeorize  	uint32	reserved1;
98603d384bbSLeorize
98703d384bbSLeorize  	// package attributes section
98803d384bbSLeorize  	uint64	packages_length;
98903d384bbSLeorize  	uint64	packages_strings_length;
99003d384bbSLeorize  	uint64	packages_strings_count;
99103d384bbSLeorize  };
99203d384bbSLeorize
99303d384bbSLeorizemagic
99403d384bbSLeorize  The string 'hpkr' (B_HPKG_REPO_MAGIC).
99503d384bbSLeorize
99603d384bbSLeorizeheader_size
99703d384bbSLeorize  The size of the header. This is also the absolute offset of the heap.
99803d384bbSLeorize
99903d384bbSLeorizeversion
100003d384bbSLeorize  The version of the HPKR format the file conforms to. The current version is
100103d384bbSLeorize  2 (B_HPKG_REPO_VERSION).
100203d384bbSLeorize
100303d384bbSLeorizetotal_size
100403d384bbSLeorize  The total file size.
100503d384bbSLeorize
100603d384bbSLeorizeminor_version
100703d384bbSLeorize  The minor version of the HPKR format the file conforms to. The current minor
1008*a22fa0c9SAlexander G. M. Smith  version is 1 (B_HPKG_REPO_MINOR_VERSION). Additions of new attributes to the
100903d384bbSLeorize  attributes section should generally only increment the minor version. When a
101003d384bbSLeorize  file with a greater minor version is encountered, the reader should ignore
101103d384bbSLeorize  unknown attributes.
101203d384bbSLeorize
101303d384bbSLeorize..
101403d384bbSLeorize
101503d384bbSLeorizeheap_compression
101603d384bbSLeorize  Compression format used for the heap.
101703d384bbSLeorize
101803d384bbSLeorizeheap_chunk_size
101903d384bbSLeorize  The size of the chunks the uncompressed heap data are divided into.
102003d384bbSLeorize
102103d384bbSLeorizeheap_size_compressed
102203d384bbSLeorize  The compressed size of the heap. This includes all administrative data (the
102303d384bbSLeorize  chunk size array).
102403d384bbSLeorize
102503d384bbSLeorizeheap_size_uncompressed
102603d384bbSLeorize  The uncompressed size of the heap. This is only the size of the raw data
102703d384bbSLeorize  (including the repository info and attributes section), not including
102803d384bbSLeorize  administrative data (the chunk size array).
102903d384bbSLeorize
103003d384bbSLeorize..
103103d384bbSLeorize
103203d384bbSLeorizeinfo_length
103303d384bbSLeorize  The uncompressed size of the repository info section.
103403d384bbSLeorize
103503d384bbSLeorize..
103603d384bbSLeorize
103703d384bbSLeorizereserved1
103803d384bbSLeorize  Reserved for later use.
103903d384bbSLeorize
104003d384bbSLeorize..
104103d384bbSLeorize
104203d384bbSLeorizepackages_length
104303d384bbSLeorize  The uncompressed size of the package attributes section.
104403d384bbSLeorize
104503d384bbSLeorizepackages_strings_length
104603d384bbSLeorize  The size of the strings subsection of the package attributes section.
104703d384bbSLeorize
104803d384bbSLeorizepackages_strings_count
104903d384bbSLeorize  The number of entries in the strings subsection of the package attributes
105003d384bbSLeorize  section.
105103d384bbSLeorize
105203d384bbSLeorizeAttribute IDs
105303d384bbSLeorize-------------
105403d384bbSLeorizeThe package repository format defines only the top-level attribute ID
105503d384bbSLeorizeB_HPKG_ATTRIBUTE_ID_PACKAGE. An attribute with that ID represents a package. Its
105603d384bbSLeorizechild attributes specify the various meta information for the package as defined
105703d384bbSLeorizein the `The Package Format/Attribute IDs`_ section.
105803d384bbSLeorize
1059