code:
@c -*-texinfo-*-
@c qi-content.texi
@c This is part of the Qi user guide.
@c Copyright (C) 2019-2022 Matias Fonzo, <selk@dragora.org>.
@c See the file qi-header.texi for copying conditions.
@c
@c If something is modified here, be aware of the increase of VERSION in
@c qi-header.texi, this will produce the result of the manual: qi.info

@node Introduction to Qi
@chapter Introduction to Qi
@cindex introduction to qi

Qi is a simple but well-integrated package manager.  It can create,
install, remove, and upgrade software packages.  Qi produces binary
packages using recipes, which are files containing specific instructions
to build each package from source.  Qi can manage multiple packages
under a single directory hierarchy.  This method allows to maintain a set
of packages and multiple versions of them.  This means that Qi could be
used as the main package manager or complement the existing one.

Qi offers a friendly command line interface, a global configuration
file, a simple recipe layout to deploy software packages; also works
with binary packages in parallel, speeding up installations and packages
in production.  The format used for packages is a simplified and safer
variant of POSIX pax archive compressed in lzip format.

Qi is a modern (POSIX-compliant) shell script released under the
terms of the GNU General Public License.  There are only two major
dependencies for the magic: graft(1) and tarlz(1), the rest is expected
to be found in any Unix-like system.

@node Invoking qi
@chapter Invoking qi
@cindex invocation

This chapter describes the synopsis for invoking Qi.

@example
Usage: qi COMMAND [@var{OPTION}...] [@var{FILE}]...
@end example

@noindent
One mandatory command specifies the operation that @samp{qi} should
perform, options are meant to detail how this operation should be
performed during or after the process.

@noindent
Qi supports the following commands:

@table @code
@item warn
Warn about files that will be installed.

@item install
Install packages.

@item remove
Remove packages.

@item upgrade
Upgrade packages.

@item extract
Extract packages for debugging purposes.

@item create
Create a .tlz package from directory.

@item build
Build packages using recipe names.

@item order
Resolve build order through .order files
@end table

@noindent
Options when installing, removing, or upgrading software packages:

@table @code
@item -f
@itemx --force
Force upgrade of pre-existing packages.

@item -k
@itemx --keep
Keep directories when build/remove/upgrade.

