recipes: Preserve warnings flags appending the C flags in some (specific) recipes
[dragora.git] / qi / doc / qi.html
blob90ff272cf0a2ddca3b35bdb28b6c98776fd3428c
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <title>Qi user guide</title>
8 <meta name="description" content="Qi user guide">
9 <meta name="keywords" content="Qi user guide">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="#Top" rel="start" title="Top">
14 <link href="#Index" rel="index" title="Index">
15 <link href="dir.html#Top" rel="up" title="(dir)">
16 <style type="text/css">
17 <!--
18 a.summary-letter {text-decoration: none}
19 blockquote.indentedblock {margin-right: 0em}
20 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
21 blockquote.smallquotation {font-size: smaller}
22 div.display {margin-left: 3.2em}
23 div.example {margin-left: 3.2em}
24 div.lisp {margin-left: 3.2em}
25 div.smalldisplay {margin-left: 3.2em}
26 div.smallexample {margin-left: 3.2em}
27 div.smalllisp {margin-left: 3.2em}
28 kbd {font-style: oblique}
29 pre.display {font-family: inherit}
30 pre.format {font-family: inherit}
31 pre.menu-comment {font-family: serif}
32 pre.menu-preformatted {font-family: serif}
33 pre.smalldisplay {font-family: inherit; font-size: smaller}
34 pre.smallexample {font-size: smaller}
35 pre.smallformat {font-family: inherit; font-size: smaller}
36 pre.smalllisp {font-size: smaller}
37 span.nolinebreak {white-space: nowrap}
38 span.roman {font-family: initial; font-weight: normal}
39 span.sansserif {font-family: sans-serif; font-weight: normal}
40 ul.no-bullet {list-style: none}
41 -->
42 </style>
45 </head>
47 <body lang="en">
48 <h1 class="settitle" align="center">Qi user guide</h1>
54 <a name="Top"></a>
55 <div class="header">
56 <p>
57 Next: <a href="#Introduction-to-Qi" accesskey="n" rel="next">Introduction to Qi</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
58 </div>
59 <a name="SEC_Top"></a>
61 <p>This user guide is for Qi (version 2.8,
62 02 May 2022).
63 </p>
64 <table class="menu" border="0" cellspacing="0">
65 <tr><td align="left" valign="top">&bull; <a href="#Introduction-to-Qi" accesskey="1">Introduction to Qi</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Description and features of qi
66 </td></tr>
67 <tr><td align="left" valign="top">&bull; <a href="#Invoking-qi" accesskey="2">Invoking qi</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Command-line options
68 </td></tr>
69 <tr><td align="left" valign="top">&bull; <a href="#The-qirc-file" accesskey="3">The qirc file</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Configuration file
70 </td></tr>
71 <tr><td align="left" valign="top">&bull; <a href="#Packages" accesskey="4">Packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Managing packages
72 </td></tr>
73 <tr><td align="left" valign="top">&bull; <a href="#Recipes" accesskey="5">Recipes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Building packages
74 </td></tr>
75 <tr><td align="left" valign="top">&bull; <a href="#Order-files" accesskey="6">Order files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Handling build order
76 </td></tr>
77 <tr><td align="left" valign="top">&bull; <a href="#Creating-packages" accesskey="7">Creating packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Making Qi packages
78 </td></tr>
79 <tr><td align="left" valign="top">&bull; <a href="#Examining-packages" accesskey="8">Examining packages</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Debugging purposes
80 </td></tr>
81 <tr><td align="left" valign="top">&bull; <a href="#Qi-exit-status" accesskey="9">Qi exit status</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Exit codes
82 </td></tr>
83 <tr><td align="left" valign="top">&bull; <a href="#Index">Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
84 </td></tr>
85 </table>
87 <br>
88 <p>Copyright &copy; 2019-2022 Matias Andres Fonzo, Santiago del Estero,
89 Argentina.
90 </p>
91 <p>Permission is granted to copy, distribute and/or modify this document
92 under the terms of the GNU Free Documentation License, Version 1.3 or
93 any later version published by the Free Software Foundation; with no
94 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
95 </p>
97 <hr>
98 <a name="Introduction-to-Qi"></a>
99 <div class="header">
101 Next: <a href="#Invoking-qi" accesskey="n" rel="next">Invoking qi</a>, Previous: <a href="#Top" accesskey="p" rel="prev">Top</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
102 </div>
103 <a name="Introduction-to-Qi-1"></a>
104 <h2 class="chapter">1 Introduction to Qi</h2>
105 <a name="index-introduction-to-qi"></a>
107 <p>Qi is a simple but well-integrated package manager. It can create,
108 install, remove, and upgrade software packages. Qi produces binary
109 packages using recipes, which are files containing specific instructions
110 to build each package from source. Qi can manage multiple packages
111 under a single directory hierarchy. This method allows to maintain a set
112 of packages and multiple versions of them. This means that Qi could be
113 used as the main package manager or complement the existing one.
114 </p>
115 <p>Qi offers a friendly command line interface, a global configuration
116 file, a simple recipe layout to deploy software packages; also works
117 with binary packages in parallel, speeding up installations and packages
118 in production. The format used for packages is a simplified and safer
119 variant of POSIX pax archive compressed in lzip format.
120 </p>
121 <p>Qi is a modern (POSIX-compliant) shell script released under the
122 terms of the GNU General Public License. There are only two major
123 dependencies for the magic: graft(1) and tarlz(1), the rest is expected
124 to be found in any Unix-like system.
125 </p>
126 <hr>
127 <a name="Invoking-qi"></a>
128 <div class="header">
130 Next: <a href="#The-qirc-file" accesskey="n" rel="next">The qirc file</a>, Previous: <a href="#Introduction-to-Qi" accesskey="p" rel="prev">Introduction to Qi</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
131 </div>
132 <a name="Invoking-qi-1"></a>
133 <h2 class="chapter">2 Invoking qi</h2>
134 <a name="index-invocation"></a>
136 <p>This chapter describes the synopsis for invoking Qi.
137 </p>
138 <div class="example">
139 <pre class="example">Usage: qi COMMAND [<var>OPTION</var>...] [<var>FILE</var>]...
140 </pre></div>
142 <p>One mandatory command specifies the operation that &lsquo;<samp>qi</samp>&rsquo; should
143 perform, options are meant to detail how this operation should be
144 performed during or after the process.
145 </p>
146 <p>Qi supports the following commands:
147 </p>
148 <dl compact="compact">
149 <dt><code>warn</code></dt>
150 <dd><p>Warn about files that will be installed.
151 </p>
152 </dd>
153 <dt><code>install</code></dt>
154 <dd><p>Install packages.
155 </p>
156 </dd>
157 <dt><code>remove</code></dt>
158 <dd><p>Remove packages.
159 </p>
160 </dd>
161 <dt><code>upgrade</code></dt>
162 <dd><p>Upgrade packages.
163 </p>
164 </dd>
165 <dt><code>extract</code></dt>
166 <dd><p>Extract packages for debugging purposes.
167 </p>
168 </dd>
169 <dt><code>create</code></dt>
170 <dd><p>Create a .tlz package from directory.
171 </p>
172 </dd>
173 <dt><code>build</code></dt>
174 <dd><p>Build packages using recipe names.
175 </p>
176 </dd>
177 <dt><code>order</code></dt>
178 <dd><p>Resolve build order through .order files
179 </p></dd>
180 </dl>
182 <p>Options when installing, removing, or upgrading software packages:
183 </p>
184 <dl compact="compact">
185 <dt><code>-f</code></dt>
186 <dt><code>--force</code></dt>
187 <dd><p>Force upgrade of pre-existing packages.
188 </p>
189 </dd>
190 <dt><code>-k</code></dt>
191 <dt><code>--keep</code></dt>
192 <dd><p>Keep directories when build/remove/upgrade.
193 </p>
194 <p>Keep (don&rsquo;t delete) the package directory when using remove/upgrade command.
195 </p>
196 <p>This will also try to preserve the directories &lsquo;<samp>${srcdir}</samp>&rsquo; and
197 &lsquo;<samp>${destdir}</samp>&rsquo; when using build command. Its effect is available in
198 recipes as &lsquo;<samp>${keep_srcdir}</samp>&rsquo; and &lsquo;<samp>${keep_destdir}</samp>&rsquo;. See
199 <a href="#Recipes">Special variables</a> for details.
200 </p>
201 </dd>
202 <dt><code>-p</code></dt>
203 <dt><code>--prune</code></dt>
204 <dd><p>Prune conflicts.
205 </p>
206 </dd>
207 <dt><code>-P</code></dt>
208 <dt><code>--packagedir=&lt;dir&gt;</code></dt>
209 <dd><p>Set directory for package installations.
210 </p>
211 </dd>
212 <dt><code>-t</code></dt>
213 <dt><code>--targetdir=&lt;dir&gt;</code></dt>
214 <dd><p>Set target directory for symbolic links.
215 </p>
216 </dd>
217 <dt><code>-r</code></dt>
218 <dt><code>--rootdir=&lt;dir&gt;</code></dt>
219 <dd><p>Use the fully qualified named directory as the root directory for all qi
220 operations.
221 </p>
222 <p>Note: the target directory and the package directory will be
223 relative to the specified directory, excepting the graft log file.
224 </p></dd>
225 </dl>
227 <p>Options when building software packages using recipes:
228 </p>
229 <dl compact="compact">
230 <dt><code>-a</code></dt>
231 <dt><code>--architecture</code></dt>
232 <dd><p>Set architecture name for the package.
233 </p>
234 </dd>
235 <dt><code>-j</code></dt>
236 <dt><code>--jobs</code></dt>
237 <dd><p>Parallel jobs for the compiler.
238 </p>
239 <p>This option sets the variable &lsquo;<samp>${jobs}</samp>&rsquo;. If not specified, default
240 sets to 1.
241 </p>
242 </dd>
243 <dt><code>-S</code></dt>
244 <dt><code>--skip-questions</code></dt>
245 <dd><p>Skip questions on completed recipes.
246 </p>
247 </dd>
248 <dt><code>-1</code></dt>
249 <dt><code>--increment</code></dt>
250 <dd><p>Increment release number (&lsquo;<samp>${release}</samp>&rsquo; + 1).
251 </p>
252 <p>The effect of this option will be omitted if &ndash;no-package is being used.
253 </p>
254 </dd>
255 <dt><code>-n</code></dt>
256 <dt><code>--no-package</code></dt>
257 <dd><p>Do not create a .tlz package.
258 </p>
259 </dd>
260 <dt><code>-i</code></dt>
261 <dt><code>--install</code></dt>
262 <dd><p>Install package after the build.
263 </p>
264 </dd>
265 <dt><code>-u</code></dt>
266 <dt><code>--upgrade</code></dt>
267 <dd><p>Upgrade package after the build.
268 </p>
269 </dd>
270 <dt><code>-o</code></dt>
271 <dt><code>--outdir=&lt;dir&gt;</code></dt>
272 <dd><p>Where the packages produced will be written.
273 </p>
274 <p>This option sets the variable &lsquo;<samp>${outdir}</samp>&rsquo;.
275 </p>
276 </dd>
277 <dt><code>-w</code></dt>
278 <dt><code>--worktree=&lt;dir&gt;</code></dt>
279 <dd><p>Where archives, patches, recipes are expected.
280 </p>
281 <p>This option sets the variable &lsquo;<samp>${worktree}</samp>&rsquo;.
282 </p>
283 </dd>
284 <dt><code>-s</code></dt>
285 <dt><code>--sourcedir=&lt;dir&gt;</code></dt>
286 <dd><p>Where compressed sources will be found.
287 </p>
288 <p>This option sets the variable &lsquo;<samp>${tardir}</samp>&rsquo;.
289 </p></dd>
290 </dl>
292 <p>Other options:
293 </p>
294 <dl compact="compact">
295 <dt><code>-v</code></dt>
296 <dt><code>--verbose</code></dt>
297 <dd><p>Be verbose (an extra -v gives more).
298 </p>
299 <p>It sets the verbosity level, default sets to 0.
300 </p>
301 <p>The value 1 is used for more verbosity while the value 2 is too detailed.
302 Although at the moment it is limited to graft(1) verbosity.
303 </p>
304 </dd>
305 <dt><code>-N</code></dt>
306 <dt><code>--no-rc</code></dt>
307 <dd><p>Do not read the configuration file.
308 </p>
309 <p>This will ignore reading the qirc file.
310 </p>
311 </dd>
312 <dt><code>-L</code></dt>
313 <dt><code>--show-location</code></dt>
314 <dd><p>Print default directory locations and exit.
315 </p>
316 <p>This will print the target directory, package directory, working tree,
317 the directory for sources, and the output directory for the packages
318 produced.
319 </p>
320 </dd>
321 <dt><code>-h</code></dt>
322 <dt><code>--help</code></dt>
323 <dd><p>Display the usage and exit.
324 </p>
325 </dd>
326 <dt><code>-V</code></dt>
327 <dt><code>--version</code></dt>
328 <dd>
329 <p>This will print the (short) version information and then exit.
330 </p>
331 <p>The same can be achieved if Qi is invoked as &lsquo;<samp>qi version</samp>&rsquo;.
332 </p></dd>
333 </dl>
335 <p>When FILE is -, qi can read from the standard input. See examples from
336 the <a href="#Packages">Packages</a> section.
337 </p>
338 <p>Exit status: 0 for a normal exit, 1 for minor common errors (help usage,
339 support not available, etc), 2 to indicate a command execution error;
340 3 for integrity check error on compressed files, 4 for empty, not
341 regular, or expected files, 5 for empty or not defined variables,
342 6 when a package already exist, 10 for network manager errors.
343 For more details, see the <a href="#Qi-exit-status">Qi exit status</a> section.
344 </p>
346 <hr>
347 <a name="The-qirc-file"></a>
348 <div class="header">
350 Next: <a href="#Packages" accesskey="n" rel="next">Packages</a>, Previous: <a href="#Invoking-qi" accesskey="p" rel="prev">Invoking qi</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
351 </div>
352 <a name="The-qirc-file-1"></a>
353 <h2 class="chapter">3 The qirc file</h2>
354 <a name="index-configuration-file"></a>
356 <p>The global <samp>qirc</samp> file offers a way to define variables and tools
357 (such as a download manager) for default use. This file is used by qi
358 at runtime, e.g., to build, install, remove or upgrade packages.
359 </p>
360 <p>Variables and their possible values must be declared as any other
361 variable in the shell.
362 </p>
363 <p>The command line options related to the package directory and target
364 directory and some of the command line options used for the build command,
365 have the power to override the values declared on <samp>qirc</samp>.
366 See <a href="#Invoking-qi">Invoking qi</a>.
367 </p>
368 <p>The order in which qi looks for this file is:
369 </p>
370 <ol>
371 <li> <code>${HOME}/.qirc</code>
372 Effective user.
374 </li><li> &lsquo;<samp>${sysconfdir}/qirc</samp>&rsquo;
375 System-wide.
376 </li></ol>
378 <p>If you intend to run qi as effective user, the file
379 &lsquo;<samp>${sysconfdir}/qirc</samp>&rsquo; could be copied to <code>${HOME}/.qirc</code>
380 setting the paths for &lsquo;<samp>${packagedir}</samp>&rsquo; and &lsquo;<samp>${targetdir}</samp>&rsquo;
381 according to the <code>$HOME</code>.
382 </p>
384 <hr>
385 <a name="Packages"></a>
386 <div class="header">
388 Next: <a href="#Recipes" accesskey="n" rel="next">Recipes</a>, Previous: <a href="#The-qirc-file" accesskey="p" rel="prev">The qirc file</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
389 </div>
390 <a name="Packages-1"></a>
391 <h2 class="chapter">4 Packages</h2>
392 <a name="index-managing-packages"></a>
394 <p>A package is a suite of programs usually distributed in binary form
395 which may also contain manual pages, documentation, or any other file
396 associated to a specific software.
397 </p>
398 <p>The package format used by qi is a simplified POSIX pax archive
399 compressed using lzip<a name="DOCF1" href="#FOOT1"><sup>1</sup></a>. The
400 file extension for packages ends in &lsquo;<samp>.tlz</samp>&rsquo;.
401 </p>
402 <p>Both package installation and package de-installation are managed using
403 two important (internal) variables: &lsquo;<samp>${packagedir}</samp>&rsquo; and
404 &lsquo;<samp>${targetdir}</samp>&rsquo;, these values can be changed in the
405 configuration file or via options.
406 </p>
407 <p>&lsquo;<samp>${packagedir}</samp>&rsquo; is a common directory tree where the package
408 contents will be decompressed (will reside).
409 </p>
410 <p>&lsquo;<samp>${targetdir}</samp>&rsquo; is a target directory where the links will be
411 made by graft(1) taking &lsquo;<samp>${packagedir}/package_name</samp>&rsquo; into account.
412 </p>
413 <p>Packages are installed in self-contained directory trees and symbolic
414 links from a common area are made to the package files. This allows
415 multiple versions of the same package to coexist on the same system.
416 </p>
417 <a name="Package-conflicts"></a>
418 <h3 class="section">4.1 Package conflicts</h3>
419 <a name="index-package-conflicts"></a>
421 <p>All the links to install or remove a package are handled by graft(1).
422 Since multiple packages can be installed or removed at the same time,
423 certain conflicts may arise between the packages.
424 </p>
425 <p>graft<a name="DOCF2" href="#FOOT2"><sup>2</sup></a>
426 defines a CONFLICT as one of the following conditions:
427 </p>
428 <ul>
429 <li> If the package object is a directory and the target object exists but is
430 not a directory.
432 </li><li> If the package object is not a directory and the target object exists
433 and is not a symbolic link.
435 </li><li> If the package object is not a directory and the target object exists
436 and is a symbolic link to something other than the package object.
437 </li></ul>
439 <p>The default behavior of qi for an incoming package is to ABORT if a
440 conflict arises. When a package is going to be deleted, qi tells to
441 graft(1) to remove those parts that are not in conflict, leaving the
442 links to the belonging package. This behavior can be forced if the
443 &ndash;prune option is given.
444 </p>
445 <a name="Installing-packages"></a>
446 <h3 class="section">4.2 Installing packages</h3>
447 <a name="index-package-installation"></a>
449 <p>To install a single package, simply type:
450 </p>
451 <div class="example">
452 <pre class="example">qi install coreutils_8.30_i586-1@tools.tlz
453 </pre></div>
455 <p>To install multiple packages at once, type:
456 </p>
457 <div class="example">
458 <pre class="example">qi install gcc_8.3.0_i586-1@devel.tlz rafaela_2.2_i586-1@legacy.tlz ...
459 </pre></div>
461 <p>Warn about the files that will be linked:
462 </p>
463 <div class="example">
464 <pre class="example">qi warn bash_5.0_i586-1@shells.tlz
465 </pre></div>
467 <p>This is to verify the content of a package before installing it.
468 </p>
469 <p>See the process of an installation:
470 </p>
471 <div class="example">
472 <pre class="example">qi install --verbose mariana_3.0_i586-1@woman.tlz
473 </pre></div>
475 <p>A second &ndash;verbose or -v option gives more (very verbose).
476 </p>
477 <p>Installing package in a different location:
478 </p>
479 <div class="example">
480 <pre class="example">qi install --rootdir=/media/floppy lzip_1.21_i586-1@compressors.tlz
481 </pre></div>
483 <p>Important: the &ndash;rootdir option assumes &lsquo;<samp>${targetdir}</samp>&rsquo; and
484 &lsquo;<samp>${packagedir}</samp>&rsquo;. See the following example:
485 </p>
486 <div class="example">
487 <pre class="example">qi install --rootdir=/home/selk lzip_1.21_i586-1@compressors.tlz
488 </pre></div>
490 <p>The content of &quot;lzip_1.21_i586-1@compressors.tlz&quot; will be decompressed
491 into &lsquo;<samp>/home/selk/pkgs/lzip_1.21_i586-1@compressors</samp>&rsquo;.
492 Assuming that the main binary for lzip is under
493 &lsquo;<samp>/home/selk/pkgs/lzip_1.21_i586-1@compressors/usr/bin/</samp>&rsquo;
494 the target for &quot;usr/bin&quot; will be created at &lsquo;<samp>/home/selk</samp>&rsquo;. Considering
495 that you have exported the <code>PATH</code> as &lsquo;<samp>${HOME}/usr/bin</samp>&rsquo;, now the
496 system is able to see the recent lzip command.
497 </p>
498 <p>Installing from a list of packages using standard input:
499 </p>
500 <div class="example">
501 <pre class="example">qi install - &lt; PACKAGELIST.txt
502 </pre></div>
504 <p>Or in combination with another tool:
505 </p><div class="example">
506 <pre class="example">sort -u PACKAGELIST.txt | qi install -
507 </pre></div>
509 <p>The sort command will read and sorts the list of declared packages,
510 while trying to have unique entries for each statement. The output
511 produced is captured by Qi to install each package.
512 </p>
513 <p>An example of a list containing package names is:
514 </p><div class="example">
515 <pre class="example">/var/cache/qi/packages/amd64/tcl_8.6.9_amd64-1@devel.tlz
516 /var/cache/qi/packages/amd64/tk_8.6.9.1_amd64-1@devel.tlz
517 /var/cache/qi/packages/amd64/vala_0.42.3_amd64-1@devel.tlz
518 </pre></div>
520 <a name="Removing-packages"></a>
521 <h3 class="section">4.3 Removing packages</h3>
522 <a name="index-package-de_002dinstallation"></a>
524 <p>To remove a package, simply type:
525 </p>
526 <div class="example">
527 <pre class="example">qi remove xz_5.2.4_i586-1@compressors.tlz
528 </pre></div>
530 <p>Remove command will match the package name using &lsquo;<samp>${packagedir}</samp>&rsquo; as
531 prefix. For example, if the value of &lsquo;<samp>${packagedir}</samp>&rsquo; has been
532 set to /usr/pkg, this will be equal to:
533 </p>
534 <div class="example">
535 <pre class="example">qi remove /usr/pkg/xz_5.2.4_i586-1@compressors
536 </pre></div>
538 <p>Detailed output:
539 </p>
540 <div class="example">
541 <pre class="example">qi remove --verbose /usr/pkg/xz_5.2.4_i586-1@compressors
542 </pre></div>
544 <p>A second &ndash;verbose or -v option gives more (very verbose).
545 </p>
546 <p>By default the remove command does not preserve a package directory after
547 removing its links from &lsquo;<samp>${targetdir}</samp>&rsquo;, but this behavior can be
548 changed if the &ndash;keep option is passed:
549 </p>
550 <div class="example">
551 <pre class="example">qi remove --keep /usr/pkg/lzip_1.21_i586-1@compressors
552 </pre></div>
554 <p>This means that the links to the package can be reactivated, later:
555 </p>
556 <div class="example">
557 <pre class="example">cd /usr/pkg &amp;&amp; graft -i lzip_1.21_i586-1@compressors
558 </pre></div>
560 <p>Removing package from a different location:
561 </p>
562 <div class="example">
563 <pre class="example">qi remove --rootdir=/home/cthulhu xz_5.2.4_i586-1@compressors
564 </pre></div>
566 <p>Removing a package using standard input:
567 </p>
568 <div class="example">
569 <pre class="example">echo vala_0.42.3_amd64-1@devel | qi remove -
570 </pre></div>
572 <p>This will match with the package directory.
573 </p>
574 <a name="Upgrading-packages"></a>
575 <h3 class="section">4.4 Upgrading packages</h3>
576 <a name="index-package-upgrade"></a>
578 <p>The upgrade command inherits the properties of the installation and removal
579 process. To make sure that a package is updated, the package is installed
580 in a temporary directory taking &lsquo;<samp>${packagedir}</samp>&rsquo; into account. Once
581 the incoming package is pre-installed, qi can proceed to search and delete
582 packages that have the same name (considered as previous ones). Finally,
583 the package is re-installed at its final location and the temporary
584 directory is removed.
585 </p>
586 <p>Since updating a package can be crucial and so to perform a successful
587 upgrade, from start to finish, you will want to ignore some important
588 system signals during the upgrade process, those signals are SIGHUP,
589 SIGINT, SIGQUIT, SIGABRT, and SIGTERM.
590 </p>
591 <p>To upgrade a package, just type:
592 </p>
593 <div class="example">
594 <pre class="example">qi upgrade gcc_9.0.1_i586-1@devel.tlz
595 </pre></div>
597 <p>This will proceed to upgrade &quot;gcc_9.0.1_i586-1@devel&quot; removing any other
598 version of &quot;gcc&quot; (if any).
599 </p>
600 <p>If you want to keep the package directories of versions found during the
601 upgrade process, just pass:
602 </p>
603 <div class="example">
604 <pre class="example">qi upgrade --keep gcc_9.0.1_i586-1@devel.tlz
605 </pre></div>
607 <p>To see the upgrade process:
608 </p>
609 <div class="example">
610 <pre class="example">qi upgrade --verbose gcc_9.0.1_i586-1@devel.tlz
611 </pre></div>
613 <p>A second &ndash;verbose or -v option gives more (very verbose).
614 </p>
615 <p>To force the upgrade of an existing package:
616 </p>
617 <div class="example">
618 <pre class="example">qi upgrade --force gcc_9.0.1_i586-1@devel.tlz
619 </pre></div>
621 <a name="Package-blacklist"></a>
622 <h4 class="subsection">4.4.1 Package blacklist</h4>
623 <a name="index-package-blacklist"></a>
625 <p>To implement general package facilities, either to install, remove or
626 maintain the hierarchy of packages in a clean manner, qi makes use of the
627 pruning operation via graft(1) by default:
628 </p>
629 <p>There is a risk if those are crucial packages for the proper functioning
630 of the system, because it implies the deactivation of symbolic from the
631 target directory, <em>especially</em> when transitioning an incoming package
632 into its final location during an upgrade.
633 </p>
634 <p>A blacklist of package names has been devised for the case where
635 a user decides to upgrade all the packages in the system, or
636 just the crucial ones, such as the C library.
637 </p>
638 <p>The blacklist is related to the upgrade command only, consists in installing
639 a package instead of updating it or removing previous versions of it;
640 the content of the package will be updated over the existing content at
641 &lsquo;<samp>${packagedir}</samp>&rsquo;, while the existing links from
642 &lsquo;<samp>${targetdir}</samp>&rsquo; will be preserved. A pruning of links will be
643 carried out in order to re-link possible differences with the recent
644 content, this helps to avoid leaving dead links in the target directory.
645 </p>
646 <p>Package names for the blacklist to be declared must be set from the
647 configuration file. By default, it is declared using the package name,
648 which is more than enough for critical system packages, but if you want to
649 be more specific, you can declare a package using:
650 &lsquo;<samp>${pkgname}_${pkgversion}_${arch}-${release}</samp>&rsquo; where
651 the package category is avoided for common matching. See
652 <a href="#Recipes">Special variables</a> for a description of these variables.
653 </p>
654 <hr>
655 <a name="Recipes"></a>
656 <div class="header">
658 Next: <a href="#Order-files" accesskey="n" rel="next">Order files</a>, Previous: <a href="#Packages" accesskey="p" rel="prev">Packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
659 </div>
660 <a name="Recipes-1"></a>
661 <h2 class="chapter">5 Recipes</h2>
662 <a name="index-recipes"></a>
664 <p>A recipe is a file telling qi what to do. Most often, the recipe tells
665 qi how to build a binary package from a source tarball.
666 </p>
667 <p>A recipe has two parts: a list of variable definitions and a list of
668 sections. By convention, the syntax of a section is:
669 </p>
670 <div class="example">
671 <pre class="example">section_name()
673 section lines
675 </pre></div>
677 <p>The section name is followed by parentheses, one newline and an opening
678 brace. The line finishing the section contains just a closing brace.
679 The section names or the function names currently recognized are
680 &lsquo;<samp>build</samp>&rsquo;.
681 </p>
682 <p>The &lsquo;<samp>build</samp>&rsquo; section (or <strong>shell function</strong>) is an augmented
683 shell script that contains the main instructions to build software
684 from source.
685 </p>
686 <p>If there are other functions defined by the packager, Qi detects them
687 for later execution.
688 </p>
689 <a name="Variables"></a>
690 <h3 class="section">5.1 Variables</h3>
691 <a name="index-variables"></a>
693 <p>A &quot;variable&quot; is a <strong>shell variable</strong> defined either in <samp>qirc</samp>
694 or in a recipe to represent a string of text, called the variable&rsquo;s
695 &quot;value&quot;. These values are substituted by explicit request in the
696 definitions of other variables or in calls to external commands.
697 </p>
698 <p>Variables can represent lists of file names, options to pass to
699 compilers, programs to run, directories to look in for source files,
700 directories to write output to, or anything else you can imagine.
701 </p>
702 <p>Definitions of variables in qi have four levels of precedence.
703 Options which define variables from the command-line override those
704 specified in the <samp>qirc</samp> file, while variables defined in the recipe
705 override those specified in <samp>qirc</samp>, taking priority over those
706 variables set by command-line options. Finally, the variables have
707 default values if they are not defined anywhere.
708 </p>
709 <p>Options that set variables through the command-line can only reference
710 variables defined in <samp>qirc</samp> and variables with default values.
711 </p>
712 <p>Definitions of variables in <samp>qirc</samp> can only reference variables
713 previously defined in <samp>qirc</samp> and variables with default values.
714 </p>
715 <p>Definitions of variables in the recipe can only reference variables
716 set by the command-line, variables previously defined in the recipe,
717 variables defined in <samp>qirc</samp>, and variables with default values.
718 </p>
719 <a name="Special-variables"></a>
720 <h3 class="section">5.2 Special variables</h3>
721 <a name="index-special-variables"></a>
723 <p>There are variables which can only be set using the command line options or
724 via <samp>qirc</samp>, there are other special variables which can be defined or
725 redefined in a recipe. See the following definitions:
726 </p>
727 <p>&lsquo;<samp>outdir</samp>&rsquo; is the directory where the packages produced are written.
728 This variable can be redefined per-recipe. Default sets to
729 &lsquo;<samp>/var/cache/qi/packages</samp>&rsquo;.
730 </p>
731 <p>&lsquo;<samp>worktree</samp>&rsquo; is the working tree where archives, patches, and recipes
732 are expected. This variable can not be redefined in the recipe. Default
733 sets to &lsquo;<samp>/usr/src/qi</samp>&rsquo;.
734 </p>
735 <p>&lsquo;<samp>tardir</samp>&rsquo; is defined in the recipe to the directory where the tarball
736 containing the source can be found. The full name of the tarball is
737 composed as &lsquo;<samp>${tardir}/$tarname</samp>&rsquo;. Its value is available in the
738 recipe as &lsquo;<samp>${tardir}</samp>&rsquo;; a value of . for &lsquo;<samp>tardir</samp>&rsquo; sets it to
739 the value of CWD (Current Working Directory), this is where the recipe
740 lives.
741 </p>
742 <p>&lsquo;<samp>arch</samp>&rsquo; is the architecture to compose the package name. Its value is
743 available in the recipe as &lsquo;<samp>${arch}</samp>&rsquo;. Default value is the one
744 that was set in the Qi configuration.
745 </p>
746 <p>&lsquo;<samp>jobs</samp>&rsquo; is the number of parallel jobs to pass to the compiler. Its
747 value is available in the recipe as &lsquo;<samp>${jobs}</samp>&rsquo;. The default value
748 is 1.
749 </p>
750 <p>The two variables &lsquo;<samp>${srcdir}</samp>&rsquo; and &lsquo;<samp>${destdir}</samp>&rsquo; can be
751 set in the recipe, as any other variable, but if they are not, qi uses
752 default values for them when building a package.
753 </p>
754 <p>&lsquo;<samp>srcdir</samp>&rsquo; contains the source code to be compiled, and defaults to
755 &lsquo;<samp>${program}-${version}</samp>&rsquo;. &lsquo;<samp>destdir</samp>&rsquo; is the place where the
756 built package will be installed, and defaults to
757 &lsquo;<samp>${TMPDIR}/package-${program}</samp>&rsquo;.
758 </p>
759 <p>If &lsquo;<samp>pkgname</samp>&rsquo; is left undefined, the special variable &lsquo;<samp>program</samp>&rsquo;
760 is assigned by default. If &lsquo;<samp>pkgversion</samp>&rsquo; is left undefined, the
761 special variable &lsquo;<samp>version</samp>&rsquo; is assigned by default.
762 </p>
763 <p>&lsquo;<samp>pkgname</samp>&rsquo; and &lsquo;<samp>pkgversion</samp>&rsquo; along with: &lsquo;<samp>version</samp>&rsquo;, &lsquo;<samp>arch</samp>&rsquo;,
764 &lsquo;<samp>release</samp>&rsquo;, and (optionally) &lsquo;<samp>pkgcategory</samp>&rsquo; are used to produce the
765 package name in the form:
766 &lsquo;<samp>${pkgname}_${pkgversion}_${arch}-${release}[@${pkgcategory}].tlz</samp>&rsquo;
767 </p>
768 <p>&lsquo;<samp>pkgcategory</samp>&rsquo; is an optional special variable that can be defined on the
769 recipe to categorize the package name. If it is defined, then the
770 package output will be composed as
771 &lsquo;<samp>${pkgname}_${pkgversion}_${arch}-${release}[@${pkgcategory}.tlz</samp>&rsquo;.
772 Automatically, the value of &lsquo;<samp>pkgcategory</samp>&rsquo; will be prefixed using the
773 &lsquo;<samp>@</samp>&rsquo; (at) symbol which will be added to the last part of the package name.
774 </p>
775 <p>A special variable called &lsquo;<samp>replace</samp>&rsquo; can be used to declare package names
776 that will be replaced at installation time.
777 </p>
778 <p>The special variables &lsquo;<samp>keep_srcdir</samp>&rsquo; and &lsquo;<samp>keep_destdir</samp>&rsquo; are provided
779 in order to preserve the directories &lsquo;<samp>${srcdir}</samp>&rsquo; or &lsquo;<samp>${destdir}</samp>&rsquo;,
780 if those exists as such. Note: The declaration of these variables are subject
781 to manual deactivation; its purpose in recipes is to preserve the directories
782 that relate to the package&rsquo;s build (source) and destination directory, that is
783 so that another recipe can get a new package (or meta package) from there. For
784 example, the declarations can be done as:
785 </p>
786 <div class="example">
787 <pre class="example">keep_srcdir=keep_srcdir
788 keep_destdir=keep_destdir
789 </pre></div>
791 <p>Then from another recipe you would proceed to copy the necessary files that
792 will compose the meta package, from the main function you must deactivate
793 the variables at the end:
794 </p>
795 <div class="example">
796 <pre class="example">unset -v keep_srcdir keep_destdir
797 </pre></div>
799 <p>This will leave the &rsquo;keep_srcdir&rsquo; and &rsquo;keep_destdir&rsquo; variables blank to
800 continue with the rest of the recipes.
801 </p>
802 <p>A typical recipe contains the following variables:
803 </p>
804 <ul>
805 <li> &lsquo;<samp>program</samp>&rsquo;: Software name.
807 <p>It matches the source name. It is also used to compose the name of the
808 package if &lsquo;<samp>${pkgname}</samp>&rsquo; is not specified.
809 </p>
810 </li><li> &lsquo;<samp>version</samp>&rsquo;: Software version.
812 <p>It matches the source name. It is also used to compose the version of the
813 package if &lsquo;<samp>${pkgversion}</samp>&rsquo; is not specified.
814 </p>
815 </li><li> &lsquo;<samp>arch</samp>&rsquo;: Software architecture.
817 <p>It is used to compose the architecture of the package in which it is
818 build.
819 </p>
820 </li><li> &lsquo;<samp>release</samp>&rsquo;: Release number.
822 <p>This is used to reflect the release number of the package. It is
823 recommended to increase this number after any significant change in
824 the recipe or post-install script.
825 </p>
826 </li><li> &lsquo;<samp>pkgcategory</samp>&rsquo;: Package category.
828 <p>Optional but recommended variable to categorize the package name when it is
829 created.
830 </p></li></ul>
832 <p>Obtaining sources over the network must be declared in the recipe using
833 the &lsquo;<samp>fetch</samp>&rsquo; variable.
834 </p>
835 <p>The variables &lsquo;<samp>netget</samp>&rsquo; and &lsquo;<samp>rsync</samp>&rsquo; can be defined in <samp>qirc</samp>
836 to establish a network downloader in order to get the sources. If they
837 are not defined, qi uses default values:
838 </p>
839 <p>&lsquo;<samp>netget</samp>&rsquo; is the general network downloader tool, defaults sets to
840 &lsquo;<samp>wget2 -c -w1 -t3 --no-check-certificate</samp>&rsquo;.
841 </p>
842 <p>&lsquo;<samp>rsync</samp>&rsquo; is the network tool for sources containing the prefix for
843 the RSYNC protocol, default sets to
844 &lsquo;<samp>rsync -v -a -L -z -i --progress</samp>&rsquo;.
845 </p>
846 <p>The variable &lsquo;<samp>description</samp>&rsquo; is used to print the package description
847 when a package is installed.
848 </p>
849 <p>A description has two parts: a brief description, and a long description.
850 By convention, the syntax of &lsquo;<samp>description</samp>&rsquo; is:
851 </p>
852 <div class="example">
853 <pre class="example">description=&quot;
854 Brief description.
856 Long description.
857 &quot;
858 </pre></div>
860 <p>The first line of the value represented is a brief description of the
861 software (called &quot;blurb&quot;). A blank line separates the <em>brief
862 description</em> from the <em>long description</em>, which should contain a more
863 descriptive description of the software.
864 </p>
865 <p>An example looks like:
866 </p>
867 <div class="example">
868 <pre class="example">description=&quot;
869 The GNU core utilities.
871 The GNU core utilities are the basic file, shell and text manipulation
872 utilities of the GNU operating system. These are the core utilities
873 which are expected to exist on every operating system.
874 &quot;
875 </pre></div>
877 <p>Please consider a length limit of 78 characters as maximum, because the same
878 one would be used on the meta file creation. See
879 <a href="#Recipes">The meta file</a> section.
880 </p>
881 <p>The &lsquo;<samp>homepage</samp>&rsquo; variable is used to declare the main site or home page:
882 </p>
883 <div class="example">
884 <pre class="example">homepage=https://www.gnu.org/software/gcc
885 </pre></div>
887 <p>The variable &lsquo;<samp>license</samp>&rsquo; is used for license information<a name="DOCF3" href="#FOOT3"><sup>3</sup></a>.
888 Some code in the program can be covered by license A, license B, or
889 license C. For &quot;separate licensing&quot; or &quot;heterogeneous licensing&quot;, we
890 suggest using <strong>|</strong> for a disjunction, <strong>&amp;</strong> for a conjunction
891 (if that ever happens in a significant way), and comma for heterogeneous
892 licensing. Comma would have lower precedence, plus added special terms.
893 </p>
894 <div class="example">
895 <pre class="example">license=&quot;LGPL, GPL | Artistic - added permission&quot;
896 </pre></div>
898 <a name="Writing-recipes"></a>
899 <h3 class="section">5.3 Writing recipes</h3>
900 <a name="index-writing-recipes"></a>
902 <p>Originally, Qi was designed for the series of Dragora GNU/Linux-Libre 3;
903 this doesn&rsquo;t mean you can&rsquo;t use it in another distribution, just that if
904 you do, you&rsquo;ll have to try it out for yourself. To help with this, here
905 are some references to well-written recipes:
906 </p>
907 <ul>
908 <li> <a href="https://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes">https://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes</a>
909 </li><li> <a href="https://notabug.org/dragora/dragora/src/master/recipes">https://notabug.org/dragora/dragora/src/master/recipes</a>
910 </li><li> <a href="https://notabug.org/dragora/dragora-extras/src/master/recipes">https://notabug.org/dragora/dragora-extras/src/master/recipes</a>
911 </li><li> <a href="https://git.savannah.nongnu.org/cgit/dragora/dragora-extras.git/tree/recipes">https://git.savannah.nongnu.org/cgit/dragora/dragora-extras.git/tree/recipes</a>
912 </li></ul>
914 <a name="Building-packages"></a>
915 <h3 class="section">5.4 Building packages</h3>
916 <a name="index-package-build"></a>
918 <p>A recipe is any valid regular file. Qi sets priorities for reading a
919 recipe, the order in which qi looks for a recipe is:
920 </p>
921 <ol>
922 <li> Current working directory.
924 </li><li> If the specified path name does not contain &quot;recipe&quot; as the last
925 component. Qi will complete it by adding &quot;recipe&quot; to the path name.
927 </li><li> If the recipe is not in the current working directory, it will be
928 searched under &lsquo;<samp>${worktree}/recipes</samp>&rsquo;. The last component will be
929 completed adding &quot;recipe&quot; to the specified path name.
930 </li></ol>
932 <p>To build a single package, type:
933 </p>
934 <div class="example">
935 <pre class="example">qi build x-apps/xterm
936 </pre></div>
938 <p>Multiple jobs can be passed to the compiler to speed up the build process:
939 </p>
940 <div class="example">
941 <pre class="example">qi build --jobs 3 x-apps/xterm
942 </pre></div>
944 <p>Update or install the produced package (if not already installed) when the
945 build command ends:
946 </p>
947 <div class="example">
948 <pre class="example">qi build -j3 --upgrade x-apps/xterm
949 </pre></div>
951 <p>Only process a recipe but do not create the binary package:
952 </p>
953 <div class="example">
954 <pre class="example">qi build --no-package dict/aspell
955 </pre></div>
957 <p>The options &ndash;install or &ndash;upgrade have no effect when &ndash;no-package
958 is given.
959 </p>
960 <p>This is useful to inspect the build process of the above recipe:
961 </p>
962 <p>qi build &ndash;keep &ndash;no-package dict/aspell 2&gt;&amp;1 | tee aspell-log.txt
963 </p>
964 <p>The &ndash;keep option could preserve the source directory and the destination
965 directory for later inspection. A log file of the build process will be
966 created redirecting both, standard error and standard output to tee(1).
967 </p>
968 <a name="Variables-from-the-environment"></a>
969 <h3 class="section">5.5 Variables from the environment</h3>
970 <a name="index-environment-variables"></a>
972 <p>Qi has environment variables which can be used at build time:
973 </p>
974 <p>The variable <code>TMPDIR</code> sets the temporary directory for sources, which is
975 used for package extractions (see <a href="#Examining-packages">Examining packages</a>) and is
976 prepended to the value of &lsquo;<samp>${srcdir}</samp>&rsquo; and &lsquo;<samp>${destdir}</samp>&rsquo; in
977 build command. By convention its default value is equal to
978 &lsquo;<samp>/usr/src/qi/build</samp>&rsquo;.
979 </p>
980 <p>The variables <code>QICFLAGS</code>, <code>QICXXFLAGS</code>, <code>QILDFLAGS</code>, and
981 <code>QICPPFLAGS</code> have no effect by default. The environment variables
982 such as <code>CFLAGS</code>, <code>CXXFLAGS</code>, <code>LDFLAGS</code>, and <code>CPPFLAGS</code>
983 are unset at compile time:
984 </p>
985 <p>Recommended practice is to set variables in the command line of
986 &lsquo;<samp>configure</samp>&rsquo; or <em>make(1)</em> instead of exporting to the
987 environment. As follows:
988 </p>
989 <p><a href="https://www.gnu.org/software/make/manual/html_node/Environment.html">https://www.gnu.org/software/make/manual/html_node/Environment.html</a>
990 </p><blockquote>
991 <p>It is not wise for makefiles to depend for their functioning on environment
992 variables set up outside their control, since this would cause different
993 users to get different results from the same makefile. This is against the
994 whole purpose of most makefiles.
995 </p></blockquote>
997 <p>Setting environment variables for configure is deprecated because running
998 configure in varying environments can be dangerous.
999 </p>
1000 <p><a href="https://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html">https://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html</a>
1001 </p><blockquote>
1002 <p>Variables not defined in a site shell script can be set in the environment
1003 passed to configure. However, some packages may run configure again
1004 during the build, and the customized values of these variables may be
1005 lost. In order to avoid this problem, you should set them in the
1006 configure command line, using &lsquo;<samp>VAR=value</samp>&rsquo;. For example:
1007 </p>
1008 <p><code>./configure CC=/usr/local2/bin/gcc</code>
1009 </p></blockquote>
1011 <p><a href="https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html">https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html</a>
1012 </p><blockquote>
1013 <p>If for instance the user runs &lsquo;<samp>CC=bizarre-cc ./configure</samp>&rsquo;, then the cache,
1014 config.h, and many other output files depend upon bizarre-cc being the C
1015 compiler. If for some reason the user runs ./configure again, or if it is
1016 run via &lsquo;<samp>./config.status --recheck</samp>&rsquo;, (See Automatic Remaking, and see
1017 config.status Invocation), then the configuration can be inconsistent,
1018 composed of results depending upon two different compilers.
1019 [...]
1020 Indeed, while configure can notice the definition of CC in &lsquo;<samp>./configure
1021 CC=bizarre-cc</samp>&rsquo;, it is impossible to notice it in &lsquo;<samp>CC=bizarre-cc
1022 ./configure</samp>&rsquo;, which, unfortunately, is what most users do.
1023 [...]
1024 configure: error: changes in the environment can compromise the build.
1025 </p></blockquote>
1027 <p>If the <code>SOURCE_DATE_EPOCH</code> environment variable is set to a UNIX timestamp
1028 (defined as the number of seconds, excluding leap seconds, since 01 Jan 1970
1029 00:00:00 UTC.); then the given timestamp will be used to overwrite any newer
1030 timestamps on the package contents (when it is created). More information
1031 about this can be found at
1032 <a href="https://reproducible-builds.org/specs/source-date-epoch/">https://reproducible-builds.org/specs/source-date-epoch/</a>.
1033 </p>
1034 <a name="The-meta-file"></a>
1035 <h3 class="section">5.6 The meta file</h3>
1036 <a name="index-the-meta-file"></a>
1038 <p>The &quot;meta file&quot; is a regular file created during the build process, it
1039 contains information about the package such as package name, package
1040 version, architecture, release, fetch address, description, and other
1041 minor data extracted from processed recipes. The name of the file is
1042 generated as &lsquo;<samp>${full_pkgname}.tlz.txt</samp>&rsquo;, and its purpose is to
1043 reflect essential information to the user without having to look inside
1044 the package content. The file format is also intended to be used by
1045 other scripts or by common Unix tools.
1046 </p>
1047 <p>The content of a meta file looks like:
1048 </p>
1049 <div class="example">
1050 <pre class="example">#
1051 # Pattern scanning and processing language.
1053 # The awk utility interprets a special-purpose programming language
1054 # that makes it possible to handle simple data-reformatting jobs
1055 # with just a few lines of code. It is a free version of 'awk'.
1057 # GNU awk implements the AWK utility which is part of
1058 # IEEE Std 1003.1 Shell and Utilities (XCU).
1061 QICFLAGS=&quot;-O2&quot;
1062 QICXXFLAGS=&quot;-O2&quot;
1063 QILDFLAGS=&quot;&quot;
1064 QICPPFLAGS=&quot;&quot;
1065 pkgname=gawk
1066 pkgversion=5.0.1
1067 arch=amd64
1068 release=1
1069 pkgcategory=&quot;tools&quot;
1070 full_pkgname=gawk_5.0.1_amd64-1@tools
1071 blurb=&quot;Pattern scanning and processing language.&quot;
1072 homepage=&quot;https://www.gnu.org/software/gawk&quot;
1073 license=&quot;GPLv3+&quot;
1074 fetch=&quot;https://ftp.gnu.org/gnu/gawk/gawk-5.0.1.tar.lz&quot;
1075 replace=&quot;&quot;
1076 </pre></div>
1078 <p>A package descriptions is extracted from the variable &lsquo;<samp>description</samp>&rsquo;
1079 where each line is interpreted literally and pre-formatted to fit in
1080 (exactly) <strong>80 columns</strong>, plus the character &lsquo;<samp>#</samp>&rsquo; and a blank
1081 space is prefixed to every line (shell comments).
1082 </p>
1083 <p>In addition to the Special variables, there are implicit variables such as
1084 &lsquo;<samp>blurb</samp>&rsquo;:
1085 </p>
1086 <p>The &lsquo;<samp>blurb</samp>&rsquo; variable is related to the special variable
1087 &lsquo;<samp>description</samp>&rsquo;. Its value is made from the first (substantial)
1088 line of &lsquo;<samp>description</samp>&rsquo;, mentioned as the &quot;brief description&quot;.
1089 </p>
1090 <p>The build flags such as &lsquo;<samp>QICFLAGS</samp>&rsquo;, &lsquo;<samp>QICXXFLAGS</samp>&rsquo;,
1091 &lsquo;<samp>QILDFLAGS</samp>&rsquo;, and &lsquo;<samp>QICPPFLAGS</samp>&rsquo; are only added to the meta file
1092 if the declared variable &lsquo;<samp>arch</samp>&rsquo; is not equal to the &quot;noarch&quot; value.
1093 </p>
1094 <hr>
1095 <a name="Order-files"></a>
1096 <div class="header">
1098 Next: <a href="#Creating-packages" accesskey="n" rel="next">Creating packages</a>, Previous: <a href="#Recipes" accesskey="p" rel="prev">Recipes</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
1099 </div>
1100 <a name="Order-files-1"></a>
1101 <h2 class="chapter">6 Order files</h2>
1102 <a name="index-handling-build-order"></a>
1104 <p>The order command has the purpose of resolving the build order through
1105 .order files. An order file contains a list of recipe names, by default
1106 does not perform any action other than to print a resolved list in
1107 descending order. For example, if <strong>a</strong> depends on <strong>b</strong> and
1108 <strong>c</strong>, and <strong>c</strong> depends on <strong>b</strong> as well, the file might
1109 look like:
1110 </p>
1111 <div class="example">
1112 <pre class="example">a: c b
1114 c: b
1115 </pre></div>
1117 <p>Each letter represents a recipe name, complete dependencies for
1118 the first recipe name are listed in descending order, which is
1119 printed from right to left, and removed from left to right:
1120 </p>
1121 <p><small>OUTPUT</small>
1122 </p>
1123 <div class="example">
1124 <pre class="example">b
1127 </pre></div>
1129 <p>Blank lines, colons and parentheses are simply ignored. Comment lines
1130 beginning with &lsquo;<samp>#</samp>&rsquo; are allowed.
1131 </p>
1132 <p>An order file could be used to build a series of packages, for example,
1133 if the content is:
1134 </p>
1135 <div class="example">
1136 <pre class="example"># Image handling libraries
1138 libs/libjpeg-turbo: devel/nasm
1139 x-libs/jasper: libs/libjpeg-turbo
1140 libs/tiff: libs/libjpeg-turbo
1141 </pre></div>
1143 <p>To proceed with each recipe, we can type:
1144 </p>
1145 <div class="example">
1146 <pre class="example">qi order imglibs.order | qi build --install -
1147 </pre></div>
1149 <p>The output of &lsquo;<samp>qi order imglibs.order</samp>&rsquo; tells to qi in which order it
1150 should build the recipes:
1151 </p>
1152 <div class="example">
1153 <pre class="example">devel/nasm
1154 libs/libjpeg-turbo
1155 x-libs/jasper
1156 libs/tiff
1157 </pre></div>
1160 <hr>
1161 <a name="Creating-packages"></a>
1162 <div class="header">
1164 Next: <a href="#Examining-packages" accesskey="n" rel="next">Examining packages</a>, Previous: <a href="#Order-files" accesskey="p" rel="prev">Order files</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
1165 </div>
1166 <a name="Creating-packages-1"></a>
1167 <h2 class="chapter">7 Creating packages</h2>
1168 <a name="index-package-creation"></a>
1170 <p>The creation command is an internal function of qi to make new Qi
1171 compatible packages. A package is produced using the contents of
1172 the Current Working Directory and the package file is written out.
1173 </p>
1174 <div class="example">
1175 <pre class="example">Usage: qi create [<var>Output/PackageName.tlz</var>]...
1176 </pre></div>
1178 <p>The argument for the file name to be written must contain a fully
1179 qualified named directory as the output directory where the package
1180 produced will be written. The file name should be composed using the
1181 full name: name-version-architecture-release[@pkgcategory].tlz
1182 </p>
1183 <p><small>EXAMPLE</small>
1184 </p>
1185 <div class="example">
1186 <pre class="example">cd /usr/pkg
1187 cd claws-mail_3.17.1_amd64-1@x-apps
1188 qi create /var/cache/qi/packages/claws-mail_3.17.1_amd64-1@x-apps
1189 </pre></div>
1191 <p>In this case, the package &quot;claws-mail_3.17.1_amd64-1@x-apps&quot; will be
1192 written into &lsquo;<samp>/var/cache/qi/packages/</samp>&rsquo;.
1193 </p>
1194 <p>All packages produced are complemented by a checksum file (.sha256).
1195 </p>
1197 <hr>
1198 <a name="Examining-packages"></a>
1199 <div class="header">
1201 Next: <a href="#Qi-exit-status" accesskey="n" rel="next">Qi exit status</a>, Previous: <a href="#Creating-packages" accesskey="p" rel="prev">Creating packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
1202 </div>
1203 <a name="Examining-packages-1"></a>
1204 <h2 class="chapter">8 Examining packages</h2>
1205 <a name="index-package-examination"></a>
1207 <p>The extraction command serves to examine binary packages for debugging
1208 purposes. It decompresses a package into a single directory, verifying
1209 its integrity and preserving all of its properties (owner and permissions).
1210 </p>
1211 <div class="example">
1212 <pre class="example">Usage: qi extract [<var>packagename.tlz</var>]...
1213 </pre></div>
1215 <p><small>EXAMPLE</small>
1216 </p>
1217 <div class="example">
1218 <pre class="example">qi extract mksh_R56c_amd64-1@shells.tlz
1219 </pre></div>
1221 <p>This action will put the content of &quot;mksh_R56c_amd64-1@shells.tlz&quot; into a
1222 single directory, this is a private directory for the user who requested
1223 the action, creation operation will be equal to <strong>u=rwx,g=,o= (0700)</strong>.
1224 The package content will reside on this location, default mask to deploy
1225 the content will be equal to <strong>u=rwx,g=rwx,o=rwx (0000)</strong>.
1226 </p>
1227 <p>Note: the creation of the custom directory is influenced by the value
1228 of the <code>TMPDIR</code> variable.
1229 </p>
1231 <hr>
1232 <a name="Qi-exit-status"></a>
1233 <div class="header">
1235 Next: <a href="#Index" accesskey="n" rel="next">Index</a>, Previous: <a href="#Examining-packages" accesskey="p" rel="prev">Examining packages</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
1236 </div>
1237 <a name="Qi-exit-status-1"></a>
1238 <h2 class="chapter">9 Qi exit status</h2>
1239 <a name="index-exit-codes"></a>
1241 <p>All the exit codes are described in this chapter.
1242 </p>
1243 <dl compact="compact">
1244 <dt>&lsquo;<samp>0</samp>&rsquo;</dt>
1245 <dd><p>Successful completion (no errors).
1246 </p>
1247 </dd>
1248 <dt>&lsquo;<samp>1</samp>&rsquo;</dt>
1249 <dd><p>Minor common errors:
1250 </p>
1251 <ul>
1252 <li> Help usage on invalid options or required arguments.
1254 </li><li> Program needed by qi (prerequisite) is not available.
1255 </li></ul>
1257 </dd>
1258 <dt>&lsquo;<samp>2</samp>&rsquo;</dt>
1259 <dd><p>Command execution error:
1260 </p>
1261 <p>This code is used to return the evaluation of an external command or shell
1262 arguments in case of failure.
1263 </p>
1264 </dd>
1265 <dt>&lsquo;<samp>3</samp>&rsquo;</dt>
1266 <dd><p>Integrity check error for compressed files.
1267 </p>
1268 <p>Compressed files means:
1269 </p>
1270 <ul>
1271 <li> A tarball file from tar(1).
1272 Supported extensions: .tar, .tar.gz, .tgz, .tar.Z, .tar.bz2, .tbz2, .tbz,
1273 .tar.xz, .txz
1275 </li><li> A tarball file from tarlz(1).
1276 Supported extensions: .tar.lz, .tlz
1278 </li><li> Zip files from unzip(1).
1279 Supported extensions: .zip, .ZIP
1281 </li><li> Gzip files from gzip(1).
1282 Supported extensions: .gz, .Z
1284 </li><li> Bzip2 files from bzip2(1).
1285 Supported extension: .bz2
1287 </li><li> Lzip files from lzip(1).
1288 Supported extension: .lz
1290 </li><li> Xz files from xz(1).
1291 Supported extension: .xz
1292 </li></ul>
1294 </dd>
1295 <dt>&lsquo;<samp>4</samp>&rsquo;</dt>
1296 <dd><p>File empty, not regular, or expected.
1297 </p>
1298 <p>It&rsquo;s commonly expected:
1299 </p>
1300 <ul>
1301 <li> An argument for giving commands.
1303 </li><li> A regular file or readable directory.
1305 </li><li> An expected extension: .tlz, .sha256, .order.
1307 </li><li> A protocol supported by the network downloader tool.
1308 </li></ul>
1310 </dd>
1311 <dt>&lsquo;<samp>5</samp>&rsquo;</dt>
1312 <dd><p>Empty or not defined variable:
1313 </p>
1314 <p>This code is used to report empty or undefined variables (usually
1315 variables coming from a recipe or assigned arrays that are tested).
1316 </p>
1317 </dd>
1318 <dt>&lsquo;<samp>6</samp>&rsquo;</dt>
1319 <dd><p>Package already installed:
1320 </p>
1321 <p>The package directory for an incoming .tlz package already exists.
1322 </p>
1323 </dd>
1324 <dt>&lsquo;<samp>10</samp>&rsquo;</dt>
1325 <dd><p>Network manager error:
1326 </p>
1327 <p>This code is used if the network downloader tool fails for some reason.
1328 </p></dd>
1329 </dl>
1332 <hr>
1333 <a name="Index"></a>
1334 <div class="header">
1336 Previous: <a href="#Qi-exit-status" accesskey="p" rel="prev">Qi exit status</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="#Index" title="Index" rel="index">Index</a>]</p>
1337 </div>
1338 <a name="Index-1"></a>
1339 <h2 class="unnumbered">Index</h2>
1341 <table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
1342 &nbsp;
1343 <a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
1344 &nbsp;
1345 <a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
1346 &nbsp;
1347 <a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
1348 &nbsp;
1349 <a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
1350 &nbsp;
1351 <a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
1352 &nbsp;
1353 <a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
1354 &nbsp;
1355 <a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
1356 &nbsp;
1357 <a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
1358 &nbsp;
1359 <a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
1360 &nbsp;
1361 <a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
1362 &nbsp;
1363 </td></tr></table>
1364 <table class="index-cp" border="0">
1365 <tr><td></td><th align="left">Index Entry</th><td>&nbsp;</td><th align="left"> Section</th></tr>
1366 <tr><td colspan="4"> <hr></td></tr>
1367 <tr><th><a name="Index_cp_letter-C">C</a></th><td></td><td></td></tr>
1368 <tr><td></td><td valign="top"><a href="#index-configuration-file">configuration file</a>:</td><td>&nbsp;</td><td valign="top"><a href="#The-qirc-file">The qirc file</a></td></tr>
1369 <tr><td colspan="4"> <hr></td></tr>
1370 <tr><th><a name="Index_cp_letter-E">E</a></th><td></td><td></td></tr>
1371 <tr><td></td><td valign="top"><a href="#index-environment-variables">environment variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1372 <tr><td></td><td valign="top"><a href="#index-exit-codes">exit codes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Qi-exit-status">Qi exit status</a></td></tr>
1373 <tr><td colspan="4"> <hr></td></tr>
1374 <tr><th><a name="Index_cp_letter-H">H</a></th><td></td><td></td></tr>
1375 <tr><td></td><td valign="top"><a href="#index-handling-build-order">handling build order</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Order-files">Order files</a></td></tr>
1376 <tr><td colspan="4"> <hr></td></tr>
1377 <tr><th><a name="Index_cp_letter-I">I</a></th><td></td><td></td></tr>
1378 <tr><td></td><td valign="top"><a href="#index-introduction-to-qi">introduction to qi</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Introduction-to-Qi">Introduction to Qi</a></td></tr>
1379 <tr><td></td><td valign="top"><a href="#index-invocation">invocation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Invoking-qi">Invoking qi</a></td></tr>
1380 <tr><td colspan="4"> <hr></td></tr>
1381 <tr><th><a name="Index_cp_letter-M">M</a></th><td></td><td></td></tr>
1382 <tr><td></td><td valign="top"><a href="#index-managing-packages">managing packages</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1383 <tr><td colspan="4"> <hr></td></tr>
1384 <tr><th><a name="Index_cp_letter-P">P</a></th><td></td><td></td></tr>
1385 <tr><td></td><td valign="top"><a href="#index-package-blacklist">package blacklist</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1386 <tr><td></td><td valign="top"><a href="#index-package-build">package build</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1387 <tr><td></td><td valign="top"><a href="#index-package-conflicts">package conflicts</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1388 <tr><td></td><td valign="top"><a href="#index-package-creation">package creation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Creating-packages">Creating packages</a></td></tr>
1389 <tr><td></td><td valign="top"><a href="#index-package-de_002dinstallation">package de-installation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1390 <tr><td></td><td valign="top"><a href="#index-package-examination">package examination</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Examining-packages">Examining packages</a></td></tr>
1391 <tr><td></td><td valign="top"><a href="#index-package-installation">package installation</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1392 <tr><td></td><td valign="top"><a href="#index-package-upgrade">package upgrade</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Packages">Packages</a></td></tr>
1393 <tr><td colspan="4"> <hr></td></tr>
1394 <tr><th><a name="Index_cp_letter-R">R</a></th><td></td><td></td></tr>
1395 <tr><td></td><td valign="top"><a href="#index-recipes">recipes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1396 <tr><td colspan="4"> <hr></td></tr>
1397 <tr><th><a name="Index_cp_letter-S">S</a></th><td></td><td></td></tr>
1398 <tr><td></td><td valign="top"><a href="#index-special-variables">special variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1399 <tr><td colspan="4"> <hr></td></tr>
1400 <tr><th><a name="Index_cp_letter-T">T</a></th><td></td><td></td></tr>
1401 <tr><td></td><td valign="top"><a href="#index-the-meta-file">the meta file</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1402 <tr><td colspan="4"> <hr></td></tr>
1403 <tr><th><a name="Index_cp_letter-V">V</a></th><td></td><td></td></tr>
1404 <tr><td></td><td valign="top"><a href="#index-variables">variables</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1405 <tr><td colspan="4"> <hr></td></tr>
1406 <tr><th><a name="Index_cp_letter-W">W</a></th><td></td><td></td></tr>
1407 <tr><td></td><td valign="top"><a href="#index-writing-recipes">writing recipes</a>:</td><td>&nbsp;</td><td valign="top"><a href="#Recipes">Recipes</a></td></tr>
1408 <tr><td colspan="4"> <hr></td></tr>
1409 </table>
1410 <table><tr><th valign="top">Jump to: &nbsp; </th><td><a class="summary-letter" href="#Index_cp_letter-C"><b>C</b></a>
1411 &nbsp;
1412 <a class="summary-letter" href="#Index_cp_letter-E"><b>E</b></a>
1413 &nbsp;
1414 <a class="summary-letter" href="#Index_cp_letter-H"><b>H</b></a>
1415 &nbsp;
1416 <a class="summary-letter" href="#Index_cp_letter-I"><b>I</b></a>
1417 &nbsp;
1418 <a class="summary-letter" href="#Index_cp_letter-M"><b>M</b></a>
1419 &nbsp;
1420 <a class="summary-letter" href="#Index_cp_letter-P"><b>P</b></a>
1421 &nbsp;
1422 <a class="summary-letter" href="#Index_cp_letter-R"><b>R</b></a>
1423 &nbsp;
1424 <a class="summary-letter" href="#Index_cp_letter-S"><b>S</b></a>
1425 &nbsp;
1426 <a class="summary-letter" href="#Index_cp_letter-T"><b>T</b></a>
1427 &nbsp;
1428 <a class="summary-letter" href="#Index_cp_letter-V"><b>V</b></a>
1429 &nbsp;
1430 <a class="summary-letter" href="#Index_cp_letter-W"><b>W</b></a>
1431 &nbsp;
1432 </td></tr></table>
1434 <div class="footnote">
1435 <hr>
1436 <h4 class="footnotes-heading">Footnotes</h4>
1438 <h3><a name="FOOT1" href="#DOCF1">(1)</a></h3>
1439 <p>For more details about tarlz and the
1440 lzip format, visit <a href="https://lzip.nongnu.org/tarlz.html">https://lzip.nongnu.org/tarlz.html</a>.</p>
1441 <h3><a name="FOOT2" href="#DOCF2">(2)</a></h3>
1442 <p>The official guide for Graft can be found at
1443 <a href="https://peters.gormand.com.au/Home/tools/graft/graft.html">https://peters.gormand.com.au/Home/tools/graft/graft.html</a>.</p>
1444 <h3><a name="FOOT3" href="#DOCF3">(3)</a></h3>
1445 <p>The proposal for &lsquo;<samp>license</samp>&rsquo; was made by Richard M. Stallman at
1446 <a href="https://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html">https://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html</a>.</p>
1447 </div>
1448 <hr>
1452 </body>
1453 </html>