qi: doc: corrections coming from Antonio Diaz Diaz
[dragora.git] / qi / doc / qi.texi
blobd0dc502131b7fc4960b29a92d876f8883bc09704
1 \input texinfo   @c -*-texinfo-*-
2 @comment $Id@w{$}
3 @comment %**start of header
4 @setfilename qi.info
5 @settitle Qi user guide
6 @documentencoding ISO-8859-1
7 @syncodeindex pg cp
8 @comment %**end of header
10 @set VERSION 1.0-rc59
11 @set UPDATED 4 April 2019
13 @copying
14 This user guide is for Qi (version @value{VERSION},
15 @value{UPDATED}), which is a simple but well-integrated package manager.
17 Copyright @copyright{} 2019 Matias Andres Fonzo, Santiago del Estero,
18 Argentina.
20 @quotation
21 Permission is granted to copy, distribute and/or modify this document
22 under the terms of the GNU Free Documentation License, Version 1.3 or
23 any later version published by the Free Software Foundation; with no
24 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
25 Texts.  A copy of the license is included in the section entitled
26 ``GNU Free Documentation License''.
27 @end quotation
28 @end copying
30 @dircategory Package management
31 @direntry
32 * Qi: (qi).                   A user-friendly package manager.
33 @end direntry
35 @titlepage
36 @finalout
37 @title Qi
38 @subtitle for version @value{VERSION}, @value{UPDATED}
39 @author Matias Fonzo (@email{selk@@dragora.org})
41 @page
42 @vskip 0pt plus 1filll
43 @insertcopying
44 @end titlepage
46 @contents
48 @ifnottex
49 @node Top
50 @top
52 This user guide is for Qi (version @value{VERSION},
53 @value{UPDATED}).
54 @end ifnottex
56 @menu
57 * Introduction::              Description and features of qi
58 * Invoking qi::               Command-line options
59 * The qirc file::             Configuration file
60 * Packages::                  Managing packages
61 * Recipes::                   Building packages
62 * Order files::               Handling build order
63 * Creating packages::         Making Qi packages
64 * Examining packages::        Debugging purposes
65 * Exit status::               Exit codes
66 * License::                   GNU Free Documentation License
67 * Index::
68 @end menu
70 @sp 1
71 Copyright (C) 2019 Matias Fonzo.
73 Qi's home page can be found at @uref{http://www.dragora.org}.
74 @w{Send bug reports or suggestions to @email{dragora-users@@nongnu.org}.}
76 @node Introduction
77 @chapter Introduction
78 @cindex introduction
80 Qi is a simple but well-integrated package manager.  It can create,
81 install, remove, and upgrade software packages.  Qi produces binary
82 packages using recipes, which are files containing specific instructions
83 to build each package from source.  Qi can manage multiple packages
84 under a single directory hierarchy.  This method allows to maintain a set
85 of packages and multiple versions of them.  This means that Qi could be
86 used as the main package manager or complement the existing one.
88 Qi offers a friendly command line interface, a global configuration
89 file, a simple recipe layout to deploy software packages; also works
90 with binary packages in parallel, speeding up installations and packages
91 in production.  The format used for packages is a simplified but safe
92 POSIX pax archive compressed with lzip.
94 Qi is a modern (POSIX-compliant) shell script released under the
95 terms of the GNU General Public License.  There are only two major
96 dependencies for the magic: graft(1) and tarlz(1), the rest is expected
97 to be found in any Unix-like system.
99 @node Invoking qi
100 @chapter Invoking qi
101 @cindex invocation
103 This chapter describes the synopsis and command line options for
104 invoke Qi.
106 @example
107 Usage: qi [@var{OPTION}]... [@var{FILE}]...
108 @end example
110 @noindent
111 One mandatory option specifies the operation that @samp{qi} should
112 perform, other options are meant to detail how this operation should be
113 performed.
115 @noindent
116 qi supports the following options to operate:
118 @table @code
119 @item -b
120 Build package using recipe names.
122 @item -c
123 Create .tlz package from directory.
125 @item -d
126 Delete packages.
128 @item -i
129 Install packages.
131 @item -o
132 Resolve build order through .order files.
134 @item -u
135 Update packages (implies -i, -d and -p options).
137 @item -w
138 Warn about files that will be linked.
140 @item -x
141 Extract a package for debugging purposes.
142 @end table
144 @noindent
145 There are common options between modes:
147 @table @code
148 @item -N
149 Do not read the configuration file.
151 This will ignore any value in the qirc file.
153 @item -P <DIR>
154 Package directory for installations.
156 This option sets @samp{$@{packagedir@}}.
158 Only valid for -i, -d, or -u options.
160 @item -f
161 Force option.
163 This option can force the build of a recipe, or force the update of a
164 pre-existing package.
166 Only valid for -b, -u options.
168 @item -t <DIR>
169 Target directory for symbolic links.
171 This option sets @samp{$@{targetdir@}}.
173 Only valid for -i, -d, or -u options.
175 @item -k
176 Keep (don't delete) @samp{$@{srcdir@}} or @samp{$@{destdir@}} in build
177 mode, keep (don't delete) package directory in delete mode.
179 Only valid for -b, -d or -u options.
181 @item -p
182 Prune conflicts on package installations.
184 This option may proceed with the package installation if one or more
185 conflicts occur.
187 @item -r /rootdir
188 Use the fully qualified named directory as the root directory for all qi
189 operations.  The target directory and package directory will be relative
190 to the specified directory, including the log file for graft.
192 @item -v
193 Be verbose (a 2nd -v gives more).
194 @end table
196 @noindent
197 Options for build mode (-b):
199 @table @code
200 @item -O <DIR>
201 Where the packages produced are written.
203 This option sets @samp{$@{outdir@}}.
205 @item -W <DIR>
206 Where archives, patches, and recipes are expected.
208 This option sets @samp{$@{worktree@}}.
210 @item -Z <DIR>
211 Where (compressed) sources will be found.
213 This option sets @samp{$@{tardir@}}.
215 @item -a
216 Architecture to use.
218 Default value is obtained via uname(1) as @samp{uname -m}.
220 @item -j
221 Parallel jobs for the compiler.
223 If not specified, default sets to 1.
225 @item -1
226 Increment release number (@samp{$@{release@}} + 1).
228 It will be omitted if the -n option is being used.
230 @item -n
231 Don't create a .tlz package.
233 @item -S
234 Selects the option to skip completed recipes.
236 This means, in interactive mode, when the dialog
237 to summarize recipes is shown.
238 @end table
240 @noindent
241 Informative options:
243 @table @code
244 @item -L
245 Print default directory locations.
247 This will print the target directory, package directory, working tree,
248 the directory for tarballs, and the output directory for the packages
249 produced.
251 @item -h
252 Display the help describing the options and then exit.
254 @item -V
255 Print the version number and license information.
256 The version number should be included in all bug reports.
257 @end table
259 @noindent
260 Expected non-option arguments are package directories and regular files:
261 recipes or files ending in .tlz, .order.  When FILE is -, qi can read from
262 the standard input.  See examples in @ref{Packages}.
265 @node The qirc file
266 @chapter The qirc file
267 @cindex configuration file
269 The global @file{qirc} file offers a way to define variables and tools
270 (such as a download manager) for default use.  This file is used by qi
271 at runtime, e.g., to build, install, remove or upgrade packages.
273 @noindent
274 It has the following rules:
276 @itemize @bullet
277 @item Variables must be declared as @samp{name=value}.
279 @item Declaration of values should only take one line, no line break.
281 @item For security reasons, assignments like @samp{name=$var} are only
282 interpreted as literal.
283 @end itemize
285 @noindent
286 The command line options related to the package directory and target
287 directory plus some of the options used for the build mode can override
288 some values in @file{qirc}.  See @ref{Invoking qi}.
290 @noindent
291 The order in which qi looks for this file is:
293 @enumerate
294 @item
295 @env{$@{HOME@}/.qirc}
296 @- Effective user.
298 @item
299 @samp{$@{sysconfdir@}/qirc}
300 @- System-wide.
301 @end enumerate
303 If you intend to run qi as effective user, the file
304 @samp{$@{sysconfdir@}/qirc} could be copied to @env{$@{HOME@}/.qirc}
305 setting the paths for @samp{$@{packagedir@}} and @samp{$@{targetdir@}}
306 according to the @env{$HOME}.
309 @node Packages
310 @chapter Packages
311 @cindex managing packages
313 A package is a suite of programs usually distributed in binary form
314 which may also contain manual pages, documentation, or any other file
315 associated to a specific software.
317 The package format used by qi is a simplified POSIX pax archive
318 compressed with lzip.  The file extension for packages is @samp{.tlz}.
320 @noindent
321 Both package installation and package de-installation are managed using
322 two important (internal) variables: @samp{$@{packagedir@}} and
323 @samp{$@{targetdir@}}, these values can be changed in the
324 configuration file or via options.
326 @samp{$@{packagedir@}} is a common directory tree where the package
327 contents will be decompressed (will reside).
329 @samp{$@{targetdir@}} is a target directory where the links will be
330 made by graft(1) taking @samp{$@{packagedir@}/package_name} into account.
332 @noindent
333 Packages are installed in self-contained directory trees and symbolic
334 links from a common area are made to the package files.  This allows
335 multiple versions of the same package to coexist on the same system.
337 @section Package conflicts
338 @cindex package conflicts
340 All the links to install or remove a package are handled by graft(1).
341 Since multiple packages can be installed or removed at the same time,
342 certain conflicts may arise between the packages.
344 @noindent
345 graft@footnote{The official guide for Graft can be found at
346 @url{http://peters.gormand.com.au/Home/tools/graft/graft.html}.}
347 defines a CONFLICT as one of the following conditions:
349 @itemize @bullet
350 @item
351 If the package object is a directory and the target object exists but is
352 not a directory.
354 @item
355 If the package object is not a directory and the target object exists
356 and is not a symbolic link.
358 @item
359 If the package object is not a directory and the target object exists
360 and is a symbolic link to something other than the package object.
361 @end itemize
363 @noindent
364 The default behavior of qi for an incoming package is to ABORT if a
365 conflict arises.  When a package is going to be deleted, qi tells to
366 graft(1) to remove those parts that are not in conflict, leaving the
367 links to the belonging package.  This behavior can be forced if the
368 -p option is given.
370 @section Installing packages
371 @cindex package installation
373 To install a single package, simply type:
375 @example
376 qi -i coreutils-8.30-i586+1.tlz
377 @end example
379 @noindent
380 To install multiple packages at once, type:
382 @example
383 qi -i gcc-8.3.0-i586+1.tlz rafaela-2.2-i586+1.tlz ...
384 @end example
386 @noindent
387 Warn about the files that will be linked:
389 @example
390 qi -w bash-5.0-i586+1.tlz
391 @end example
393 This is to verify the content of a package before installing it.
395 @noindent
396 See the process of an installation (very verbose):
398 @example
399 qi -i -v mariana-3.0-i586+1.tlz
400 @end example
402 A second -v gives more.
404 @noindent
405 Installing package in a different location:
407 @example
408 qi -r /media/floppy -i lzip-1.21-i586+1.tlz
409 @end example
411 The -r option assumes @samp{$@{targetdir@}} and @samp{$@{packagedir@}}.
412 See:
414 @example
415 qi -r /home/selk -P /pkgs -t / -i lzip-1.21-i586+1.tlz
416 @end example
418 In this case the content of "lzip-1.21-i586+1.tlz" will be decompressed
419 into @samp{/home/selk/pkgs/lzip-1.21-i586+1}.  Assuming that the main
420 binary for lzip is under @samp{/home/selk/pkgs/lzip-1.21-i586+1/usr/bin/}
421 the target for "usr/bin" will be created at @samp{/home/selk}.  Considering
422 that you have exported the @env{PATH} as @samp{$@{HOME@}/usr/bin}, now the
423 system is able to see the recent lzip.
425 @noindent
426 Installing from a list of packages using standard input:
428 @example
429 cat FILELIST.txt | qi -i -
430 @end example
432 The list of packages must contain full path names to be passed in the
433 installation, e.g.:
434 /var/cache/qi/packages/x86_64/devel/tcl-8.6.9-x86_64+1.tlz
435 /var/cache/qi/packages/x86_64/devel/tk-8.6.9.1-x86_64+1.tlz
436 /var/cache/qi/packages/x86_64/devel/vala-0.42.3-x86_64+1.tlz
438 @section Removing packages
439 @cindex package de-installation
441 To remove a package, simply type:
443 @example
444 qi -d xz-5.2.4-i586+1.tlz
445 @end example
447 @noindent
448 Delete mode will match the package name using @samp{$@{packagedir@}} as
449 prefix.  For example, if the value of @samp{$@{packagedir@}} is set to
450 /usr/local/pkgs, this will be equal to:
452 @example
453 qi -d /usr/local/pkgs/xz-5.2.4-i586+1
454 @end example
456 @noindent
457 Detailed output (very verbose):
459 @example
460 qi -d -v /usr/local/pkgs/xz-5.2.4-i586+1
461 @end example
463 A second -v gives more.
465 @noindent
466 By default the delete mode does not preserve a package directory after
467 removing its links from @samp{$@{targetdir@}}, but this behavior can be
468 changed if the -k option is passed:
470 @example
471 qi -d -k /usr/local/pkgs/lzip-1.21-i586+1
472 @end example
474 This means that the links to the package can be reactivated, later:
476 @example
477 cd /usr/local/pkgs && graft -i lzip-1.21-i586+1
478 @end example
480 @noindent
481 Removing package from a different location:
483 @example
484 qi -r /home/cthulhu -P /pkgs -t / -d xz-5.2.4-i586+1
485 @end example
487 @noindent
488 Removing a package using standard input:
490 @example
491 echo "vala-0.42.3-x86_64+1" | qi -d -
492 @end example
494 This will match with the package directory.
496 @section Upgrading packages
497 @cindex package upgrade
499 The upgrade mode inherits the properties of the installation and removal
500 process.  To make sure that a package is updated, the package is installed
501 in a temporary directory taking @samp{$@{packagedir@}} into account.  Once
502 the incoming package is pre-installed, qi can proceed to search and delete
503 packages that have the same name (considered as previous ones).  Finally,
504 the package is re-installed at its final location and the temporary
505 directory is removed.
507 @noindent
508 To upgrade a package, just type:
510 @example
511 qi -u gcc-9.0.1-i586+1.tlz
512 @end example
514 This will proceed to update "gcc-9.0.1-i586+1" removing other versions
515 of "gcc" (if any).
517 @noindent
518 If you want to keep the package directories of versions found during the
519 upgrade process, just pass:
521 @example
522 qi -u -k gcc-9.0.1-i586+1.tlz
523 @end example
525 @noindent
526 To see the upgrade process (very verbose):
528 @example
529 qi -u -v gcc-9.0.1-i586+1.tlz
530 @end example
532 A second -v gives more.
534 @noindent
535 To force the upgrade of an existing package:
537 @example
538 qi -u -f gcc-9.0.1-i586+1.tlz
539 @end example
541 @subsection Package blacklist
542 @cindex package blacklist
544 To implement general package facilities, either to install, remove or
545 maintain the hierarchy of packages in a clean manner, qi makes use of the
546 pruning operation via graft(1):
548 There is a risk if those are crucial packages for the proper functioning
549 of the system, because it implies the deactivation of symbolic from the
550 target directory, @emph{especially} when transitioning an incoming package
551 into its final location during upgrade.
553 @noindent
554 A blacklist of package names has been devised for the case where
555 a user decides to upgrade all packages in the system, or
556 just the crucial ones, such as the C library.
558 The blacklist is related to the upgrade mode only, consists in installing
559 a package instead of updating it or removing previous versions of it;
560 the content of the package will be updated over the existing content at
561 @samp{$@{packagedir@}}, while the existing links from
562 @samp{$@{targetdir@}} will be preserved.  A pruning of links will be
563 carried out in order to re-link possible differences with the recent
564 content, this helps to avoid leaving dead links in the target directory.
566 @noindent
567 Since the upgrade mode is also used to install a new package, the mechanism
568 for blacklist is to install a declared package if it does not already
569 exist.  If it already exists, it is verified that the binary package is
570 newer than the package directory in order to perform an update.
572 Package names for the blacklist can be set from the configuration file.
575 @node Recipes
576 @chapter Recipes
577 @cindex recipes
579 A recipe is a file telling qi what to do.  Most often, the recipe tells
580 qi how to build a binary package from a source tarball.
582 A recipe has two parts: a list of variable definitions and a list of
583 sections.  By convention, the syntax of a section is:
585 @example
586 section_name()
588     section lines
590 @end example
592 The section name is followed by parentheses, one newline and an opening
593 brace.  The line finishing the section contains just a closing brace.
594 The section names or the function names currently recognized are
595 @samp{build}.
597 The @samp{build} section is an augmented shell script.  This is the main
598 section (or @strong{shell function}) which contains the instructions to
599 build and produce a package.
601 @section Variables
602 @cindex variables
604 A "variable" is a @strong{shell variable} defined either in @file{qirc}
605 or in a recipe to represent a string of text, called the variable's
606 "value".  These values are substituted by explicit request in the
607 definitions of other variables or in calls to external commands.
609 Variables can represent lists of file names, options to pass to
610 compilers, programs to run, directories to look in for source files,
611 directories to write output to, or anything else you can imagine.
613 Definitions of variables in qi have four levels of precedence.
614 Options which define variables from the command-line override those
615 specified in the @file{qirc} file, while variables defined in the recipe
616 override those specified in @file{qirc}, taking priority over those
617 variables set by command-line options.  Finally, the variables have
618 default values if they are not defined anywhere.
620 Options that set variables through the command-line can only reference
621 variables defined in @file{qirc} and variables with default values.
623 Definitions of variables in @file{qirc} can only reference variables
624 previously defined in @file{qirc} and variables with default values.
626 Definitions of variables in the recipe can only reference variables
627 set by the command-line, variables previously defined in the recipe,
628 variables defined in @file{qirc}, and variables with default values.
630 @section Special variables
631 @cindex special variables
633 There are variables which can only be set using the command line options or
634 via @file{qirc}, there are other special variables which can be defined or
635 redefined in a recipe.  See the following definitions:
637 @samp{outdir} is the directory where the packages produced are written.
638 This variable can not be redefined in the recipe.  Default sets to
639 @samp{/var/cache/qi/packages}.
641 @samp{worktree} is the working tree where archives, patches, and recipes
642 are expected.  This variable can not be redefined in the recipe.  Default
643 sets to @samp{/usr/src/qi}.
645 @samp{tardir} is defined in the recipe to the directory where the tarball
646 containing the source can be found.  The full name of the tarball is
647 composed as @samp{$@{tardir@}/$tarname}.  Its value is available in the
648 recipe as @samp{$@{tardir@}}; a value of . for @samp{tardir} sets it to
649 the value of CWD (Current Working Directory), this is where the recipe
650 lives.
652 @samp{arch} is the architecture to compose the package name.  Its value is
653 available in the recipe as @samp{$@{arch@}}.  Default value is the output
654 of @samp{uname -m}.
656 @samp{jobs} is the number of parallel jobs to pass to the compiler.  Its
657 value is available in the recipe as @samp{$@{jobs@}}.  The default value
658 is 1.
660 The two variables @samp{$@{srcdir@}} and @samp{$@{destdir@}} can be
661 set in the recipe, as any other variable, but if they are not, qi uses
662 default values for them when building a package.
664 @samp{srcdir} contains the source code to be compiled, and defaults to
665 @samp{$@{program@}-$@{version@}}.  @samp{destdir} is the place where the
666 built package will be installed, and defaults to
667 @samp{$@{TMPDIR@}/package-$@{program@}}.
669 If @samp{pkgname} is left undefined, the special variable @samp{program}
670 is assigned by default.  If @samp{pkgversion} is left undefined, the
671 special variable @samp{version} is assigned by default.
673 @samp{pkgname} and @samp{pkgversion} along with: @samp{version}, @samp{arch},
674 and @samp{release} are used to produce the name of the package in the form:
675 @samp{$@{pkgname@}-$@{pkgversion@}-$@{arch@}+$@{release@}.tlz}
677 A special variable called @samp{replace} can be used to declare package
678 names that will be replaced at the time of installation.
680 @noindent
681 A typical recipe contains the following variables:
683 @itemize @bullet
684 @item @samp{program}: software name.
686 It matches the source name.  It is also used to compose the name of the
687 package if @samp{$@{pkgname@}} is not specified.
689 @item @samp{version}: software version.
691 It matches the source name.  It is also used to compose the version of the
692 package if @samp{$@{pkgversion@}} is not specified.
694 @item @samp{arch}: software architecture.
696 It is used to compose the architecture of the package in which it is
697 build.
699 @item @samp{release}: release number.
701 This is used to reflect the release number of the package.  It is
702 recommended to increase this number after any significant change in
703 the recipe or post-install script.
704 @end itemize
706 @noindent
707 Obtaining sources over the network must be declared in the recipe using
708 the @samp{fetch} variable.  Use double quotes for separated values.
710 The variables @samp{netget} and @samp{rsync} can be defined in @file{qirc}
711 to establish a network downloader in order to get the sources.  If they
712 are not defined, qi uses default values:
714 @samp{netget} is the general network downloader tool, defaults sets to
715 @samp{wget -c -w1 -t3 --no-check-certificate}.
717 @samp{rsync} is the network tool for sources containing the prefix for
718 the RSYNC protocol, default sets to
719 @samp{rsync -v -a -L -z -i --progress}.
721 The variable @samp{description} is used to print the package description
722 when a package is installed.
724 A description has two parts: a brief description, and a long description.
725 By convention, the syntax of @samp{description} is:
727 @example
728 description="
729 Brief description.
731 Long description.
733 @end example
735 The first line of the value represented is a brief description of the
736 software (called "blurb").  A blank line separates the @emph{brief
737 description} from the @emph{long description}, it should contain a more
738 descriptive description of the software.
740 @noindent
741 An example looks like:
743 @example
744 description="
745 The GNU core utilities.
747 The GNU core utilities are the basic file, shell and text manipulation
748 utilities of the GNU operating system.  These are the core utilities
749 which are expected to exist on every operating system.
751 @end example
753 Please consider a length limit of 78 characters as maximum, because the same
754 one would be used on the meta file creation.  See
755 @ref{Recipes, The meta file} section.
757 The @samp{homepage} variable is used to declare the main site or home page:
759 @example
760 homepage=http://www.gnu.org/software/gcc
761 @end example
763 The variable @samp{license} is used for license information@footnote{
764 The proposal for @samp{license} was made by Richard M. Stallman at
765 @url{http://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html}.}.
766 Some code in the program can be covered by license A, license B, or
767 license C.  For "separate licensing" or "heterogeneous licensing", we
768 suggest using @strong{|} for a disjunction, @strong{&} for a conjunction
769 (if that ever happens in a significant way), and comma for heterogeneous
770 licensing.  Comma would have lower precedence, plus added special terms.
772 @example
773 license="LGPL, GPL | Artistic + added permission"
774 @end example
776 @section Writing recipes
777 @cindex writing recipes
779 TO DO.
781 @section Building packages
782 @cindex package build
784 A recipe is any valid regular file.  qi sets priorities to read a recipe,
785 for example, the Current Working Directory has priority over the working
786 tree (or where the recipes reside); the @samp{$@{worktree@}/recipes} is
787 the second place where qi searchs for a recipe.  We complete the
788 possibility of using the directory name to invoke a recipe if it contains
789 "recipe" as a valid file name.
791 @noindent
792 To build a single package, type:
794 @example
795 qi -b x-apps/xterm
796 @end example
798 @noindent
799 Multiple jobs can be passed to the compiler to speed up the build process:
801 @example
802 qi -b -j3 x-apps/xterm
803 @end example
805 @noindent
806 Update or install the package produced (if it is not already installed)
807 when finish:
809 @example
810 qi -b -j3 -u x-apps/xterm
811 @end example
813 @noindent
814 Only process a recipe but do not create the binary package:
816 @example
817 qi -b -n dict/aspell
818 @end example
820 The options -i or -u have no effect when -n is given.
822 @noindent
823 This can be useful to inspect the build process of recipe:
825 qi -b -k -n dict/aspell 2>&1 | tee aspell-buildlog.txt
827 The -k option could preserve the source directory and the destination
828 directory for later inspection.  A log file of the build process will be
829 created redirecting both, standard error and standard output to tee(1).
831 @section Variables from the environment
832 @cindex environment variables
834 Qi has environment variables which can be used at build time:
836 The variable @env{TMPDIR} sets the temporary directory for sources, which is
837 used for package extractions (see @ref{Examining packages}) and is
838 prepended to the value of @samp{$@{srcdir@}} and @samp{$@{destdir@}} in
839 build mode.  By convention its default value is equal to
840 @samp{/usr/src/qi/build}.
842 The variables @env{QICFLAGS}, @env{QICXXFLAGS}, and @env{QILDFLAGS} have
843 no effect by default.  The environment variables such as @env{CFLAGS},
844 @env{CXXFLAGS}, and @env{LDFLAGS} are unset at compile time:
846 @noindent
847 Recommended practice is to set variables in the command line of
848 @samp{configure} or @emph{make(1)} instead of exporting to the
849 environment.  As follows:
851 @quotation
852 Variables not defined in a site shell script can be set in the environment
853 passed to configure.  However, some packages may run configure again
854 during the build, and the customized values of these variables may be
855 lost.  In order to avoid this problem, you should set them in the
856 configure command line, using @samp{VAR=value}.  For example:
858 @code{./configure CC=/usr/local2/bin/gcc}
860 @url{http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html}
861 @end quotation
863 @quotation
864 Indeed, while configure can notice the definition of CC in
865 @samp{./configure CC=bizarre-cc}, it is impossible to notice it in
866 @samp{CC=bizarre-cc ./configure}, which, unfortunately, is what most
867 users do.
869 [...]
871 configure: error: changes in the environment can compromise the build.
873 @url{http://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html}
874 @end quotation
876 @quotation
877 It is not wise for makefiles to depend for their functioning on
878 environment variables set up outside their control, since this would cause
879 different users to get different results from the same makefile.  This is
880 against the whole purpose of most makefiles.
882 @url{http://gnu.org/software/make/manual/make.html#Environment}
883 @end quotation
885 @section The meta file
886 @cindex the meta file
888 The "meta file" is a regular file created during the build mode, it
889 contains information about the package such as program name, program
890 version, release, fetch address, description, and other minor data
891 extracted from processed recipes.  The name of the file is generated as
892 @samp{$@{full_pkgname@}.tlz.txt}, and its purpose is to reflect essential
893 information to the user without having to look inside the package content.
895 The content of a meta file looks like:
897 @example
899 # The Bourne Again SHell.
901 # Bash is an sh-compatible shell that incorporates useful features from
902 # the Korn shell (ksh) and C shell (csh).  It is intended to conform to
903 # the IEEE POSIX P1003.2/ISO 9945.2 shell and tools standard.
905 # It offers functional improvements over sh for both programming and
906 # interactive use.
909 QICFLAGS="-g0 -Os -mtune=generic -pipe"
910 QICXXFLAGS="-g0 -Os -mtune=generic -pipe"
911 QILDFLAGS="-s"
912 program=bash
913 version=5.0
914 release=1
915 blurb="The Bourne Again SHell."
916 homepage="http://www.gnu.org/software/bash"
917 license="GPLv3+"
918 fetch="ftp://ftp.gnu.org/gnu/bash/bash-5.0.tar.gz"
919 replace=""
920 @end example
922 Package descriptions are extracted from the variable @samp{description}:
923 each line is interpreted literally and pre-formatted to fit in (exactly)
924 @strong{80 columns}, plus the character @samp{#} and a space is prefixed
925 to every line.
927 @noindent
928 In addition to the Special variables, there are implicit variables such as
929 @samp{blurb}:
931 The @samp{blurb} variable is related to the special variable
932 @samp{description}.  Its value is composed using the first (substantial)
933 line of @samp{description}, mentioned as the "brief description".
936 @node Order files
937 @chapter Order files
938 @cindex handling build order
940 The order mode has the purpose of resolving the build order through
941 .order files.  An order file contains a list of recipe names, by default
942 does not perform any action other than to print a resolved list in
943 descending order.  For example, if @strong{a} depends on @strong{b} and
944 @strong{c}, and @strong{c} depends on @strong{b} as well, the file might
945 look like:
947 @example
948 a: c b
950 c: b
951 @end example
953 Each letter represents a recipe name, complete dependencies for
954 the first recipe name are listed in descending order, which is
955 printed from right to left, and removed from left to right:
957 @sc{Output}
959 @example
963 @end example
965 Blank lines, colons and parentheses are simply ignored.  Comment lines
966 beginning with @samp{#} are allowed.
968 @noindent
969 An order file could be used to build a series of packages, for example,
970 if the content is:
972 @example
973 # Image handling libraries
975 libs/libjpeg-turbo: devel/nasm
976 x-libs/jasper: libs/libjpeg-turbo
977 libs/tiff: libs/libjpeg-turbo
978 @end example
980 To proceed with each recipe, we can type:
982 @example
983 qi -o imglibs.order | qi -b -i -
984 @end example
986 The output of @samp{qi -o imglibs.order} tells to qi in which order it
987 should build the recipes:
989 @example
990 devel/nasm
991 libs/libjpeg-turbo
992 x-libs/jasper
993 libs/tiff
994 @end example
997 @node Creating packages
998 @chapter Creating packages
999 @cindex package creation
1001 The "creation mode" is an internal function of qi to make new Qi compatible
1002 compatible packages, the creation mode is selected by the -c option.
1003 A package is produced using the contents of the Current Directory, and
1004 the package file is written out.
1006 @example
1007 Usage: qi -c [@var{OUTPUT/packagename.tlz}]...
1008 @end example
1010 The argument for the file name to be written must contain a fully
1011 qualified named directory as the output directory where the package
1012 produced will be written.  The file name should be composed using the
1013 full name: name-version-architecture+release.tlz
1015 @sc{Example}
1017 @example
1018 cd /usr/local/pkgs
1019 cd claws-mail-3.17.1-x86_64+1
1020 qi -c /var/cache/qi/packages/x86_64/local/claws-mail-3.17.1-x86_64+1.tlz
1021 @end example
1023 In this case, the package "claws-mail-3.17.1-x86_64+1.tlz" will be written
1024 into @samp{/var/cache/qi/packages/x86_64/local/}.
1026 @noindent
1027 All packages produced are complemented by a checksum file (.sha256).
1030 @node Examining packages
1031 @chapter Examining packages
1032 @cindex package examination
1034 The "extraction mode" serves to examine binary packages for debugging
1035 purposes. The extraction mode is selected by the -x option.  It
1036 decompresses a package into a single directory, verifying its integrity
1037 and preserving its properties.
1039 @example
1040 Usage: qi -x [@var{packagename.tlz}]...
1041 @end example
1043 @sc{Example}
1045 @example
1046 qi -x mksh-R56c-x86_64+1.tlz
1047 @end example
1049 This action will put the content of "mksh-R56c-x86_64+1.tlz" into a
1050 single directory, this will be a private directory for the user who
1052 requested the action, creation mode will be equal to @strong{u=rwx,g=,o=
1053 (0700)}.  The package content will reside on this location, default
1054 mask to deploy the content will be equal to
1055 @strong{u=rwx,g=rwx,o=rwx (0000)}.
1057 @noindent
1058 The creation of the custom directory is influenced by the value of the
1059 @env{TMPDIR} variable.
1062 @node Exit status
1063 @chapter Exit status
1064 @cindex exit codes
1066 All the exit codes are described in this chapter.
1068 @table @samp
1069 @item 0
1070 Successful completion (no errors).
1072 @item 1
1073 Minor common errors:
1075 @itemize @minus
1076 @item Help usage on illegal options or required arguments.
1078 @item Program needed by qi (prerequisite) is not available.
1079 @end itemize
1081 @item 2
1082 Command execution error:
1084 This code is used to return the evaluation of external commands and shell
1085 arguments in case of error.
1087 @item 3
1088 Integrity check error for compressed files.
1090 Compressed files means:
1092 @itemize @minus
1093 @item Tarball files from tar(1).
1094 Supported extensions: .tar, .tar.gz, .tgz, .tar.Z, .tar.bz2, .tbz2, .tbz,
1095 .tar.xz, .txz
1097 @item Tarball files from tarlz(1).
1098 Supported extensions: .tar.lz, .tlz
1100 @item Zip files from unzip(1).
1101 Supported extensions: .zip, .ZIP
1103 @item Gzip files from gzip(1).
1104 Supported extensions: .gz, .Z
1106 @item Bzip2 files from bzip2(1).
1107 Supported extensions: .bz2
1109 @item Lzip files from lzip(1).
1110 Supported extensions: .lz
1112 @item Xz files from xz(1).
1113 Supported extensions: .xz
1114 @end itemize
1116 @item 4
1117 File empty, not regular, or expected.
1119 Commonly, it is expected:
1121 @itemize @minus
1122 @item An argument for the mode of operation.
1124 @item A readable file or directory.
1126 @item A binary package (.tlz).
1128 @item A valid recipe.
1130 @item An order file (.order).
1132 @item A protocol supported by the network downloader tool.
1134 @item A checksum file (.sha256).
1135 @end itemize
1137 @item 5
1138 Empty or not defined variable:
1140 This code is used to report empty or undefined variables; usually,
1141 variables coming from a recipe or assigned arrays that are tested.
1143 @item 6
1144 Package already installed:
1146 The package directory for an incoming .tlz package already exists.
1148 @item 10
1149 Network manager error:
1151 This code is used if the network downloader tool fails for some reason.
1152 @end table
1155 @node License
1156 @appendix GNU Free Documentation License
1158 @include fdl.texi
1161 @node Index
1162 @unnumbered Index
1164 @printindex cp
1166 @bye