cookutils view doc/cookutils.en.html @ rev 258

cooker.cgi: syntax_highlighter should dehtmlize first
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 31 18:27:32 2011 +0200 (2011-05-31)
parents 77037ae33127
children 677fbd5cf708
line source
1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>Cookutils Documentation</title>
5 <meta charset="utf-8" />
6 <link rel="stylesheet" type="text/css" href="style.css" />
7 </head>
8 <body>
10 <div id="header">
11 <h1>Cookutils Documentation</h1>
12 </div>
14 <!-- Start content -->
15 <div id="content">
17 <h2>SliTaz Cook &amp; Cooker</h2>
19 <p>
20 The SliTaz Cookutils provide tools and utils to help build SliTaz packages. They
21 are easy to use and learn, fast and light. You will be able to create SliTaz
22 packages in a few commands. The cookutils provide the 'cook' utility and the
23 <a href="#cooker">Cooker</a>.
24 </p>
25 <p>
26 Cook lets you compile and create a package, provide a log file and check the
27 receipt/package quality. The Cooker is a build bot with more automation
28 and can be used as a frontend to cook since it provides a CGI/web interface
29 which lets you view cook logs in a nice and colored way. Cook and the Cooker
30 use the same DB files and wok, they both share <a href="#blocked">blocked</a>
31 and broken packages as well as any activity.
32 </p>
34 <h3>Cook usage</h3>
35 <p>
36 Cook provides a small built-in help usage that you can display with the
37 command 'usage'. It also has some options to perform special tasks on
38 a package before cooking it or afterwards. To get help and usage:
39 </p>
40 <pre>
41 # cook usage
42 </pre>
44 <h3>Howto</h3>
45 <p>
46 The first thing you will have to do before building packages is setup
47 your environment. The 2 recommended ways of working: cook directly on host
48 or cook in chroot to protect your host. In the case you want to work in a
49 chroot you can install and use Tazdev to create one and chroot into it:
50 </p>
51 <pre>
52 # tazdev gen-chroot &amp;&amp; tazdev chroot
53 </pre>
54 <p>
55 By default Tazdev creates a chroot in /home/slitaz/cooking/chroot but you
56 can specify a custom path in the argument. The chroot location is not
57 important, when you will be in the chroot you will use standard SliTaz
58 paths such as /home/slitaz/wok for the wok directory or /home/slitaz/log
59 for all the cook logs. As usual you can display tazdev help usage with:
60 tazdev usage.
61 </p>
62 <p>
63 When you use a chroot there are 2 special directories mounted with the bind
64 option: src and packages. The sources for all packages are stored by default
65 in /home/slitaz/src, this directory is mounted into the chroot so the utils
66 can use them. This method lets you share sources between many chroots such
67 as one for cooking and one for stable. The packages directory default
68 location is: /home/slitaz/[version]/packages so they are not in the chroot
69 and are safe in case the chroot is removed by error.
70 </p>
72 <h3>Getting started</h3>
73 <p>
74 So you have decided the way you want to work, so lets prepare the cook environment.
75 Cook uses the cook.conf configuration file, if you want to use custom paths for
76 SliTaz directories and files, you'll have to modify it. The setup will create
77 some directories and files to keep trace of activity and errors, all files
78 are pure plain text files that you can open in a text editor. To prepare
79 your environment:
80 </p>
81 <pre>
82 # cook setup
83 </pre>
84 <p>
85 The setup command has a --wok option which lets you clone a SliTaz wok while
86 setting up your cook environment. Even if you are not yet an official developer
87 you can clone it and use existing packages as an example to create your own.
88 To setup and clone the default cooking wok or the undigest wok:
89 </p>
90 <pre>
91 # cook setup --wok
92 # cook setup --undigest
93 </pre>
95 <h3>Test your environment</h3>
96 <p>
97 Cook provides a test command which will create a package and cook it. This lets
98 you see if your environment is working and it provides an example package with
99 a receipt. The dummy package is named 'cooktest' and can be removed after
100 testing. To cook the test package:
101 </p>
102 <pre>
103 # cook test
104 </pre>
106 <h3>Create and cook</h3>
107 <p>
108 If your environment is setup correctly you can start creating and compiling
109 SliTaz packages from your wok. To create a new package with an empty receipt
110 (you can also create a receipt interactively):
111 </p>
112 <pre>
113 # cook new pkgname
114 # cook new pkgname --interactive
115 </pre>
116 <p>
117 If you have just created a new package, you'll have to edit the receipt with your
118 favorite text editor. When the receipt is ready or if you have an existing
119 package, you can cook it:
120 </p>
121 <pre>
122 # cook pkgname
123 </pre>
124 <p>
125 If all went well you will find your package in the $SLITAZ/packages
126 directory and any produced files in $SLITAZ/wok/pkgname.
127 </p>
129 <h3>Cook and install</h3>
130 <p>
131 If you want to cook and install the package in one command:
132 </p>
133 <pre>
134 # cook pkgname --install
135 </pre>
137 <h3>Get sources</h3>
138 <p>
139 If you want or need to download only the source of a package without
140 building it, you can use the option --getsrc as below:
141 </p>
142 <pre>
143 # cook pkgname --getsrc
144 </pre>
146 <h3>Clean packages</h3>
147 <p>
148 After compilation and packaging there are several files in the wok that take up
149 disk space. To clean a single package:
150 </p>
151 <pre>
152 # cook pkgname --clean
153 </pre>
154 <p>
155 You can also clean the full wok at once or you can choose to keep SliTaz
156 related files and just remove the source:
157 </p>
158 <pre>
159 # cook clean-wok
160 # cook clean-src
161 </pre>
163 <h3>Search</h3>
164 <p>
165 Cook provides a simple search function to quickly find a package in the
166 wok. It uses grep and so supports regular expressions:
167 </p>
168 <pre>
169 # cook search busybox
170 </pre>
172 <h3>Packages DB list</h3>
173 <p>
174 Cook can list packages in the wok and also create a suitable packages list
175 for Tazpkg. This lets you create a local packages repository quite easily
176 and is used to create the official SliTaz packages list found on the mirrors.
177 To list the current wok used by cook (you don't need to be root):
178 </p>
179 <pre>
180 $ cook list-wok
181 </pre>
182 <p>
183 When creating the packages DB, cook will check if you have a flavors repo in
184 /home/slitaz/flavors, if so, it will pack all flavors using the latest
185 packages list available. To create a packages list and the Live flavors
186 files:
187 </p>
188 <pre>
189 # cook pkgdb
190 </pre>
192 <a name="cooker"></a>
193 <h3>The Cooker</h3>
194 <p>
195 The Cooker is a Build Bot, its first function is to check for commits in a wok,
196 create an ordered cooklist and cook all modified packages. It can also be
197 used as a frontend to cook since they both use the same files. The Cooker can
198 also be used to cook a big list of packages at once such as all the packages
199 in a flavor. The Cooker provides a nice CGI/Web interface that works by
200 default on any SliTaz system since it provides CGI support via the Busybox httpd
201 web server.
202 </p>
203 <p>
204 The Cooker provides a small built-in help usage and short command switch.
205 For example to display usage you can use:
206 </p>
207 <pre>
208 # cooker usage
209 # cooker -u
210 </pre>
212 <h3>Cooker setup</h3>
213 <p>
214 Like cook, the Cooker needs a working environment before starting to use it.
215 The main difference with the cook environment is that the Cooker needs 2 woks.
216 One Hg and clean wok as a reference and one build wok. In this way it is easy
217 to compare both woks and get modifications. If you already have a cook
218 environment, you must move your wok before setting up the Cooker or it
219 will complain. Setup will also install a set of development packages that
220 can be configured in the cook.conf configuration file and the variable
221 SETUP_PKGS. To setup your cooker environment:
222 </p>
223 <pre>
224 # cooker setup
225 </pre>
226 <p>
227 If all went well you now have 2 woks, base development packages installed
228 and all needed files created. The default behavior is to check for commits,
229 you can run a test:
230 </p>
231 <pre>
232 # cooker
233 </pre>
235 <h3>Cooker cook</h3>
236 <p>
237 Again, 2 ways to work now: make changes in the clean Hg wok and launch the
238 cooker without any arguments or cook packages manually. The cooker lets you
239 cook a single package or all packages of a category or a flavor. You can also
240 try to build all unbuilt packages, but be aware the Cooker was not designed
241 to handle thousands of packages.
242 </p>
243 <p>
244 To cook a single package which is the same as 'cook pkgname' but with more
245 logs:
246 </p>
247 <pre>
248 # cooker pkg pkgname
249 </pre>
250 <p>
251 To cook more than one package at once you have different kind of choices.
252 You can use an existing package such as used for Live flavors, you can also
253 use a custom list using the package names listed line by line. Finally you can
254 build all packages of a category.
255 </p>
256 <pre>
257 # cooker flavor [name]
258 # cooker list [/path/to/cooklist]
259 # cooker cat [category]
260 </pre>
261 <p>
262 The Cooker lets you also recook a specific Hg revision. It's useful in
263 production so that if the Build Bot was interrupted while cooking commits, you
264 can then cook packages manually:
265 </p>
266 <pre>
267 # cooker rev 9496
268 </pre>
270 <a name="blocked"></a>
271 <h3>Blocked packages</h3>
272 <p>
273 Cook and the Cooker handle a file with a list of blocked package so they will
274 not cook when commits happen or if a cooklist is used. This is very useful
275 for a Cooker Build Bot in production. When you block or unblock a package
276 you can add a note to the cooknotes. Blocking packages example:
277 </p>
278 <pre>
279 # cook pkgname --block
280 # cooker block pkgname
281 # cooker -n "Blocked pkgname note"
282 </pre>
283 <p>
284 The list of blocked packages are also displayed on the Cooker web interface.
285 To unblock a package you have to use the unblock command or cook --unblock
286 option:
287 </p>
288 <pre>
289 # cook pkgname --unblock
290 # cooker unblock pkgname
291 </pre>
293 <h3>Cooker CGI/Web</h3>
294 <p>
295 To let you view log files in a nice way, keep trace of activity and help find
296 errors, you can use the Cooker Web interface located by default in the folder
297 /var/www/cgi-bin/cooker. If you don't use a chroot and the Busybox httpd
298 web server is running, the web interface will work without configuration and
299 should be reachable at: <a href="http://localhost/cgi-bin/cooker/cooker.cgi">
300 http://localhost/cgi-bin/cooker/cooker.cgi</a>
301 </p>
302 <p>
303 If you used a chroot environment, you should also install cookutils on your
304 host and modify the SLITAZ path variable. A standard working way is to have
305 a chroot in:
306 </p>
307 <pre>
308 /home/slitaz/cooking/chroot
309 </pre>
310 <p>
311 With /etc/slitaz/cook.conf modified as below:
312 </p>
313 <pre>
314 SLITAZ="/home/slitaz/cooking/chroot/home/slitaz"
315 </pre>
316 <p>
317 Note: It's not obligatory to install the cookutils on your host to use the
318 web interface, you can also copy the cooker.cgi and style.css files for
319 example into your ~/Public directory and use a custom cook.conf with it. The
320 advantage of installing cookutils on the host is to get regular updates via
321 the Tazpkg packages manager. Say you have cloned or downloaded the cookutils:
322 </p>
323 <pre>
324 $ cp -a cookutils/web ~/Public/cgi-bin/cooker
325 $ cp -f cookutils/cook.conf ~/Public/cgi-bin/cooker
326 </pre>
327 <p>
328 Edit the configuration file: ~/Public/cgi-bin/cooker/cook.conf to set your
329 SLITAZ path and you're all done!
330 </p>
332 <h3>Cooknotes</h3>
333 <p>
334 The cooknotes feature lets you write small personal notes about packaging
335 and is useful for collaboration. The cooknotes was coded to let the SliTaz
336 Cooker bot maintainers share notes between themselves and other contributors.
337 The Cooker can block a package's build or recook packages manually, for example
338 it's nice to make a note if a package is blocked so that the maintainer knows why
339 admin did that. Cooknotes are displayed on the web interface and can be
340 checked from a cmdline:
341 </p>
342 <pre>
343 # cooker note "Blocked pkgname due to heavy CPU load"
344 # cooker notes
345 </pre>
347 <h3>Cooker as a Build Bot</h3>
348 <p>
349 The Cooker is designed to be a Built Bot for SliTaz, this means it monitors
350 2 woks, updates the Hg wok, gets the differences and cooks all packages that
351 have been committed. The safer and cleaner way to run the Cooker as a Build
352 Bot with cron is to use a chroot environment, but it can run directly on the
353 host if you want.
354 </p>
355 <p>
356 To run The Cooker automatically you must use cron from the chroot and add a
357 single line to root crontabs in /var/spool/cron/crontabs. Say you would like
358 to run the Cooker every 2 hours:
359 </p>
360 <pre>
361 * */2 * * * /usr/bin/cooker
362 </pre>
364 <h3>Cooker BB started at boot</h3>
365 <p>
366 The Cooker environment and cron task can automatically be started at boot time.
367 You must have the cookutils-daemon installed on the host and use a standard SliTaz
368 installation to make it work properly (cooking goes in /home/slitaz/cooking). The
369 daemon script will mount any virtual filesystems if needed as well as source and
370 packages. Source files are in /home/slitaz/src and bound into the chroot
371 so you can share package's sources between several versions (stable, cooking,
372 undigest). If the package is not yet installed:
373 </p>
374 <pre>
375 # tazpkg get-install cookutils-daemon
376 </pre>
377 <p>
378 To start the daemon you must have a cron file definition for
379 root in the chroot, the daemon script works like all other system daemons
380 and can be handled with:
381 </p>
382 <pre>
383 # /etc/init.d/cooker [start|stop|restart]
384 </pre>
386 <!-- End content -->
387 </div>
389 <div id="footer">
390 Copyright &copy; 2011 SliTaz contributors
391 </div>
393 </body>
394 </html>