]> Cypherpunks.ru repositories - goredo.git/blob - doc/state.texi
Download link for 2.6.2 release
[goredo.git] / doc / state.texi
1 @node State
2 @cindex storage
3 @cindex state
4 @unnumbered State
5
6 Dependency and build state is kept inside @file{.redo} subdirectory in
7 each directory related the build. Each corresponding target has its own,
8 recreated with every rebuild, binary @file{.dep} file.
9
10 It starts with the header:
11
12 @verbatim
13 "GOREDO" || 0x01 || BuildUUID
14 @end verbatim
15
16 @code{0x01} is format's version number. @code{BuildUUID} is 128-bit UUID.
17
18 After the header comes concatenation of length-prefixed chunks. Length
19 is the length of the whole chunk, including the size of the encoded
20 length itself. It is 16-bit big-endian integer. After the length comes
21 single byte type of the chunk:
22
23 @table @asis
24
25 @item ifcreate
26
27 @verbatim
28 LEN || 0x01 || target
29 @end verbatim
30
31 @code{target} is UTF-8 encoded target's name.
32
33 @item ifchange
34
35 @verbatim
36 LEN || 0x02 ||
37     size || inodeNum ||
38     ctimeSec || ctimeNsec ||
39     mtimeSec || mtimeNsec ||
40     hash || target
41 @end verbatim
42
43 @code{target} is UTF-8 encoded target's name.
44 @code{hash} is 256-bit BLAKE3 hash.
45 All other inode-related fields are 64-bit big-endian integers.
46
47 @item always
48
49 @verbatim
50 LEN || 0x03
51 @end verbatim
52
53 @item stamp
54
55 @verbatim
56 LEN || 0x04 || hash
57 @end verbatim
58
59 @code{hash} is 256-bit BLAKE3 hash.
60
61 @item ifchange-nonexistent
62
63 @verbatim
64 LEN || 0x05 || target
65 @end verbatim
66
67 @code{target} is UTF-8 encoded target's name.
68
69 @end table
70
71 That @file{.dep} file can be converted to human-readable
72 @url{https://www.gnu.org/software/recutils/, recfile} format.
73 For example:
74
75 @example
76 Build: 80143f04-bfff-4673-950c-081d712f573d
77
78 Type: ifcreate
79 Target: foo.o.do
80
81 Type: ifchange
82 Target: default.o.do
83 Size: 123
84 InodeNum: 2345
85 CtimeSec: 1605721341
86 CtimeNsec: 253305000
87 MtimeSec: 1645606823
88 MtimeNsec: 369936700
89 Hash: f4929732f96f11e6d4ebe94536b5edef426d00ed0146853e37a87f4295e18eda
90
91 Type: always
92
93 Type: stamp
94 Hash: 5bbdf635932cb16b9127e69b6f3872577efed338f0a4ab6f2c7ca3df6ce50cc9
95 @end example
96
97 And its schema definition:
98 @verbatiminclude ../dep.rec