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

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