1 .TH XPAK 5 "March 2009" "Portage VERSION" "Portage"
3 xpak \- The XPAK Data Format
7 every offset or length(len) value in this documentation will be an unsigned
8 32bit integer in big endian byte order(32bit unsigned big int or uint32(big)
11 All strings, mentioned in this documentation are ASCII encoded, and not
14 The actual values of the individual xpak entries are stored as Strings.
17 The vertical bars '|' are not part of the file format, they are merely used to
18 illustrate how the offset values apply to the data.
25 <tar>|< xpak >|<xpak_offset>"STOP"
28 "XPAKPACK"<index_len><data_len><index><data>"XPAKSTOP"
31 |<-------------index_len------------->|
33 |<index1><index2><index3><index4><...>|
38 <name_len>|< name >|<data_offset><data_len>
41 |<--------------data_len------------->|
43 |<-dataN_offset->|<-dataN_len->|
45 |< data >|< data_N >|<data>|
48 Every gentoo binary package has a xpak attached to it which contains build
49 time information like the use flags it was built with, the ebuild it was
50 built from, the environmental variables, CFLAGs, CXXFLAGs, ....
54 If you look at a gentoo binary package (binpkg) with a hex-editor you'll
55 notice the behinf the data, which belongs to the tarball you find a binary
58 , an offset which holds the bytes from the start of the
60 to the end of the file -
62 and finally the String
66 <tbz2>|<---xpak---->|<xpak_offset>"STOP"|
70 archive, and the attached
79 If we read the offset value and count
81 bytes backwards from the start of
83 , we have found the start of the
85 Block which starts with the String
87 This xpak block consists of the string
93 , the length of the data block -
97 bytes long binary blob with the
101 bytes long binary blob with the
107 |<index_len>|<data_len>|
108 "XPAKPACK"<index_len><data_len>|<--index-->|<--data-->|"XPAKSTOP"
116 bytes after the end of
118 for the index block and then cut out the next
120 bytes for the data block. If we have done everything right up to this point,
121 the following bytes would be the ASCII formatted string
125 The actual data is truncated into one big block - so if we want to read it we
126 need the actual positions of each information in this big data block, this
127 information can be obtained using the indices which are stored in the
132 The index block consists of several truncated index blocks:
134 |<-----------------------index_len---------------------->|
135 |<index1><index2><index3><index4><index5><index6><index7>|
139 block holds all information we need to find the data we want in the
141 block. It consists of truncated index elements with a length
143 Each of those index elements stands for one information in the data block and
144 consists of the length of its name (
148 bytes long string (the Name of the data block), this index belongs to, the
153 ) and the length of that data block (
158 <name_len>|<--name-->|<dataN_offset><dataN_len>
161 the data block contains truncated data blocks with a total length of
165 |<------------------------data_len------------------------>|
166 |<data1><data2><data3><data4><data5><data6><data7><data...>|
170 bytes long and consists of truncated data.
172 To select one data element, we need the
179 , if we have those we can count
181 bytes from the start of the
183 block, and then cut out the next
185 bytes. there we got our data block:
187 |<-----dataN_offset----->|<--dataN_len->|
188 |<data1data2data3data...>|<data-we-want>|
190 Lars Hartmann <lars@chaotika.org>