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

Show recent broken packages first
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 19 15:32:45 2022 +0000 (2022-02-19)
parents 82eaf5faefb9
children
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>Receipt functions</h3>
178 <p>
179 Many packages provide the same kind of files such as *-dev packages
180 with static libs, pkgconfig files and include headers. So cook provides
181 a function to be used in the receipt:
182 </p>
183 <pre>
184 get_dev_files : Install /usr/lib/{lib.*a,pkgconfig} /usr/include
185 </pre>
187 <h3>Packages DB list</h3>
188 <p>
189 Cook can list packages in the wok and also create a suitable packages list
190 for Tazpkg. This lets you create a local packages repository quite easily
191 and is used to create the official SliTaz packages list found on the mirrors.
192 To list the current wok used by cook (you don't need to be root):
193 </p>
194 <pre>
195 $ cook list-wok
196 </pre>
197 <p>
198 When creating the packages DB, cook will check if you have a flavors repo in
199 /home/slitaz/flavors, if so, it will pack all flavors using the latest
200 packages list available. To create a packages list and the Live flavors
201 files:
202 </p>
203 <pre>
204 # cook pkgdb
205 </pre>
207 <h3 id="cooker">The Cooker</h3>
208 <p>
209 The Cooker is a Build Bot, its first function is to check for commits in a wok,
210 create an ordered cooklist and cook all modified packages. It can also be
211 used as a frontend to cook since they both use the same files. The Cooker can
212 also be used to cook a big list of packages at once such as all the packages
213 in a flavor. The Cooker provides a nice CGI/Web interface that works by
214 default on any SliTaz system since it provides CGI support via the Busybox httpd
215 web server.
216 </p>
217 <p>
218 The Cooker provides a small built-in help usage and short command switch.
219 For example to display usage you can use:
220 </p>
221 <pre>
222 # cooker usage
223 # cooker -u
224 </pre>
226 <h3>Cooker setup</h3>
227 <p>
228 Like cook, the Cooker needs a working environment before starting to use it.
229 The main difference with the cook environment is that the Cooker needs 2 woks.
230 One Hg and clean wok as a reference and one build wok. In this way it is easy
231 to compare both woks and get modifications. If you already have a cook
232 environment, you must move your wok before setting up the Cooker or it
233 will complain. Setup will also install a set of development packages that
234 can be configured in the cook.conf configuration file and the variable
235 SETUP_PKGS. To setup your cooker environment:
236 </p>
237 <pre>
238 # cooker setup
239 </pre>
240 <p>
241 If all went well you now have 2 woks, base development packages installed
242 and all needed files created. The default behavior is to check for commits,
243 you can run a test:
244 </p>
245 <pre>
246 # cooker
247 </pre>
249 <h3>Cooker cook</h3>
250 <p>
251 Again, 2 ways to work now: make changes in the clean Hg wok and launch the
252 cooker without any arguments or cook packages manually. The cooker lets you
253 cook a single package or all packages of a category or a flavor. You can also
254 try to build all unbuilt packages, but be aware the Cooker was not designed
255 to handle thousands of packages.
256 </p>
257 <p>
258 To cook a single package which is the same as 'cook pkgname' but with more
259 logs:
260 </p>
261 <pre>
262 # cooker pkg pkgname
263 </pre>
264 <p>
265 To cook more than one package at once you have different kind of choices.
266 You can use an existing package such as used for Live flavors, you can also
267 use a custom list using the package names listed line by line. Finally you can
268 build all packages of a category.
269 </p>
270 <pre>
271 # cooker flavor [name]
272 # cooker list [/path/to/cooklist]
273 # cooker cat [category]
274 </pre>
275 <p>
276 The Cooker lets you also recook a specific Hg revision. It's useful in
277 production so that if the Build Bot was interrupted while cooking commits, you
278 can then cook packages manually:
279 </p>
280 <pre>
281 # cooker rev 9496
282 </pre>
284 <h3 id="blocked">Blocked packages</h3>
285 <p>
286 Cook and the Cooker handle a file with a list of blocked package so they will
287 not cook when commits happen or if a cooklist is used. This is very useful
288 for a Cooker Build Bot in production. When you block or unblock a package
289 you can add a note to the cooknotes. Blocking packages example:
290 </p>
291 <pre>
292 # cook pkgname --block
293 # cooker block pkgname
294 # cooker -n "Blocked pkgname note"
295 </pre>
296 <p>
297 The list of blocked packages are also displayed on the Cooker web interface.
298 To unblock a package you have to use the unblock command or cook --unblock
299 option:
300 </p>
301 <pre>
302 # cook pkgname --unblock
303 # cooker unblock pkgname
304 </pre>
306 <h3>Cooker CGI/Web</h3>
307 <p>
308 To let you view log files in a nice way, keep trace of activity and help find
309 errors, you can use the Cooker Web interface located by default in the folder
310 /var/www/cooker. If you don't use a chroot and the Busybox httpd web server
311 is running, the web interface will work without configuration and should be
312 reachable at: <a href="http://localhost/cooker/cooker.cgi">
313 http://localhost/cooker/cooker.cgi</a>
314 </p>
315 <p>
316 If you used a chroot environment, you should also install cookutils on your
317 host and modify the SLITAZ path variable. A standard working way is to have
318 a chroot in:
319 </p>
320 <pre>
321 /home/slitaz/cooking/chroot
322 </pre>
323 <p>
324 With /etc/slitaz/cook.conf modified as below:
325 </p>
326 <pre>
327 SLITAZ="/home/slitaz/cooking/chroot/home/slitaz"
328 </pre>
329 <p>
330 Note: It's not obligatory to install the cookutils on your host to use the
331 web interface. If you use Lighttpd you can also copy the cooker.cgi and
332 style.css files for example into your ~/Public directory and use a custom
333 cook.conf with it. The advantage of installing cookutils on the host is to
334 get regular updates via the Tazpkg packages manager. Say you have cloned or
335 downloaded the cookutils:
336 </p>
337 <pre>
338 $ cp -a cookutils/web ~/Public/cgi-bin/cooker
339 $ cp -f cookutils/cook.conf ~/Public/cgi-bin/cooker
340 </pre>
341 <p>
342 Edit the configuration file: ~/Public/cgi-bin/cooker/cook.conf to set your
343 SLITAZ path and you're all done!
344 </p>
346 <h3>Cooknotes</h3>
347 <p>
348 The cooknotes feature lets you write small personal notes about packaging
349 and is useful for collaboration. The cooknotes was coded to let the SliTaz
350 Cooker bot maintainers share notes between themselves and other contributors.
351 The Cooker can block a package's build or recook packages manually, for example
352 it's nice to make a note if a package is blocked so that the maintainer knows why
353 admin did that. Cooknotes are displayed on the web interface and can be
354 checked from a cmdline:
355 </p>
356 <pre>
357 # cooker note "Blocked pkgname due to heavy CPU load"
358 # cooker notes
359 </pre>
361 <h3>Cooker as a Build Bot</h3>
362 <p>
363 The Cooker is designed to be a Built Bot for SliTaz, this means it monitors
364 2 woks, updates the Hg wok, gets the differences and cooks all packages that
365 have been committed. The safer and cleaner way to run the Cooker as a Build
366 Bot with cron is to use a chroot environment, but it can run directly on the
367 host if you want.
368 </p>
369 <p>
370 To run The Cooker automatically you must use cron from the chroot and add a
371 single line to root crontabs in /var/spool/cron/crontabs. Say you would like
372 to run the Cooker every 2 hours:
373 </p>
374 <pre>
375 * */2 * * * /usr/bin/cooker
376 </pre>
378 <h3>Cooker BB started at boot</h3>
379 <p>
380 The Cooker environment and cron task can automatically be started at boot time.
381 You must have the cookutils-daemon installed on the host and use a standard SliTaz
382 installation to make it work properly (cooking goes in /home/slitaz/cooking). The
383 daemon script will mount any virtual filesystems if needed as well as source and
384 packages. Source files are in /home/slitaz/src and bound into the chroot
385 so you can share package's sources between several versions (stable, cooking,
386 undigest). If the package is not yet installed:
387 </p>
388 <pre>
389 # tazpkg get-install cookutils-daemon
390 </pre>
391 <p>
392 To start the daemon you must have a cron file definition for
393 root in the chroot, the daemon script works like all other system daemons
394 and can be handled with:
395 </p>
396 <pre>
397 # /etc/init.d/cooker [start|stop|restart]
398 </pre>
400 <!-- End content -->
401 </div>
403 <footer>
404 Copyright © <span class="year"></span> <a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
405 </footer>
407 </body>
408 </html>