1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
.\" $OpenBSD: package.5,v 1.8 2009/04/14 17:53:58 espie Exp $
.\" Copyright (c) 2005-2006 Marc Espie <espie@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.Dd $Mdocdate: April 14 2009 $
.Dt PACKAGE 5
.Os
.Sh NAME
.Nm package
.Nd format for
.Ox
binary packages
.Sh DESCRIPTION
Binary packages for
.Ox
can be created using
.Xr pkg_create 1
and
.Xr pkg_merge 1 ,
and are usually manipulated using
.Xr pkg_add 1 ,
.Xr pkg_merge 1 ,
.Xr pkg_mklocatedb 1 ,
or
.Xr pkg_info 1 .
.Pp
The basic underlying format is an archive following the ustar specification
that can be handled with
.Xr tar 1
and compressed using
.Xr gzip 1 .
.Pp
Package names always end in
.Dq .tgz ;
the file name itself should conform to
.Xr packages-specs 7 .
.Pp
Note that the base distribution tarballs of
.Ox
(e.g.\&
.Pa baseXXX.tgz ,
.Pa compXXX.tgz ,
\&...) are not binary packages fit for
.Xr pkg_add 1 .
.Pp
All types of archive contents can be present in a package,
including files, directories, hardlinks, symlinks, fifos, block and character
devices.
.Pp
A special extension to the format, dubbed fat packages, is described in
the next section.
.Pp
In order to allow just-in-time extraction,
packages always begin with a table of contents, named
.Pa +CONTENTS .
This table of contents can be read using the API described in
.Xr OpenBSD::PackingList 3p .
.Pp
All the remaining information in the archive should be referenced in
the packing-list, including all relevant information: symlinks destinations,
special permissions, and file owners.
See
.Xr pkg_create 1
for annotation details.
.Pp
This table of contents is always followed by a few special files, some of
which are optional: the package description (+DESC), an installation script
(+INSTALL), a display message (+DISPLAY), etc.
.Pp
The ustar format has some limitations with respect to file names.
Accordingly, the package tools will replace very long names with
.Pa LongName#n
and long link names with
.Pa LongLink#n .
The packing-list will hold the real file names, and the package tools
will reconstitute the correct names behind the scenes.
.Sh PACKAGE SIGNATURES
All information within a package is checksummed, using SHA256 since
.Ox 4.4 .
During creation and creation, meta-information, such as file owners and
permissions, are also checked: any important stuff that isn't recorded
in the packing-list is an error.
.Pp
Packing-lists can be signed. If a signature is found, then it will be checked
during installation, and failure to verify will prevent the package from
installing correctly.
Currently, only x509-style signatures are supported.
They rely on a certificate authority file being present as
.Pa /etc/ssl/pkgca.pem
and all signatures will be checked against it.
Once the packing-list signature is checked, all individual packing elements
will be checksummed, resulting in a
.Sq just-in-time
signature checking.
.Sh FAT PACKAGES DESCRIPTION
The
.Xr pkg_merge 1
command can create fat packages, which coalesce several normal packages in
a single ustar archive, by interleaving their contents.
.Pp
Other tools, such as
.Xr pkg_add 1 ,
are aware of fat packages and can handle them transparently.
.Pp
In a fat package, every item has a small prefix that identifies the
original package.
For instance, after merging two packages, the package will usually
begin with
.Pa a/+CONTENTS
and
.Pa b/+CONTENTS .
Individual items will then begin with
.Pa ab/file ,
for a file common to both packages;
.Pa a/file
for a file belonging to the first package;
and
.Pa b/file
for a file belonging to the second package.
.Sh SEE ALSO
.Xr pkg_add 1 ,
.Xr pkg_create 1 ,
.Xr pkg_info 1 ,
.Xr pkg_merge 1 ,
.Xr packages 7 ,
.Xr packages-specs 7
.Sh STANDARDS
Packages are valid gzip'ed ustar archives that can be extracted using
.Xr tar 1 .
In particular, hardlink names should be valid, and all items will
extract to different names.
However, it may be a bit difficult to make sense of the package contents
without peeking at the packing-list.
|