ebuildtester

From Gentoo Wiki
Jump to:navigation Jump to:search

This article is a stub. Please help out by expanding it - how to get started.

ebuildtester is a Python script to help automate parts of the ebuild testing process by generating Docker containers that replicate "fresh" Gentoo installations.

ebuildtester compiles a docker container holding the "current" Gentoo stage3, allowing testing in a "clean" environment.

This environment is configured by invoking ebuildtester with appropriate command-line parameters. On execution, ebuildtester either installs the specified package, or puts the user into a shell, inside the container.

See also
The official documentation has more details for using ebuildtester.

Installation

USE flags

USE flags for dev-util/ebuildtester A dockerized approach to test a Gentoo package within a clean stage3 container

doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

Emerge

root #emerge --ask dev-util/ebuildtester

Usage

user $ebuildtester --help
usage: ebuildtester [-h] [--version] [--atom ATOM [ATOM ...]] [--binhost BINHOST] [--live-ebuild]
                    [--manual] --portage-dir PORTAGE_DIR [--overlay-dir OVERLAY_DIR] [--update]
                    [--install-basic-packages] [--threads N] [--use USE [USE ...]]
                    [--global-use GLOBAL_USE [GLOBAL_USE ...]] [--unmask ATOM] [--unstable] [--gcc-version VER]
                    [--python-single-target PYTHON_SINGLE_TARGET] [--python-targets PYTHON_TARGETS]
                    [--rm] [--storage-opt STORAGE_OPT [STORAGE_OPT ...]] [--with-X] [--with-vnc]
                    [--profile PROFILE] [--features FEATURES [FEATURES ...]] [--docker-image DOCKER_IMAGE]
                    [--docker-command DOCKER_COMMAND] [--pull] [--show-options]
                    [--ccache CCACHE_DIR] [--batch] [--debug]

A dockerized approach to test a Gentoo package within a clean stage3.

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --atom ATOM [ATOM ...]
                        The package atom(s) to install
  --binhost BINHOST     Binhost URI
  --live-ebuild         Unmask the live ebuild of the atom
  --manual              Install package manually
  --portage-dir PORTAGE_DIR
                        The local portage directory
  --overlay-dir OVERLAY_DIR
                        Add overlay dir (can be used multiple times)
  --update              Update container before installing atom
  --install-basic-packages
                        Install basic packages after container starts
  --threads N           Use N (default 20) threads to build packages
  --use USE [USE ...]   The use flags for the atom
  --global-use GLOBAL_USE [GLOBAL_USE ...]
                        Set global USE flag
  --unmask ATOM         Unmask atom (can be used multiple times)
  --unstable            Globally 'unstable' system, i.e. ~amd64
  --gcc-version VER     Use gcc version VER
  --python-single-target PYTHON_SINGLE_TARGET
                        Specify a PYTHON_SINGLE_TARGET
  --python-targets PYTHON_TARGETS
                        Specify a PYTHON_TARGETS
  --rm                  Remove container after session is done
  --storage-opt STORAGE_OPT [STORAGE_OPT ...]
                        Storage driver options for all volumes (same as Docker param)
  --with-X              Globally enable the X USE flag
  --with-vnc            Install VNC server to test graphical applications
  --profile PROFILE     The profile to use (default = default/linux/amd64/23.0)
  --features FEATURES [FEATURES ...]
                        Set FEATURES in Gentoo Wiki (default = ['-sandbox', '-usersandbox', 'userfetch'])
  --docker-image DOCKER_IMAGE
                        Specify the docker image to use (default = gentoo/stage3)
  --docker-command DOCKER_COMMAND
                        Specify the docker command
  --pull                Download latest docker image
  --show-options        Show currently selected options and defaults
  --ccache CCACHE_DIR   Path to mount that contains ccache cache
  --batch               Do not drop into interactive shell
  --debug               Add some debugging output
Note
The --portage-dir option is mandatory, as well as use of either --atom or --manual. It is possible to pass in one or more additional overlays with the --overlay-dir option.
Warning
ebuildtester maps the portage and overlay dirs into the container, so changes to the files inside the container will affect the files outside the container on the actual local file system.

An example command for reference could look like this:

CODE One-time test
ebuildtester --portage-dir /var/db/repos/gentoo/ \
--overlay-dir /var/db/repos/src_prepare-overlay/ \
--binhost https://mirror.bytemark.co.uk/gentoo/releases/amd64/binpackages/23.0/x86-64/ \
--threads 20 \
--rm \
--update \
--pull \
--install-basic-packages \
--global-use dist-kernel \
--unmask =virtual/dist-kernel-6.11.3 \
--unmask =sys-kernel/gentoo-kernel-bin-6.11.3 \
--atom sys-kernel/gentoo-kernel-bin-6.11.3 games-util/xone-0.3_p20240425

Removal

Unmerge

root #emerge --ask --depclean --verbose dev-util/ebuildtester

See also