\section{Available commands}
\label{ebuild-env-commands}

This section documents the commands available to an ebuild. Unless otherwise specified, they may be
aliases, shell functions, or executables in the ebuild's \t{PATH}.

When an ebuild is being sourced for metadata querying rather than for a build (that is to say,
when none of the \t{src\_} or \t{pkg\_} functions are to be called), no external command may
be executed. The package manager may take steps to enforce this.

\subsection{System commands}

Any ebuild not listed in the system set for the active profile(s) may assume the presence of every
command that is always provided by the system set for that profile. However, it must target the
lowest common denominator of all systems on which it might be installed---in most cases this means
that the only packages that can be assumed to be present are those listed in the \t{base} profile or
equivalent, which is inherited by all available profiles. If an ebuild requires any applications not
provided by the system profile, or that are provided conditionally based on USE flags, appropriate
dependencies must be used to ensure their presence.

\subsubsection{Guaranteed system commands}
\label{guaranteed-system-commands}

The following commands must always be available in the ebuild environment:
\begin{compactitem}
\item All builtin commands in GNU bash, version 3.0.
\item \t{sed} must be available, and must support all forms of invocations valid for GNU sed
    version 4 or later.
\item \t{patch} must be available, and must support all inputs valid for GNU patch.
\end{compactitem}

\subsection{Commands provided by package dependencies}

In some cases a package's build process will require the availability of executables not provided by
the core system, a common example being autotools. Commands provided by dependencies are available
in the following cases:
\begin{compactitem}
\item In the \t{src} phases, any command provided by a package listed in \t{DEPEND} is available.
\item In the \t{pkg} phases, commands provided by a package listed in both \t{DEPEND} \b{and} \t{RDEPEND} are
    available, unless the package being merged is part of a circular dependency loop.
\end{compactitem}

\subsection{Ebuild-specific Commands}
\input{pkg-mgr-commands.tex}

% vim: set filetype=tex fileencoding=utf8 et tw=100 spell spelllang=en :