Keep (don't delete) the package directory when using remove/upgrade command.

This will also try to preserve the directories @samp{$@{srcdir@}} and
@samp{$@{destdir@}} when using build command.  Its effect is available in
recipes as @samp{$@{keep_srcdir@}} and @samp{$@{keep_destdir@}}.  See
@ref{Recipes, Special variables} for details.

@item -p
@itemx --prune
Prune conflicts.

@item -P
@itemx --packagedir=<dir>
Set directory for package installations.

@item -t
@itemx --targetdir=<dir>
Set target directory for symbolic links.

@item -r
@itemx --rootdir=<dir>
Use the fully qualified named directory as the root directory for all qi
operations.

Note: the target directory and the package directory will be
relative to the specified directory, excepting the graft log file.
@end table

@noindent
Options when building software packages using recipes:

@table @code
@item -a
@itemx --architecture
Set architecture name for the package.

@item -j
@itemx --jobs
Parallel jobs for the compiler.

This option sets the variable @samp{$@{jobs@}}.  If not specified, default
sets to 1.

@item -S
@itemx --skip-questions
Skip questions on completed recipes.

@item -1
@itemx --increment
Increment release number (@samp{$@{release@}} + 1).

The effect of this option will be omitted if --no-package is being used.

@item -n
@itemx --no-package
Do not create a .tlz package.

@item -i
@itemx --install
Install package after the build.

@item -u
@itemx --upgrade
Upgrade package after the build.

@item -o
@itemx --outdir=<dir>
Where the packages produced will be written.

This option sets the variable @samp{$@{outdir@}}.

@item -w
@itemx --worktree=<dir>
Where archives, patches, recipes are expected.

This option sets the variable @samp{$@{worktree@}}.

@item -s
@itemx --sourcedir=<dir>
Where compressed sources will be found.

This option sets the variable @samp{$@{tardir@}}.
@end table

@noindent
Other options:

@table @code
@item -v
@itemx --verbose
Be verbose (an extra -v gives more).

It sets the verbosity level, default sets to 0.

The value 1 is used for more verbosity while the value 2 is too detailed.
Although at the moment it is limited to graft(1) verbosity.

@item -N
@itemx --no-rc
Do not read the configuration file.

This will ignore reading the qirc file.

@item -L
@itemx --show-location
Print default directory locations and exit.

This will print the target directory, package directory, working tree,
the directory for sources, and the output directory for the packages
produced.

@item -h
@itemx --help
Display the usage and exit.

@item -V
@itemx --version

This will print the (short) version information and then exit.

The same can be achieved if Qi is invoked as @samp{qi version}.
@end table

When FILE is -, qi can read from the standard input.  See examples from
the @ref{Packages} section.

Exit status: 0 for a normal exit, 1 for minor common errors (help usage,
support not available, etc), 2 to indicate a command execution error;
3 for integrity check error on compressed files, 4 for empty, not
regular, or expected files, 5 for empty or not defined variables,
6 when a package already exist, 10 for network manager errors.
For more details, see the @ref{Qi exit status} section.

@node The qirc file
@chapter The qirc file
@cindex configuration file

The global @file{qirc} file offers a way to define variables and tools
(such as a download manager) for default use.  This file is used by qi
at runtime, e.g., to build, install, remove or upgrade packages.

Variables and their possible values must be declared as any other
variable in the shell.

@noindent
The command line options related to the package directory and target
directory and some of the command line options used for the build command,
have the power to override the values declared on @file{qirc}.
See @ref{Invoking qi}.

@noindent
The order in which qi looks for this file is:

@enumerate
@item
@env{$@{HOME@}/.qirc}
@- Effective user.

@item
@samp{$@{sysconfdir@}/qirc}
@- System-wide.
@end enumerate

If you intend to run qi as effective user, the file
@samp{$@{sysconfdir@}/qirc} could be copied to @env{$@{HOME@}/.qirc}
setting the paths for @samp{$@{packagedir@}} and @samp{$@{targetdir@}}
according to the @env{$HOME}.

@node Packages
@chapter Packages
@cindex managing packages

A package is a suite of programs usually distributed in binary form
which may also contain manual pages, documentation, or any other file
associated to a specific software.

The package format used by qi is a simplified POSIX pax archive
compressed using lzip@footnote{For more details about tarlz and the
lzip format, visit @url{https://lzip.nongnu.org/tarlz.html}.}.  The
file extension for packages ends in @samp{.tlz}.

@noindent
Both package installation and package de-installation are managed using
two important (internal) variables: @samp{$@{packagedir@}} and
@samp{$@{targetdir@}}, these values can be changed in the
configuration file or via options.

@samp{$@{packagedir@}} is a common directory tree where the package
contents will be decompressed (will reside).

@samp{$@{targetdir@}} is a target directory where the links will be
made by graft(1) taking @samp{$@{packagedir@}/package_name} into account.

@noindent
Packages are installed in self-contained directory trees and symbolic
links from a common area are made to the package files.  This allows
multiple versions of the same package to coexist on the same system.

@section Package conflicts
@cindex package conflicts

All the links to install or remove a package are handled by graft(1).
Since multiple packages can be installed or removed at the same time,
certain conflicts may arise between the packages.

@noindent
graft@footnote{The official guide for Graft can be found at
@url{https://peters.gormand.com.au/Home/tools/graft/graft.html}.}
defines a CONFLICT as one of the following conditions:

@itemize @bullet
@item
If the package object is a directory and the target object exists but is
not a directory.

@item
If the package object is not a directory and the target object exists
and is not a symbolic link.

@item
If the package object is not a directory and the target object exists
and is a symbolic link to something other than the package object.
@end itemize

@noindent
The default behavior of qi for an incoming package is to ABORT if a
conflict arises.  When a package is going to be deleted, qi tells to
graft(1) to remove those parts that are not in conflict, leaving the
links to the belonging package.  This behavior can be forced if the
--prune option is given.

@section Installing packages
@cindex package installation

To install a single package, simply type:

@example
qi install coreutils_8.30_i586-1@@tools.tlz
@end example

@noindent
To install multiple packages at once, type:

@example
qi install gcc_8.3.0_i586-1@@devel.tlz rafaela_2.2_i586-1@@legacy.tlz ...
@end example

@noindent
Warn about the files that will be linked:

@example
qi warn bash_5.0_i586-1@@shells.tlz
@end example

This is to verify the content of a package before installing it.

@noindent
See the process of an installation:

@example
qi install --verbose mariana_3.0_i586-1@@woman.tlz
@end example

A second --verbose or -v option gives more (very verbose).

@noindent
Installing package in a different location:

@example
qi install --rootdir=/media/floppy lzip_1.21_i586-1@@compressors.tlz
@end example

Important: the --rootdir option assumes @samp{$@{targetdir@}} and
@samp{$@{packagedir@}}.  See the following example:

@example
qi install --rootdir=/home/selk lzip_1.21_i586-1@@compressors.tlz
@end example

The content of "lzip_1.21_i586-1@@compressors.tlz" will be decompressed
into @samp{/home/selk/pkgs/lzip_1.21_i586-1@@compressors}.
Assuming that the main binary for lzip is under
@samp{/home/selk/pkgs/lzip_1.21_i586-1@@compressors/usr/bin/}
the target for "usr/bin" will be created at @samp{/home/selk}.  Considering
that you have exported the @env{PATH} as @samp{$@{HOME@}/usr/bin}, now the
system is able to see the recent lzip command.

@noindent
Installing from a list of packages using standard input:

@example
qi install - < PACKAGELIST.txt
@end example

Or in combination with another tool:
@example
sort -u PACKAGELIST.txt | qi install -
@end example

The sort command will read and sorts the list of declared packages,
while trying to have unique entries for each statement.  The output
produced is captured by Qi to install each package.

An example of a list containing package names is:
@example
/var/cache/qi/packages/amd64/tcl_8.6.9_amd64-1@@devel.tlz
/var/cache/qi/packages/amd64/tk_8.6.9.1_amd64-1@@devel.tlz
/var/cache/qi/packages/amd64/vala_0.42.3_amd64-1@@devel.tlz
@end example

@section Removing packages
@cindex package de-installation

To remove a package, simply type:

@example
qi remove xz_5.2.4_i586-1@@compressors.tlz
@end example

@noindent
Remove command will match the package name using @samp{$@{packagedir@}} as
prefix.  For example, if the value of @samp{$@{packagedir@}} has been
set to /usr/pkg, this will be equal to:

@example
qi remove /usr/pkg/xz_5.2.4_i586-1@@compressors
@end example

@noindent
Detailed output:

@example
qi remove --verbose /usr/pkg/xz_5.2.4_i586-1@@compressors
@end example

A second --verbose or -v option gives more (very verbose).

@noindent
By default the remove command does not preserve a package directory after
removing its links from @samp{$@{targetdir@}}, but this behavior can be
changed if the --keep option is passed:

@example
qi remove --keep /usr/pkg/lzip_1.21_i586-1@@compressors
@end example

This means that the links to the package can be reactivated, later:

@example
cd /usr/pkg && graft -i lzip_1.21_i586-1@@compressors
@end example

@noindent
Removing package from a different location:

@example
qi remove --rootdir=/home/cthulhu xz_5.2.4_i586-1@@compressors
@end example

@noindent
Removing a package using standard input:

@example
echo vala_0.42.3_amd64-1@@devel | qi remove -
@end example

This will match with the package directory.

@section Upgrading packages
@cindex package upgrade

The upgrade command inherits the properties of the installation and removal
process.  To make sure that a package is updated, the package is installed
in a temporary directory taking @samp{$@{packagedir@}} into account.  Once
the incoming package is pre-installed, qi can proceed to search and delete
packages that have the same name (considered as previous ones).  Finally,
the package is re-installed at its final location and the temporary
directory is removed.

Since updating a package can be crucial and so to perform a successful
upgrade, from start to finish, you will want to ignore some important
system signals during the upgrade process, those signals are SIGHUP,
SIGINT, SIGQUIT, SIGABRT, and SIGTERM.

@noindent
To upgrade a package, just type:

@example
qi upgrade gcc_9.0.1_i586-1@@devel.tlz
@end example

This will proceed to upgrade "gcc_9.0.1_i586-1@@devel" removing any other
version of "gcc" (if any).

@noindent
If you want to keep the package directories of versions found during the
upgrade process, just pass:

@example
qi upgrade --keep gcc_9.0.1_i586-1@@devel.tlz
@end example

@noindent
To see the upgrade process:

@example
qi upgrade --verbose gcc_9.0.1_i586-1@@devel.tlz
@end example

A second --verbose or -v option gives more (very verbose).

@noindent
To force the upgrade of an existing package:

@example
qi upgrade --force gcc_9.0.1_i586-1@@devel.tlz
@end example

@subsection Package blacklist
@cindex package blacklist

To implement general package facilities, either to install, remove or
maintain the hierarchy of packages in a clean manner, qi makes use of the
pruning operation via graft(1) by default:

There is a risk if those are crucial packages for the proper functioning
of the system, because it implies the deactivation of symbolic from the
target directory, @emph{especially} when transitioning an incoming package
into its final location during an upgrade.

@noindent
A blacklist of package names has been devised for the case where
a user decides to upgrade all the packages in the system, or
just the crucial ones, such as the C library.

The blacklist is related to the upgrade command only, consists in installing
a package instead of updating it or removing previous versions of it;
the content of the package will be updated over the existing content at
@samp{$@{packagedir@}}, while the existing links from
@samp{$@{targetdir@}} will be preserved.  A pruning of links will be
carried out in order to re-link possible differences with the recent
content, this helps to avoid leaving dead links in the target directory.

@noindent
Package names for the blacklist to be declared must be set from the
configuration file.  By default, it is declared using the package name,
which is more than enough for critical system packages, but if you want to
be more specific, you can declare a package using:
@samp{$@{pkgname@}_$@{pkgversion@}_$@{arch@}-$@{release@}} where
the package category is avoided for common matching.  See
@ref{Recipes, Special variables} for a description of these variables.

@node Recipes
@chapter Recipes
@cindex recipes

A recipe is a file telling qi what to do.  Most often, the recipe tells
qi how to build a binary package from a source tarball.

A recipe has two parts: a list of variable definitions and a list of
sections.  By convention, the syntax of a section is:

@example
section_name()
@{
    section lines
@}
@end example

The section name is followed by parentheses, one newline and an opening
brace.  The line finishing the section contains just a closing brace.
The section names or the function names currently recognized are
@samp{build}.

The @samp{build} section (or @strong{shell function}) is an augmented
shell script that contains the main instructions to build software
from source.

If there are other functions defined by the packager, Qi detects them
for later execution.

@section Variables
@cindex variables

A "variable" is a @strong{shell variable} defined either in @file{qirc}
or in a recipe to represent a string of text, called the variable's
"value".  These values are substituted by explicit request in the
definitions of other variables or in calls to external commands.

Variables can represent lists of file names, options to pass to
compilers, programs to run, directories to look in for source files,
directories to write output to, or anything else you can imagine.

Definitions of variables in qi have four levels of precedence.
Options which define variables from the command-line override those
specified in the @file{qirc} file, while variables defined in the recipe
override those specified in @file{qirc}, taking priority over those
variables set by command-line options.  Finally, the variables have
default values if they are not defined anywhere.

Options that set variables through the command-line can only reference
variables defined in @file{qirc} and variables with default values.

Definitions of variables in @file{qirc} can only reference variables
previously defined in @file{qirc} and variables with default values.

Definitions of variables in the recipe can only reference variables
set by the command-line, variables previously defined in the recipe,
variables defined in @file{qirc}, and variables with default values.

@section Special variables
@cindex special variables

There are variables which can only be set using the command line options or
via @file{qirc}, there are other special variables which can be defined or
redefined in a recipe.  See the following definitions:

@samp{outdir} is the directory where the packages produced are written.
This variable can be redefined per-recipe.  Default sets to
@samp{/var/cache/qi/packages}.

@samp{worktree} is the working tree where archives, patches, and recipes
are expected.  This variable can not be redefined in the recipe.  Default
sets to @samp{/usr/src/qi}.

@samp{tardir} is defined in the recipe to the directory where the tarball
containing the source can be found.  The full name of the tarball is
composed as @samp{$@{tardir@}/$tarname}.  Its value is available in the
recipe as @samp{$@{tardir@}}; a value of . for @samp{tardir} sets it to
the value of CWD (Current Working Directory), this is where the recipe
lives.

@samp{arch} is the architecture to compose the package name.  Its value is
available in the recipe as @samp{$@{arch@}}.  Default value is the one
that was set in the Qi configuration.

@samp{jobs} is the number of parallel jobs to pass to the compiler.  Its
value is available in the recipe as @samp{$@{jobs@}}.  The default value
is 1.

The two variables @samp{$@{srcdir@}} and @samp{$@{destdir@}} can be
set in the recipe, as any other variable, but if they are not, qi uses
default values for them when building a package.

@samp{srcdir} contains the source code to be compiled, and defaults to
@samp{$@{program@}-$@{version@}}.  @samp{destdir} is the place where the
built package will be installed, and defaults to
@samp{$@{TMPDIR@}/package-$@{program@}}.

If @samp{pkgname} is left undefined, the special variable @samp{program}
is assigned by default.  If @samp{pkgversion} is left undefined, the
special variable @samp{version} is assigned by default.

@samp{pkgname} and @samp{pkgversion} along with: @samp{version}, @samp{arch},
@samp{release}, and (optionally) @samp{pkgcategory} are used to produce the
package name in the form:
@samp{$@{pkgname@}_$@{pkgversion@}_$@{arch@}-$@{release@}[@@$@{pkgcategory@}].tlz}

@samp{pkgcategory} is an optional special variable that can be defined on the
recipe to categorize the package name.  If it is defined, then the
package output will be composed as
@samp{$@{pkgname@}_$@{pkgversion@}_$@{arch@}-$@{release@}[@@$@{pkgcategory@}.tlz}.
Automatically, the value of @samp{pkgcategory} will be prefixed using the
@samp{@@} (at) symbol which will be added to the last part of the package name.

A special variable called @samp{replace} can be used to declare package names
that will be replaced at installation time.

The special variables @samp{keep_srcdir} and @samp{keep_destdir} are provided
in order to preserve the directories @samp{$@{srcdir@}} or @samp{$@{destdir@}},
if those exists as such.  Note: The declaration of these variables are subject
to manual deactivation; its purpose in recipes is to preserve the directories
that relate to the package's build (source) and destination directory, that is
so that another recipe can get a new package (or meta package) from there.  For
example, the declarations can be done as:

@example
keep_srcdir=keep_srcdir
keep_destdir=keep_destdir
@end example

Then from another recipe you would proceed to copy the necessary files that
will compose the meta package, from the main function you must deactivate
the variables at the end:

@example
unset -v keep_srcdir keep_destdir
@end example

This will leave the 'keep_srcdir' and 'keep_destdir' variables blank to
continue with the rest of the recipes.

The variable @samp{tarlz_compression_options} can be used to change the
default compression options in tarlz(1), default sets to @samp{-9 --solid}.
For example if the variable is declared as:

@example
tarlz_compression_options="-0 --bsolid"
@end example

It will change the granularity of tarlz(1) by using the @samp{--bsolid}
option @footnote{About the @samp{--bsolid} granularity option of tarlz(1),
@url{https://www.nongnu.org/lzip/manual/tarlz_manual.html#g_t_002d_002dbsolid}.},
as well as increasing the compression speed by lowering the compression
level with @samp{-0}.

This is only recommended for recipes where testing, or faster processing is
desired to create the packaged file more quickly.  It is not recommended for
production or general distribution of binary packages.

@noindent
A typical recipe contains the following variables:

@itemize @bullet
@item @samp{program}: Software name.

It matches the source name.  It is also used to compose the name of the
package if @samp{$@{pkgname@}} is not specified.

@item @samp{version}: Software version.

It matches the source name.  It is also used to compose the version of the
package if @samp{$@{pkgversion@}} is not specified.

@item @samp{arch}: Software architecture.

It is used to compose the architecture of the package in which it is
build.

@item @samp{release}: Release number.

This is used to reflect the release number of the package.  It is
recommended to increase this number after any significant change in
the recipe or post-install script.

@item @samp{pkgcategory}: Package category.

Optional but recommended variable to categorize the package name when it is
created.
@end itemize

@noindent
Obtaining sources over the network must be declared in the recipe using
the @samp{fetch} variable.

The variables @samp{netget} and @samp{rsync} can be defined in @file{qirc}
to establish a network downloader in order to get the sources.  If they
are not defined, qi uses default values:

@samp{netget} is the general network downloader tool, defaults sets to
@samp{wget2 -c -w1 -t3 --no-check-certificate}.

@samp{rsync} is the network tool for sources containing the prefix for
the RSYNC protocol, default sets to
@samp{rsync -v -a -L -z -i --progress}.

The variable @samp{description} is used to print the package description
when a package is installed.

A description has two parts: a brief description, and a long description.
By convention, the syntax of @samp{description} is:

@example
description="
Brief description.

Long description.
"
@end example

The first line of the value represented is a brief description of the
software (called "blurb").  A blank line separates the @emph{brief
description} from the @emph{long description}, which should contain a more
descriptive description of the software.

@noindent
An example looks like:

@example
description="
The GNU core utilities.

The GNU core utilities are the basic file, shell and text manipulation
utilities of the GNU operating system.  These are the core utilities
which are expected to exist on every operating system.
"
@end example

Please consider a length limit of 78 characters as maximum, because the same
one would be used on the meta file creation.  See
@ref{Recipes, The meta file} section.

The @samp{homepage} variable is used to declare the main site or home page:

@example
homepage=https://www.gnu.org/software/gcc
@end example

The variable @samp{license} is used for license information@footnote{
The proposal for @samp{license} was made by Richard M. Stallman at
@url{https://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html}.}.
Some code in the program can be covered by license A, license B, or
license C.  For "separate licensing" or "heterogeneous licensing", we
suggest using @strong{|} for a disjunction, @strong{&} for a conjunction
(if that ever happens in a significant way), and comma for heterogeneous
licensing.  Comma would have lower precedence, plus added special terms.

@example
license="LGPL, GPL | Artistic - added permission"
@end example

@section Writing recipes
@cindex writing recipes

Originally, Qi was designed for the series of Dragora GNU/Linux-Libre 3;
this doesn't mean you can't use it in another distribution, just that if
you do, you'll have to try it out for yourself. To help with this, here
are some references to well-written recipes:

@itemize @bullet
@item @url{https://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes}
@item @url{https://notabug.org/dragora/dragora/src/master/recipes}
@item @url{https://notabug.org/dragora/dragora-extras/src/master/recipes}
@item @url{https://git.savannah.nongnu.org/cgit/dragora/dragora-extras.git/tree/recipes}
@end itemize

@section Building packages
@cindex package build

A recipe is any valid regular file.  Qi sets priorities for reading a
recipe, the order in which qi looks for a recipe is:

@enumerate
@item
Current working directory.

@item
If the specified path name does not contain "recipe" as the last
component.  Qi will complete it by adding "recipe" to the path name.

@item
If the recipe is not in the current working directory, it will be
searched under @samp{$@{worktree@}/recipes}.  The last component will be
completed adding "recipe" to the specified path name.
@end enumerate

@noindent
To build a single package, type:

@example
qi build x-apps/xterm
@end example

@noindent
Multiple jobs can be passed to the compiler to speed up the build process:

@example
qi build --jobs 3 x-apps/xterm
@end example

@noindent
Update or install the produced package (if not already installed) when the
build command ends:

@example
qi build -j3 --upgrade x-apps/xterm
@end example

@noindent
Only process a recipe but do not create the binary package:

@example
qi build --no-package dict/aspell
@end example

The options --install or --upgrade have no effect when --no-package
is given.

@noindent
This is useful to inspect the build process of the above recipe:

qi build --keep --no-package dict/aspell 2>&1 | tee aspell-log.txt

The --keep option could preserve the source directory and the destination
directory for later inspection.  A log file of the build process will be
created redirecting both, standard error and standard output to tee(1).

@section Variables from the environment
@cindex environment variables

Qi has environment variables which can be used at build time:

The variable @env{TMPDIR} sets the temporary directory for sources, which is
used for package extractions (see @ref{Examining packages}) and is
prepended to the value of @samp{$@{srcdir@}} and @samp{$@{destdir@}} in
build command.  By convention its default value is equal to
@samp{/usr/src/qi/build}.

The variables @env{QICFLAGS}, @env{QICXXFLAGS}, @env{QILDFLAGS}, and
@env{QICPPFLAGS} have no effect by default.  The environment variables
such as @env{CFLAGS}, @env{CXXFLAGS}, @env{LDFLAGS}, and @env{CPPFLAGS}
are unset at compile time:

@noindent
Recommended practice is to set variables in the command line of
@samp{configure} or @emph{make(1)} instead of exporting to the
environment.  As follows:

@url{https://www.gnu.org/software/make/manual/html_node/Environment.html}
@quotation
It is not wise for makefiles to depend for their functioning on environment
variables set up outside their control, since this would cause different
users to get different results from the same makefile.  This is against the
whole purpose of most makefiles.
@end quotation

Setting environment variables for configure is deprecated because running
configure in varying environments can be dangerous.

@url{https://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html}
@quotation
Variables not defined in a site shell script can be set in the environment
passed to configure.  However, some packages may run configure again
during the build, and the customized values of these variables may be
lost.  In order to avoid this problem, you should set them in the
configure command line, using @samp{VAR=value}.  For example:

@code{./configure CC=/usr/local2/bin/gcc}
@end quotation

@url{https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html}
@quotation
If for instance the user runs @samp{CC=bizarre-cc ./configure}, then the cache,
config.h, and many other output files depend upon bizarre-cc being the C
compiler.  If for some reason the user runs ./configure again, or if it is
run via @samp{./config.status --recheck}, (See Automatic Remaking, and see
config.status Invocation), then the configuration can be inconsistent,
composed of results depending upon two different compilers.
[...]
Indeed, while configure can notice the definition of CC in @samp{./configure
CC=bizarre-cc}, it is impossible to notice it in @samp{CC=bizarre-cc
./configure}, which, unfortunately, is what most users do.
[...]
configure: error: changes in the environment can compromise the build.
@end quotation

If the @env{SOURCE_DATE_EPOCH} environment variable is set to a UNIX timestamp
(defined as the number of seconds, excluding leap seconds, since 01 Jan 1970
00:00:00 UTC.); then the given timestamp will be used to overwrite any newer
timestamps on the package contents (when it is created).  More information
about this can be found at
@uref{https://reproducible-builds.org/specs/source-date-epoch/}.

@section The meta file
@cindex the meta file

The "meta file" is a regular file created during the build process, it
contains information about the package such as package name, package
version, architecture, release, fetch address, description, and other
minor data extracted from processed recipes.  The name of the file is
generated as @samp{$@{full_pkgname@}.tlz.txt}, and its purpose is to
reflect essential information to the user without having to look inside
the package content.  The file format is also intended to be used by
other scripts or by common Unix tools.

The content of a meta file looks like:

@example
#
# Pattern scanning and processing language.
#
# The awk utility interprets a special-purpose programming language
# that makes it possible to handle simple data-reformatting jobs
# with just a few lines of code.  It is a free version of 'awk'.
#
# GNU awk implements the AWK utility which is part of
# IEEE Std 1003.1 Shell and Utilities (XCU).
#

QICFLAGS="-O2"
QICXXFLAGS="-O2"
QILDFLAGS=""
QICPPFLAGS=""
pkgname=gawk
pkgversion=5.0.1
arch=amd64
release=1
pkgcategory="tools"
full_pkgname=gawk_5.0.1_amd64-1@@tools
blurb="Pattern scanning and processing language."
homepage="https://www.gnu.org/software/gawk"
license="GPLv3+"
fetch="https://ftp.gnu.org/gnu/gawk/gawk-5.0.1.tar.lz"
replace=""
@end example

A package descriptions is extracted from the variable @samp{description}
where each line is interpreted literally and pre-formatted to fit in
(exactly) @strong{80 columns}, plus the character @samp{#} and a blank
space is prefixed to every line (shell comments).

@noindent
In addition to the Special variables, there are implicit variables such as
@samp{blurb}:

The @samp{blurb} variable is related to the special variable
@samp{description}.  Its value is made from the first (substantial)
line of @samp{description}, mentioned as the "brief description".

The build flags such as @samp{QICFLAGS}, @samp{QICXXFLAGS},
@samp{QILDFLAGS}, and @samp{QICPPFLAGS} are only added to the meta file
if the declared variable @samp{arch} is not equal to the "noarch" value.

@node Order files
@chapter Order files
@cindex handling build order

The order command has the purpose of resolving the build order through
.order files.  An order file contains a list of recipe names, by default
does not perform any action other than to print a resolved list in
descending order.  For example, if @strong{a} depends on @strong{b} and
@strong{c}, and @strong{c} depends on @strong{b} as well, the file might
look like:

@example
a: c b
b:
c: b
@end example

Each letter represents a recipe name, complete dependencies for
the first recipe name are listed in descending order, which is
printed from right to left, and removed from left to right:

@sc{Output}

@example
b
c
a
@end example

Blank lines, colons and parentheses are simply ignored.  Comment lines
beginning with @samp{#} are allowed.

@noindent
An order file could be used to build a series of packages, for example,
if the content is:

@example
# Image handling libraries

libs/libjpeg-turbo: devel/nasm
x-libs/jasper: libs/libjpeg-turbo
libs/tiff: libs/libjpeg-turbo
@end example

To proceed with each recipe, we can type:

@example
qi order imglibs.order | qi build --install -
@end example

The output of @samp{qi order imglibs.order} tells to qi in which order it
should build the recipes:

@example
devel/nasm
libs/libjpeg-turbo
x-libs/jasper
libs/tiff
@end example

@node Creating packages
@chapter Creating packages
@cindex package creation

The creation command is an internal function of qi to make new Qi
compatible packages.  A package is produced using the contents of
the Current Working Directory and the package file is written out.

@example
Usage: qi create [@var{Output/PackageName.tlz}]...
@end example

The argument for the file name to be written must contain a fully
qualified named directory as the output directory where the package
produced will be written.  The file name should be composed using the
full name: name-version-architecture-release[@@pkgcategory].tlz

@sc{Example}

@example
cd /usr/pkg
cd claws-mail_3.17.1_amd64-1@@x-apps
qi create /var/cache/qi/packages/claws-mail_3.17.1_amd64-1@@x-apps
@end example

In this case, the package "claws-mail_3.17.1_amd64-1@@x-apps" will be
written into @samp{/var/cache/qi/packages/}.

@noindent
All packages produced are complemented by a checksum file (.sha256).

@node Examining packages
@chapter Examining packages
@cindex package examination

The extraction command serves to examine binary packages for debugging
purposes. It decompresses a package into a single directory, verifying
its integrity and preserving all of its properties (owner and permissions).

@example
Usage: qi extract [@var{packagename.tlz}]...
@end example

@sc{Example}

@example
qi extract mksh_R56c_amd64-1@@shells.tlz
@end example

This action will put the content of "mksh_R56c_amd64-1@@shells.tlz" into a
single directory, this is a private directory for the user who requested
the action, creation operation will be equal to @strong{u=rwx,g=,o= (0700)}.
The package content will reside on this location, default mask to deploy
the content will be equal to @strong{u=rwx,g=rwx,o=rwx (0000)}.

@noindent
Note: the creation of the custom directory is influenced by the value
of the @env{TMPDIR} variable.

@node Qi exit status
@chapter Qi exit status
@cindex exit codes

All the exit codes are described in this chapter.

@table @samp
@item 0
Successful completion (no errors).

@item 1
Minor common errors:

@itemize @bullet
@item Help usage on invalid options or required arguments.

@item Program needed by qi (prerequisite) is not available.
@end itemize

@item 2
Command execution error:

This code is used to return the evaluation of an external command or shell
arguments in case of failure.

@item 3
Integrity check error for compressed files.

Compressed files means:

@itemize @bullet
@item A tarball file from tar(1), typically handled by the GNU tar implementation.
Supported extensions: .tar, .tar.gz, .tgz, .tar.Z, .tar.bz2, .tbz2, .tbz,
.tar.xz, .txz, .tar.zst, .tzst

@item A tarball file from tarlz(1).
Supported extensions: .tar.lz, .tlz

@item Zip files from unzip(1).
Supported extensions: .zip, .ZIP

@item Gzip files from gzip(1).
Supported extensions: .gz, .Z

@item Bzip2 files from bzip2(1).
Supported extension: .bz2

@item Lzip files from lzip(1).
Supported extension: .lz

@item Xz files from xz(1).
Supported extension: .xz

@item Zstd files from zstd(1).
Supported extension: .zst
@end itemize

@item 4
File empty, not regular, or expected.

It's commonly expected:

@itemize @bullet
@item An argument for giving commands.

@item A regular file or readable directory.

@item An expected extension: .tlz, .sha256, .order.

@item A protocol supported by the network downloader tool.
@end itemize

@item 5
Empty or not defined variable:

This code is used to report empty or undefined variables (usually
variables coming from a recipe or assigned arrays that are tested).

@item 6
Package already installed:

The package directory for an incoming .tlz package already exists.

@item 10
Network manager error:

This code is used if the network downloader tool fails for some reason.
@end table


code:
\input texinfo   @c -*-texinfo-*-
@comment $Id@w{$}
@comment %**start of header
@setfilename qi.info
@settitle Qi user guide
@documentencoding ISO-8859-1
@syncodeindex pg cp
@comment %**end of header

@set VERSION 2.9
@set UPDATED 22 Jun 2022

@dircategory Package management
@direntry
* Qi: (qi).                   A user-friendly package manager.
@end direntry

@ifnothtml
@titlepage
@finalout
@title Qi
@subtitle for version @value{VERSION}, @value{UPDATED}
@author Matias Fonzo (@email{selk@@dragora.org})

@page
@vskip 0pt plus 1filll
@end titlepage

@contents
@end ifnothtml

@ifnottex
@node Top
@top

This user guide is for Qi (version @value{VERSION},
@value{UPDATED}).
@end ifnottex

@menu
* Introduction to Qi::        Description and features of qi
* Invoking qi::               Command-line options
* The qirc file::             Configuration file
* Packages::                  Managing packages
* Recipes::                   Building packages
* Order files::               Handling build order
* Creating packages::         Making Qi packages
* Examining packages::        Debugging purposes
* Qi exit status::            Exit codes
* Index::
@end menu

@sp 1
Copyright @copyright{} 2019-2022 Matias Andres Fonzo, Santiago del Estero,
Argentina.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

@include qi-content.texi

@node Index
@unnumbered Index

@printindex cp

@bye

repo_name: dustdfg/dragora

license: mit


code:
.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.49.2.
.TH QI "1" "July 2022" "qi 2.10-rc1" "User Commands"
.SH NAME
qi \- a simple but well-integrated package manager
.SH SYNOPSIS
.B qi
\fI\,COMMAND \/\fR[\fI\,OPTIONS\/\fR] [\fI\,FILE\/\fR]...
.SH DESCRIPTION
Qi is a simple but well\-integrated package manager.  It can create,
install, remove, and upgrade software packages.  Qi produces binary
packages using recipes, which are files containing specific instructions
to build each package from source.  Qi can manage multiple packages
under a single directory hierarchy.  This method allows to maintain a
set of packages and multiple versions of them.  This means that Qi could
be used as the main package manager or complement the existing one.
.SH OPTIONS
.SS "List of commands:"
.TP
warn
Warn about files that will be installed
.TP
install
Install packages
.TP
remove
Remove packages
.TP
upgrade
Upgrade packages
.TP
extract
Extract packages for debugging purposes
.TP
create
Create a .tlz package from directory
.TP
build
Build packages using recipe names
.TP
order
Resolve build order through .order files
.SS "Options when installing, removing, or upgrading software packages:"
.TP
\fB\-f\fR, \fB\-\-force\fR
Force upgrade of pre\-existing packages
.TP
\fB\-k\fR, \fB\-\-keep\fR
Keep package directory when remove/upgrade
.TP
\fB\-p\fR, \fB\-\-prune\fR
Prune conflicts
.TP
\fB\-P\fR, \fB\-\-packagedir=\fR<dir>
Set directory for package installations
.TP
\fB\-t\fR, \fB\-\-targetdir=\fR<dir>
Set target directory for symbolic links
.TP
\fB\-r\fR, \fB\-\-rootdir=\fR<dir>
Use the fully qualified named directory as
the root directory for all qi operations
Note: the target directory and the package
directory will be relative to the specified
directory, excepting the graft log file
.SS "Options when building software packages using recipes:"
.TP
\fB\-a\fR, \fB\-\-architecture\fR
Set architecture name for the package
.TP
\fB\-j\fR, \fB\-\-jobs\fR
Parallel jobs for the compiler
.TP
\fB\-k\fR, \fB\-\-keep\fR
Keep ${srcdir} or ${destdir} when build
.TP
\fB\-S\fR, \fB\-\-skip\-questions\fR
Skip questions on completed recipes
.TP
\fB\-1\fR, \fB\-\-increment\fR
Increment release number (${release} + 1)
.TP
\fB\-n\fR, \fB\-\-no\-package\fR
Do not create a .tlz package
.TP
\fB\-i\fR, \fB\-\-install\fR
Install package after the build
.TP
\fB\-u\fR, \fB\-\-upgrade\fR
Upgrade package after the build
.TP
\fB\-o\fR, \fB\-\-outdir=\fR<dir>
Where the packages produced will be written
.TP
\fB\-w\fR, \fB\-\-worktree=\fR<dir>
Where archives, patches, recipes are expected
.TP
\fB\-s\fR, \fB\-\-sourcedir=\fR<dir>
Where compressed sources will be found
.SS "Other options:"
.TP
\fB\-N\fR, \fB\-\-no\-rc\fR
Do not read the configuration file
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Be verbose (an extra \fB\-v\fR gives more)
.TP
\fB\-L\fR, \fB\-\-show\-location\fR
Print default directory locations and exit
.TP
\fB\-h\fR, \fB\-\-help\fR
Display this help and exit
.TP
\fB\-V\fR, \fB\-\-version\fR
Output version information and exit
.SH ENVIRONMENT
.SS "Some influential environment variables:"
.TP
TMPDIR
Temporary directory for sources
.TP
QICFLAGS
C compiler flags (to be used on CFLAGS)
.TP
QICXXFLAGS
C++ compiler flags (to be used on CXXFLAGS)
.TP
QILDFLAGS
Flags for the linker (to be used on LDFLAGS)
.TP
QICPPFLAGS
C/C++ preprocessor flags (to be used on CPPFLAGS)
.TP
SOURCE_DATE_EPOCH
Last modification time for created packages
.SH "SEE ALSO"
The full documentation for
.B qi
is maintained as a Texinfo manual.  If the
.B info
and
.B qi
programs are properly installed at your site, the command
.IP
.B info qi
.PP
should give you access to the complete manual.


code:
#! /bin/sh -
# This file is part of the Qi distribution.
#
# A dummy copy as part of generating and organizing the help2man output.
#

PROGRAM=qi

usage()
{
    printf '%s' \
"Usage: $PROGRAM COMMAND [OPTIONS] [FILE]...
"'Qi is a simple but well-integrated package manager.  It can create,
install, remove, and upgrade software packages.  Qi produces binary
packages using recipes, which are files containing specific instructions
to build each package from source.  Qi can manage multiple packages
under a single directory hierarchy.  This method allows to maintain a
set of packages and multiple versions of them.  This means that Qi could
be used as the main package manager or complement the existing one.

Options:

List of commands:
  warn                     Warn about files that will be installed
  install                  Install packages
  remove                   Remove packages
  upgrade                  Upgrade packages
  extract                  Extract packages for debugging purposes
  create                   Create a .tlz package from directory
  build                    Build packages using recipe names
  order                    Resolve build order through .order files

Options when installing, removing, or upgrading software packages:
  -f, --force              Force upgrade of pre-existing packages
  -k, --keep               Keep package directory when remove/upgrade
  -p, --prune              Prune conflicts
  -P, --packagedir=<dir>   Set directory for package installations
  -t, --targetdir=<dir>    Set target directory for symbolic links
  -r, --rootdir=<dir>      Use the fully qualified named directory as
                           the root directory for all qi operations
                           Note: the target directory and the package
                           directory will be relative to the specified
                           directory, excepting the graft log file

Options when building software packages using recipes:
  -a, --architecture       Set architecture name for the package
  -j, --jobs               Parallel jobs for the compiler
  -k, --keep               Keep ${srcdir} or ${destdir} when build
  -S, --skip-questions     Skip questions on completed recipes
  -1, --increment          Increment release number (${release} + 1)
  -n, --no-package         Do not create a .tlz package
  -i, --install            Install package after the build
  -u, --upgrade            Upgrade package after the build
  -o, --outdir=<dir>       Where the packages produced will be written
  -w, --worktree=<dir>     Where archives, patches, recipes are expected
  -s, --sourcedir=<dir>    Where compressed sources will be found

Other options:
  -N, --no-rc              Do not read the configuration file
  -v, --verbose            Be verbose (an extra -v gives more)
  -L, --show-location      Print default directory locations and exit
  -h, --help               Display this help and exit
  -V, --version            Output version information and exit

Environment:

Some influential environment variables:
  TMPDIR                   Temporary directory for sources
  QICFLAGS                 C compiler flags (to be used on CFLAGS)
  QICXXFLAGS               C++ compiler flags (to be used on CXXFLAGS)
  QILDFLAGS                Flags for the linker (to be used on LDFLAGS)
  QICPPFLAGS               C/C++ preprocessor flags (to be used on CPPFLAGS)
  SOURCE_DATE_EPOCH        Last modification time for created packages
'
}

if test "$1" = --help
then
    usage
fi


code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Qi user guide</title>

<meta name="description" content="Qi user guide">
<meta name="keywords" content="Qi user guide">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="#Top" rel="start" title="Top">
<link href="#Index" rel="index" title="Index">
<link href="dir.html#Top" rel="up" title="(dir)">

Qi user guide

Next: Introduction to Qi, Up: (dir)   [Index]

This user guide is for Qi (version 2.9,
22 Jun 2022).

• Introduction to Qi:	  	Description and features of qi

• Invoking qi:	  	Command-line options

• The qirc file:	  	Configuration file

• Packages:	  	Managing packages

• Recipes:	  	Building packages

• Order files:	  	Handling build order

• Creating packages:	  	Making Qi packages

• Examining packages:	  	Debugging purposes

• Qi exit status:	  	Exit codes

• Index:

Copyright © 2019-2022 Matias Andres Fonzo, Santiago del Estero,
Argentina.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

Next: Invoking qi, Previous: Top, Up: Top   [Index]

1 Introduction to Qi

Qi is a simple but well-integrated package manager.  It can create,
install, remove, and upgrade software packages.  Qi produces binary
packages using recipes, which are files containing specific instructions
to build each package from source.  Qi can manage multiple packages
under a single directory hierarchy.  This method allows to maintain a set
of packages and multiple versions of them.  This means that Qi could be
used as the main package manager or complement the existing one.

Qi offers a friendly command line interface, a global configuration
file, a simple recipe layout to deploy software packages; also works
with binary packages in parallel, speeding up installations and packages
in production.  The format used for packages is a simplified and safer
variant of POSIX pax archive compressed in lzip format.

Qi is a modern (POSIX-compliant) shell script released under the
terms of the GNU General Public License.  There are only two major
dependencies for the magic: graft(1) and tarlz(1), the rest is expected
to be found in any Unix-like system.

Next: The qirc file, Previous: Introduction to Qi, Up: Top   [Index]

2 Invoking qi

This chapter describes the synopsis for invoking Qi.

Usage: qi COMMAND [<var>OPTION</var>...] [<var>FILE</var>]...

One mandatory command specifies the operation that ‘<samp>qi</samp>’ should
perform, options are meant to detail how this operation should be
performed during or after the process.

Qi supports the following commands:

warn

Warn about files that will be installed.

install

Install packages.

remove

Remove packages.

upgrade

Upgrade packages.

extract

Extract packages for debugging purposes.

create

Create a .tlz package from directory.

build

Build packages using recipe names.

order

Resolve build order through .order files

Options when installing, removing, or upgrading software packages:

-f

--force

Force upgrade of pre-existing packages.

-k

--keep

Keep directories when build/remove/upgrade.

Keep (don’t delete) the package directory when using remove/upgrade command.

This will also try to preserve the directories ‘<samp>${srcdir}</samp>’ and
‘<samp>${destdir}</samp>’ when using build command.  Its effect is available in
recipes as ‘<samp>${keep_srcdir}</samp>’ and ‘<samp>${keep_destdir}</samp>’.  See
Special variables for details.

-p

--prune

Prune conflicts.

-P

--packagedir=<dir>

Set directory for package installations.

-t

--targetdir=<dir>

Set target directory for symbolic links.

-r

--rootdir=<dir>

Use the fully qualified named directory as the root directory for all qi
operations.

Note: the target directory and the package directory will be
relative to the specified directory, excepting the graft log file.

Options when building software packages using recipes:

-a

--architecture

Set architecture name for the package.

-j

--jobs

Parallel jobs for the compiler.

This option sets the variable ‘<samp>${jobs}</samp>’.  If not specified, default
sets to 1.

-S

--skip-questions

Skip questions on completed recipes.

-1

--increment

Increment release number (‘<samp>${release}</samp>’ + 1).

The effect of this option will be omitted if –no-package is being used.

-n

--no-package

Do not create a .tlz package.

-i

--install

Install package after the build.

-u

--upgrade

Upgrade package after the build.

-o

--outdir=<dir>

Where the packages produced will be written.

This option sets the variable ‘<samp>${outdir}</samp>’.

-w

--worktree=<dir>

Where archives, patches, recipes are expected.

This option sets the variable ‘<samp>${worktree}</samp>’.

-s

--sourcedir=<dir>

Where compressed sources will be found.

This option sets the variable ‘<samp>${tardir}</samp>’.

Other options:

-v

--verbose

Be verbose (an extra -v gives more).

It sets the verbosity level, default sets to 0.

The value 1 is used for more verbosity while the value 2 is too detailed.
Although at the moment it is limited to graft(1) verbosity.

-N

--no-rc

Do not read the configuration file.

This will ignore reading the qirc file.

-L

--show-location

Print default directory locations and exit.

This will print the target directory, package directory, working tree,
the directory for sources, and the output directory for the packages
produced.

-h

--help

Display the usage and exit.

-V

--version

This will print the (short) version information and then exit.

The same can be achieved if Qi is invoked as ‘<samp>qi version</samp>’.

When FILE is -, qi can read from the standard input.  See examples from
the Packages section.

Exit status: 0 for a normal exit, 1 for minor common errors (help usage,
support not available, etc), 2 to indicate a command execution error;
3 for integrity check error on compressed files, 4 for empty, not
regular, or expected files, 5 for empty or not defined variables,
6 when a package already exist, 10 for network manager errors.
For more details, see the Qi exit status section.

Next: Packages, Previous: Invoking qi, Up: Top   [Index]

3 The qirc file

The global <samp>qirc</samp> file offers a way to define variables and tools
(such as a download manager) for default use.  This file is used by qi
at runtime, e.g., to build, install, remove or upgrade packages.

Variables and their possible values must be declared as any other
variable in the shell.

The command line options related to the package directory and target
directory and some of the command line options used for the build command,
have the power to override the values declared on <samp>qirc</samp>.
See Invoking qi.

The order in which qi looks for this file is:

 ${HOME}/.qirc
 Effective user.

 ‘<samp>${sysconfdir}/qirc</samp>’
 System-wide.

If you intend to run qi as effective user, the file
‘<samp>${sysconfdir}/qirc</samp>’ could be copied to ${HOME}/.qirc
setting the paths for ‘<samp>${packagedir}</samp>’ and ‘<samp>${targetdir}</samp>’
according to the $HOME.

Next: Recipes, Previous: The qirc file, Up: Top   [Index]

4 Packages

A package is a suite of programs usually distributed in binary form
which may also contain manual pages, documentation, or any other file
associated to a specific software.

The package format used by qi is a simplified POSIX pax archive
compressed using lzip1.  The
file extension for packages ends in ‘<samp>.tlz</samp>’.

Both package installation and package de-installation are managed using
two important (internal) variables: ‘<samp>${packagedir}</samp>’ and
‘<samp>${targetdir}</samp>’, these values can be changed in the
configuration file or via options.

‘<samp>${packagedir}</samp>’ is a common directory tree where the package
contents will be decompressed (will reside).

‘<samp>${targetdir}</samp>’ is a target directory where the links will be
made by graft(1) taking ‘<samp>${packagedir}/package_name</samp>’ into account.

Packages are installed in self-contained directory trees and symbolic
links from a common area are made to the package files.  This allows
multiple versions of the same package to coexist on the same system.

4.1 Package conflicts

All the links to install or remove a package are handled by graft(1).
Since multiple packages can be installed or removed at the same time,
certain conflicts may arise between the packages.

graft2
defines a CONFLICT as one of the following conditions:

 If the package object is a directory and the target object exists but is
not a directory.

 If the package object is not a directory and the target object exists
and is not a symbolic link.

 If the package object is not a directory and the target object exists
and is a symbolic link to something other than the package object.

The default behavior of qi for an incoming package is to ABORT if a
conflict arises.  When a package is going to be deleted, qi tells to
graft(1) to remove those parts that are not in conflict, leaving the
links to the belonging package.  This behavior can be forced if the
–prune option is given.

4.2 Installing packages

To install a single package, simply type:

qi install coreutils_8.30_i586-1@tools.tlz

To install multiple packages at once, type:

qi install gcc_8.3.0_i586-1@devel.tlz rafaela_2.2_i586-1@legacy.tlz ...

Warn about the files that will be linked:

qi warn bash_5.0_i586-1@shells.tlz

This is to verify the content of a package before installing it.

See the process of an installation:

qi install --verbose mariana_3.0_i586-1@woman.tlz

A second –verbose or -v option gives more (very verbose).

Installing package in a different location:

qi install --rootdir=/media/floppy lzip_1.21_i586-1@compressors.tlz

Important: the –rootdir option assumes ‘<samp>${targetdir}</samp>’ and
‘<samp>${packagedir}</samp>’.  See the following example:

qi install --rootdir=/home/selk lzip_1.21_i586-1@compressors.tlz

The content of "lzip_1.21_i586-1@compressors.tlz" will be decompressed
into ‘<samp>/home/selk/pkgs/lzip_1.21_i586-1@compressors</samp>’.
Assuming that the main binary for lzip is under
‘<samp>/home/selk/pkgs/lzip_1.21_i586-1@compressors/usr/bin/</samp>’
the target for "usr/bin" will be created at ‘<samp>/home/selk</samp>’.  Considering
that you have exported the PATH as ‘<samp>${HOME}/usr/bin</samp>’, now the
system is able to see the recent lzip command.

Installing from a list of packages using standard input:

qi install - < PACKAGELIST.txt

Or in combination with another tool:

sort -u PACKAGELIST.txt | qi install -

The sort command will read and sorts the list of declared packages,
while trying to have unique entries for each statement.  The output
produced is captured by Qi to install each package.

An example of a list containing package names is:

/var/cache/qi/packages/amd64/tcl_8.6.9_amd64-1@devel.tlz
/var/cache/qi/packages/amd64/tk_8.6.9.1_amd64-1@devel.tlz
/var/cache/qi/packages/amd64/vala_0.42.3_amd64-1@devel.tlz

4.3 Removing packages

To remove a package, simply type:

qi remove xz_5.2.4_i586-1@compressors.tlz

Remove command will match the package name using ‘<samp>${packagedir}</samp>’ as
prefix.  For example, if the value of ‘<samp>${packagedir}</samp>’ has been
set to /usr/pkg, this will be equal to:

qi remove /usr/pkg/xz_5.2.4_i586-1@compressors

Detailed output:

qi remove --verbose /usr/pkg/xz_5.2.4_i586-1@compressors

A second –verbose or -v option gives more (very verbose).

By default the remove command does not preserve a package directory after
removing its links from ‘<samp>${targetdir}</samp>’, but this behavior can be
changed if the –keep option is passed:

qi remove --keep /usr/pkg/lzip_1.21_i586-1@compressors

This means that the links to the package can be reactivated, later:

cd /usr/pkg && graft -i lzip_1.21_i586-1@compressors

Removing package from a different location:

qi remove --rootdir=/home/cthulhu xz_5.2.4_i586-1@compressors

Removing a package using standard input:

echo vala_0.42.3_amd64-1@devel | qi remove -

This will match with the package directory.

4.4 Upgrading packages

The upgrade command inherits the properties of the installation and removal
process.  To make sure that a package is updated, the package is installed
in a temporary directory taking ‘<samp>${packagedir}</samp>’ into account.  Once
the incoming package is pre-installed, qi can proceed to search and delete
packages that have the same name (considered as previous ones).  Finally,
the package is re-installed at its final location and the temporary
directory is removed.

Since updating a package can be crucial and so to perform a successful
upgrade, from start to finish, you will want to ignore some important
system signals during the upgrade process, those signals are SIGHUP,
SIGINT, SIGQUIT, SIGABRT, and SIGTERM.

To upgrade a package, just type:

qi upgrade gcc_9.0.1_i586-1@devel.tlz

This will proceed to upgrade "gcc_9.0.1_i586-1@devel" removing any other
version of "gcc" (if any).

If you want to keep the package directories of versions found during the
upgrade process, just pass:

qi upgrade --keep gcc_9.0.1_i586-1@devel.tlz

To see the upgrade process:

qi upgrade --verbose gcc_9.0.1_i586-1@devel.tlz

A second –verbose or -v option gives more (very verbose).

To force the upgrade of an existing package:

qi upgrade --force gcc_9.0.1_i586-1@devel.tlz

4.4.1 Package blacklist

To implement general package facilities, either to install, remove or
maintain the hierarchy of packages in a clean manner, qi makes use of the
pruning operation via graft(1) by default:

There is a risk if those are crucial packages for the proper functioning
of the system, because it implies the deactivation of symbolic from the
target directory, especially when transitioning an incoming package
into its final location during an upgrade.

A blacklist of package names has been devised for the case where
a user decides to upgrade all the packages in the system, or
just the crucial ones, such as the C library.

The blacklist is related to the upgrade command only, consists in installing
a package instead of updating it or removing previous versions of it;
the content of the package will be updated over the existing content at
‘<samp>${packagedir}</samp>’, while the existing links from
‘<samp>${targetdir}</samp>’ will be preserved.  A pruning of links will be
carried out in order to re-link possible differences with the recent
content, this helps to avoid leaving dead links in the target directory.

Package names for the blacklist to be declared must be set from the
configuration file.  By default, it is declared using the package name,
which is more than enough for critical system packages, but if you want to
be more specific, you can declare a package using:
‘<samp>${pkgname}_${pkgversion}_${arch}-${release}</samp>’ where
the package category is avoided for common matching.  See
Special variables for a description of these variables.

Next: Order files, Previous: Packages, Up: Top   [Index]

5 Recipes

A recipe is a file telling qi what to do.  Most often, the recipe tells
qi how to build a binary package from a source tarball.

A recipe has two parts: a list of variable definitions and a list of
sections.  By convention, the syntax of a section is:

section_name()
{
    section lines
}

The section name is followed by parentheses, one newline and an opening
brace.  The line finishing the section contains just a closing brace.
The section names or the function names currently recognized are
‘<samp>build</samp>’.

The ‘<samp>build</samp>’ section (or shell function) is an augmented
shell script that contains the main instructions to build software
from source.

If there are other functions defined by the packager, Qi detects them
for later execution.

5.1 Variables

A "variable" is a shell variable defined either in <samp>qirc</samp>
or in a recipe to represent a string of text, called the variable’s
"value".  These values are substituted by explicit request in the
definitions of other variables or in calls to external commands.

Variables can represent lists of file names, options to pass to
compilers, programs to run, directories to look in for source files,
directories to write output to, or anything else you can imagine.

Definitions of variables in qi have four levels of precedence.
Options which define variables from the command-line override those
specified in the <samp>qirc</samp> file, while variables defined in the recipe
override those specified in <samp>qirc</samp>, taking priority over those
variables set by command-line options.  Finally, the variables have
default values if they are not defined anywhere.

Options that set variables through the command-line can only reference
variables defined in <samp>qirc</samp> and variables with default values.

Definitions of variables in <samp>qirc</samp> can only reference variables
previously defined in <samp>qirc</samp> and variables with default values.

Definitions of variables in the recipe can only reference variables
set by the command-line, variables previously defined in the recipe,
variables defined in <samp>qirc</samp>, and variables with default values.

5.2 Special variables

There are variables which can only be set using the command line options or
via <samp>qirc</samp>, there are other special variables which can be defined or
redefined in a recipe.  See the following definitions:

‘<samp>outdir</samp>’ is the directory where the packages produced are written.
This variable can be redefined per-recipe.  Default sets to
‘<samp>/var/cache/qi/packages</samp>’.

‘<samp>worktree</samp>’ is the working tree where archives, patches, and recipes
are expected.  This variable can not be redefined in the recipe.  Default
sets to ‘<samp>/usr/src/qi</samp>’.

‘<samp>tardir</samp>’ is defined in the recipe to the directory where the tarball
containing the source can be found.  The full name of the tarball is
composed as ‘<samp>${tardir}/$tarname</samp>’.  Its value is available in the
recipe as ‘<samp>${tardir}</samp>’; a value of . for ‘<samp>tardir</samp>’ sets it to
the value of CWD (Current Working Directory), this is where the recipe
lives.

‘<samp>arch</samp>’ is the architecture to compose the package name.  Its value is
available in the recipe as ‘<samp>${arch}</samp>’.  Default value is the one
that was set in the Qi configuration.

‘<samp>jobs</samp>’ is the number of parallel jobs to pass to the compiler.  Its
value is available in the recipe as ‘<samp>${jobs}</samp>’.  The default value
is 1.

The two variables ‘<samp>${srcdir}</samp>’ and ‘<samp>${destdir}</samp>’ can be
set in the recipe, as any other variable, but if they are not, qi uses
default values for them when building a package.

‘<samp>srcdir</samp>’ contains the source code to be compiled, and defaults to
‘<samp>${program}-${version}</samp>’.  ‘<samp>destdir</samp>’ is the place where the
built package will be installed, and defaults to
‘<samp>${TMPDIR}/package-${program}</samp>’.

If ‘<samp>pkgname</samp>’ is left undefined, the special variable ‘<samp>program</samp>’
is assigned by default.  If ‘<samp>pkgversion</samp>’ is left undefined, the
special variable ‘<samp>version</samp>’ is assigned by default.

‘<samp>pkgname</samp>’ and ‘<samp>pkgversion</samp>’ along with: ‘<samp>version</samp>’, ‘<samp>arch</samp>’,
‘<samp>release</samp>’, and (optionally) ‘<samp>pkgcategory</samp>’ are used to produce the
package name in the form:
‘<samp>${pkgname}_${pkgversion}_${arch}-${release}[@${pkgcategory}].tlz</samp>’

‘<samp>pkgcategory</samp>’ is an optional special variable that can be defined on the
recipe to categorize the package name.  If it is defined, then the
package output will be composed as
‘<samp>${pkgname}_${pkgversion}_${arch}-${release}[@${pkgcategory}.tlz</samp>’.
Automatically, the value of ‘<samp>pkgcategory</samp>’ will be prefixed using the
‘<samp>@</samp>’ (at) symbol which will be added to the last part of the package name.

A special variable called ‘<samp>replace</samp>’ can be used to declare package names
that will be replaced at installation time.

The special variables ‘<samp>keep_srcdir</samp>’ and ‘<samp>keep_destdir</samp>’ are provided
in order to preserve the directories ‘<samp>${srcdir}</samp>’ or ‘<samp>${destdir}</samp>’,
if those exists as such.  Note: The declaration of these variables are subject
to manual deactivation; its purpose in recipes is to preserve the directories
that relate to the package’s build (source) and destination directory, that is
so that another recipe can get a new package (or meta package) from there.  For
example, the declarations can be done as:

keep_srcdir=keep_srcdir
keep_destdir=keep_destdir

Then from another recipe you would proceed to copy the necessary files that
will compose the meta package, from the main function you must deactivate
the variables at the end:

unset -v keep_srcdir keep_destdir

This will leave the ’keep_srcdir’ and ’keep_destdir’ variables blank to
continue with the rest of the recipes.

The variable ‘<samp>tarlz_compression_options</samp>’ can be used to change the
default compression options in tarlz(1), default sets to ‘<samp>-9 --solid</samp>’.
For example if the variable is declared as:

tarlz_compression_options="-0 --bsolid"

It will change the granularity of tarlz(1) by using the ‘<samp>--bsolid</samp>’
option 3,
as well as increasing the compression speed by lowering the compression
level with ‘<samp>-0</samp>’.

This is only recommended for recipes where testing, or faster processing is
desired to create the packaged file more quickly.  It is not recommended for
production or general distribution of binary packages.

A typical recipe contains the following variables:

 ‘<samp>program</samp>’: Software name.

It matches the source name.  It is also used to compose the name of the
package if ‘<samp>${pkgname}</samp>’ is not specified.

 ‘<samp>version</samp>’: Software version.

It matches the source name.  It is also used to compose the version of the
package if ‘<samp>${pkgversion}</samp>’ is not specified.

 ‘<samp>arch</samp>’: Software architecture.

It is used to compose the architecture of the package in which it is
build.

 ‘<samp>release</samp>’: Release number.

This is used to reflect the release number of the package.  It is
recommended to increase this number after any significant change in
the recipe or post-install script.

 ‘<samp>pkgcategory</samp>’: Package category.

Optional but recommended variable to categorize the package name when it is
created.

Obtaining sources over the network must be declared in the recipe using
the ‘<samp>fetch</samp>’ variable.

The variables ‘<samp>netget</samp>’ and ‘<samp>rsync</samp>’ can be defined in <samp>qirc</samp>
to establish a network downloader in order to get the sources.  If they
are not defined, qi uses default values:

‘<samp>netget</samp>’ is the general network downloader tool, defaults sets to
‘<samp>wget2 -c -w1 -t3 --no-check-certificate</samp>’.

‘<samp>rsync</samp>’ is the network tool for sources containing the prefix for
the RSYNC protocol, default sets to
‘<samp>rsync -v -a -L -z -i --progress</samp>’.

The variable ‘<samp>description</samp>’ is used to print the package description
when a package is installed.

A description has two parts: a brief description, and a long description.
By convention, the syntax of ‘<samp>description</samp>’ is:

description="
Brief description.

Long description.
"

The first line of the value represented is a brief description of the
software (called "blurb").  A blank line separates the brief
description from the long description, which should contain a more
descriptive description of the software.

An example looks like:

description="
The GNU core utilities.

The GNU core utilities are the basic file, shell and text manipulation
utilities of the GNU operating system.  These are the core utilities
which are expected to exist on every operating system.
"

Please consider a length limit of 78 characters as maximum, because the same
one would be used on the meta file creation.  See
The meta file section.

The ‘<samp>homepage</samp>’ variable is used to declare the main site or home page:

homepage=https://www.gnu.org/software/gcc

The variable ‘<samp>license</samp>’ is used for license information4.
Some code in the program can be covered by license A, license B, or
license C.  For "separate licensing" or "heterogeneous licensing", we
suggest using | for a disjunction, & for a conjunction
(if that ever happens in a significant way), and comma for heterogeneous
licensing.  Comma would have lower precedence, plus added special terms.

license="LGPL, GPL | Artistic - added permission"

5.3 Writing recipes

Originally, Qi was designed for the series of Dragora GNU/Linux-Libre 3;
this doesn’t mean you can’t use it in another distribution, just that if
you do, you’ll have to try it out for yourself. To help with this, here
are some references to well-written recipes:

 https://git.savannah.nongnu.org/cgit/dragora.git/tree/recipes

 https://notabug.org/dragora/dragora/src/master/recipes

 https://notabug.org/dragora/dragora-extras/src/master/recipes

 https://git.savannah.nongnu.org/cgit/dragora/dragora-extras.git/tree/recipes

5.4 Building packages

A recipe is any valid regular file.  Qi sets priorities for reading a
recipe, the order in which qi looks for a recipe is:

 Current working directory.

 If the specified path name does not contain "recipe" as the last
component.  Qi will complete it by adding "recipe" to the path name.

 If the recipe is not in the current working directory, it will be
searched under ‘<samp>${worktree}/recipes</samp>’.  The last component will be
completed adding "recipe" to the specified path name.

To build a single package, type:

qi build x-apps/xterm

Multiple jobs can be passed to the compiler to speed up the build process:

qi build --jobs 3 x-apps/xterm

Update or install the produced package (if not already installed) when the
build command ends:

qi build -j3 --upgrade x-apps/xterm

Only process a recipe but do not create the binary package:

qi build --no-package dict/aspell

The options –install or –upgrade have no effect when –no-package
is given.

This is useful to inspect the build process of the above recipe:

qi build –keep –no-package dict/aspell 2>&1 | tee aspell-log.txt

The –keep option could preserve the source directory and the destination
directory for later inspection.  A log file of the build process will be
created redirecting both, standard error and standard output to tee(1).

5.5 Variables from the environment

Qi has environment variables which can be used at build time:

The variable TMPDIR sets the temporary directory for sources, which is
used for package extractions (see Examining packages) and is
prepended to the value of ‘<samp>${srcdir}</samp>’ and ‘<samp>${destdir}</samp>’ in
build command.  By convention its default value is equal to
‘<samp>/usr/src/qi/build</samp>’.

The variables QICFLAGS, QICXXFLAGS, QILDFLAGS, and
QICPPFLAGS have no effect by default.  The environment variables
such as CFLAGS, CXXFLAGS, LDFLAGS, and CPPFLAGS
are unset at compile time:

Recommended practice is to set variables in the command line of
‘<samp>configure</samp>’ or make(1) instead of exporting to the
environment.  As follows:

https://www.gnu.org/software/make/manual/html_node/Environment.html

It is not wise for makefiles to depend for their functioning on environment
variables set up outside their control, since this would cause different
users to get different results from the same makefile.  This is against the
whole purpose of most makefiles.

Setting environment variables for configure is deprecated because running
configure in varying environments can be dangerous.

https://gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Defining-Variables.html

Variables not defined in a site shell script can be set in the environment
passed to configure.  However, some packages may run configure again
during the build, and the customized values of these variables may be
lost.  In order to avoid this problem, you should set them in the
configure command line, using ‘<samp>VAR=value</samp>’.  For example:

./configure CC=/usr/local2/bin/gcc

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html

If for instance the user runs ‘<samp>CC=bizarre-cc ./configure</samp>’, then the cache,
config.h, and many other output files depend upon bizarre-cc being the C
compiler.  If for some reason the user runs ./configure again, or if it is
run via ‘<samp>./config.status --recheck</samp>’, (See Automatic Remaking, and see
config.status Invocation), then the configuration can be inconsistent,
composed of results depending upon two different compilers.
[...]
Indeed, while configure can notice the definition of CC in ‘<samp>./configure
CC=bizarre-cc</samp>’, it is impossible to notice it in ‘<samp>CC=bizarre-cc
./configure</samp>’, which, unfortunately, is what most users do.
[...]
configure: error: changes in the environment can compromise the build.

If the SOURCE_DATE_EPOCH environment variable is set to a UNIX timestamp
(defined as the number of seconds, excluding leap seconds, since 01 Jan 1970
00:00:00 UTC.); then the given timestamp will be used to overwrite any newer
timestamps on the package contents (when it is created).  More information
about this can be found at
https://reproducible-builds.org/specs/source-date-epoch/.

5.6 The meta file

The "meta file" is a regular file created during the build process, it
contains information about the package such as package name, package
version, architecture, release, fetch address, description, and other
minor data extracted from processed recipes.  The name of the file is
generated as ‘<samp>${full_pkgname}.tlz.txt</samp>’, and its purpose is to
reflect essential information to the user without having to look inside
the package content.  The file format is also intended to be used by
other scripts or by common Unix tools.

The content of a meta file looks like:

#
# Pattern scanning and processing language.
#
# The awk utility interprets a special-purpose programming language
# that makes it possible to handle simple data-reformatting jobs
# with just a few lines of code.  It is a free version of 'awk'.
#
# GNU awk implements the AWK utility which is part of
# IEEE Std 1003.1 Shell and Utilities (XCU).
#

QICFLAGS="-O2"
QICXXFLAGS="-O2"
QILDFLAGS=""
QICPPFLAGS=""
pkgname=gawk
pkgversion=5.0.1
arch=amd64
release=1
pkgcategory="tools"
full_pkgname=gawk_5.0.1_amd64-1@tools
blurb="Pattern scanning and processing language."
homepage="https://www.gnu.org/software/gawk"
license="GPLv3+"
fetch="https://ftp.gnu.org/gnu/gawk/gawk-5.0.1.tar.lz"
replace=""

A package descriptions is extracted from the variable ‘<samp>description</samp>’
where each line is interpreted literally and pre-formatted to fit in
(exactly) 80 columns, plus the character ‘<samp>#</samp>’ and a blank
space is prefixed to every line (shell comments).

In addition to the Special variables, there are implicit variables such as
‘<samp>blurb</samp>’:

The ‘<samp>blurb</samp>’ variable is related to the special variable
‘<samp>description</samp>’.  Its value is made from the first (substantial)
line of ‘<samp>description</samp>’, mentioned as the "brief description".

The build flags such as ‘<samp>QICFLAGS</samp>’, ‘<samp>QICXXFLAGS</samp>’,
‘<samp>QILDFLAGS</samp>’, and ‘<samp>QICPPFLAGS</samp>’ are only added to the meta file
if the declared variable ‘<samp>arch</samp>’ is not equal to the "noarch" value.

Next: Creating packages, Previous: Recipes, Up: Top   [Index]

6 Order files

The order command has the purpose of resolving the build order through
.order files.  An order file contains a list of recipe names, by default
does not perform any action other than to print a resolved list in
descending order.  For example, if a depends on b and
c, and c depends on b as well, the file might
look like:

a: c b
b:
c: b

Each letter represents a recipe name, complete dependencies for
the first recipe name are listed in descending order, which is
printed from right to left, and removed from left to right:

OUTPUT

b
c
a

Blank lines, colons and parentheses are simply ignored.  Comment lines
beginning with ‘<samp>#</samp>’ are allowed.

An order file could be used to build a series of packages, for example,
if the content is:

# Image handling libraries

libs/libjpeg-turbo: devel/nasm
x-libs/jasper: libs/libjpeg-turbo
libs/tiff: libs/libjpeg-turbo

To proceed with each recipe, we can type:

qi order imglibs.order | qi build --install -

The output of ‘<samp>qi order imglibs.order</samp>’ tells to qi in which order it
should build the recipes:

devel/nasm
libs/libjpeg-turbo
x-libs/jasper
libs/tiff

Next: Examining packages, Previous: Order files, Up: Top   [Index]

7 Creating packages

The creation command is an internal function of qi to make new Qi
compatible packages.  A package is produced using the contents of
the Current Working Directory and the package file is written out.

Usage: qi create [<var>Output/PackageName.tlz</var>]...

The argument for the file name to be written must contain a fully
qualified named directory as the output directory where the package
produced will be written.  The file name should be composed using the
full name: name-version-architecture-release[@pkgcategory].tlz

EXAMPLE

cd /usr/pkg
cd claws-mail_3.17.1_amd64-1@x-apps
qi create /var/cache/qi/packages/claws-mail_3.17.1_amd64-1@x-apps

In this case, the package "claws-mail_3.17.1_amd64-1@x-apps" will be
written into ‘<samp>/var/cache/qi/packages/</samp>’.

All packages produced are complemented by a checksum file (.sha256).

Next: Qi exit status, Previous: Creating packages, Up: Top   [Index]

8 Examining packages

The extraction command serves to examine binary packages for debugging
purposes. It decompresses a package into a single directory, verifying
its integrity and preserving all of its properties (owner and permissions).

Usage: qi extract [<var>packagename.tlz</var>]...

EXAMPLE

qi extract mksh_R56c_amd64-1@shells.tlz

This action will put the content of "mksh_R56c_amd64-1@shells.tlz" into a
single directory, this is a private directory for the user who requested
the action, creation operation will be equal to u=rwx,g=,o= (0700).
The package content will reside on this location, default mask to deploy
the content will be equal to u=rwx,g=rwx,o=rwx (0000).

Note: the creation of the custom directory is influenced by the value
of the TMPDIR variable.

Next: Index, Previous: Examining packages, Up: Top   [Index]

9 Qi exit status

All the exit codes are described in this chapter.

‘<samp>0</samp>’

Successful completion (no errors).

‘<samp>1</samp>’

Minor common errors:

 Help usage on invalid options or required arguments.

 Program needed by qi (prerequisite) is not available.

‘<samp>2</samp>’

Command execution error:

This code is used to return the evaluation of an external command or shell
arguments in case of failure.

‘<samp>3</samp>’

Integrity check error for compressed files.

Compressed files means:

 A tarball file from tar(1), typically handled by the GNU tar implementation.
Supported extensions: .tar, .tar.gz, .tgz, .tar.Z, .tar.bz2, .tbz2, .tbz,
.tar.xz, .txz, .tar.zst, .tzst

 A tarball file from tarlz(1).
Supported extensions: .tar.lz, .tlz

 Zip files from unzip(1).
Supported extensions: .zip, .ZIP

 Gzip files from gzip(1).
Supported extensions: .gz, .Z

 Bzip2 files from bzip2(1).
Supported extension: .bz2

 Lzip files from lzip(1).
Supported extension: .lz

 Xz files from xz(1).
Supported extension: .xz

 Zstd files from zstd(1).
Supported extension: .zst

‘<samp>4</samp>’

File empty, not regular, or expected.

It’s commonly expected:

 An argument for giving commands.

 A regular file or readable directory.

 An expected extension: .tlz, .sha256, .order.

 A protocol supported by the network downloader tool.

‘<samp>5</samp>’

Empty or not defined variable:

This code is used to report empty or undefined variables (usually
variables coming from a recipe or assigned arrays that are tested).

‘<samp>6</samp>’

Package already installed:

The package directory for an incoming .tlz package already exists.

‘<samp>10</samp>’

Network manager error:

This code is used if the network downloader tool fails for some reason.

Previous: Qi exit status, Up: Top   [Index]

Index

Jump to:   	C

E

H

I

M

P

R

S

T

V

W

	Index Entry	 	 Section

C

	configuration file:	 	The qirc file

E

	environment variables:	 	Recipes

	exit codes:	 	Qi exit status

H

	handling build order:	 	Order files

I

	introduction to qi:	 	Introduction to Qi

	invocation:	 	Invoking qi

M

	managing packages:	 	Packages

P

	package blacklist:	 	Packages

	package build:	 	Recipes

	package conflicts:	 	Packages

	package creation:	 	Creating packages

	package de-installation:	 	Packages

	package examination:	 	Examining packages

	package installation:	 	Packages

	package upgrade:	 	Packages

R

	recipes:	 	Recipes

S

	special variables:	 	Recipes

T

	the meta file:	 	Recipes

V

	variables:	 	Recipes

W

	writing recipes:	 	Recipes

Jump to:   	C

E

H

I

M

P

R

S

T

V

W

Footnotes

(1)

For more details about tarlz and the
lzip format, visit https://lzip.nongnu.org/tarlz.html.

(2)

The official guide for Graft can be found at
https://peters.gormand.com.au/Home/tools/graft/graft.html.

(3)

About the ‘<samp>--bsolid</samp>’ granularity option of tarlz(1),
https://www.nongnu.org/lzip/manual/tarlz_manual.html#g_t_002d_002dbsolid.

(4)

The proposal for ‘<samp>license</samp>’ was made by Richard M. Stallman at
https://lists.gnu.org/archive/html/gnu-linux-libre/2016-05/msg00003.html.