Iwdevtools

From Gentoo Wiki
Jump to:navigation Jump to:search

Iwdevtools is a group of small tools to aid with Gentoo development, primarily intended for QA.

Installation

USE flags

USE flags for app-portage/iwdevtools Small tools to aid with Gentoo development, primarily intended for QA

test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)

Emerge

root #emerge --ask app-portage/iwdevtools

Usage

Atomf

atomf prints package atoms based on the format given as an argument.

Invocation

user $atomf --help

Printing a package atom

By default, atomf will print all 9 format types if no format is specified:

user $atomf ">=sys-libs/glibc-2.38-r10"
? >= ? glibc 2.38 10 ? ?

With the following columns denoting:

  1. Blocker indicator
  2. Version range operator
  3. Category
  4. Package name
  5. Version
  6. Revision
  7. Slot
  8. Subslot
  9. Binding operator

Specific formatting

To print just the package's name, pass the format in first:

user $atomf %n ">=sys-libs/glibc-2.38-r10"
glibc

Eoldnew

eoldnew is a helper program for qa-cmp which emerges the package defined by <atom> but by first emerging its previous (visible) version if not already installed.

Invocation

user $eoldnew --help

Emerging an older version first

To emerge an older version of a package, pass the argument in with any other arguments after it being emerge arguments:

user $eoldnew app-editors/vim --pretend

Find-unresolved

find-unresolved is primarily intended for working with embedded systems and ensuring no needed libraries are missing (normally portage verifies this automatically).

Invocation

user $find-unresolved --help

Finding unresolved soname dependencies

To scan a directory for unresolved dependencies, pass the directory in as an argument:

user $find-unresolved /

Qa-cmp

qa-cmp compares the image installation of one atom to another.

Invocation

user $qa-cmp --help

Comparing two packages

First, ensure both have been built with their image directories intact, i.e. by using ebuild ... clean install

Next, run qa-cmp:

root #qa-cmp category/package-1.0.0 category/package-2.0.0

If nothing outputs then there were no differences.

Qa-openrc

Similar to qa-cmp, this scans an image directory to report issues in OpenRC scripts.

Invocation

user $qa-openrc --help

Checking a service script

root #qa-openrc category/package-1.0.0

Qa-sed

Note
qa-sed's primary purpose is to be used as a Portage integration, although it can be used individually

qa-sed reports when all files were unmodified to detect outdated constructs, similar to patch.

Invocation

user $qa-sed --help

Qa-vdb

qa-vdb performs basic QA checks based on /var/db/pkg's contents.

Invocation

user $qa-vdb --help

Checking a package

To check a package in /var/db/pkg:

user $qa-vdb category/package-1.0.0

Repo-cd

repo-cd prints the directory of an atom and displays useful information relating to the package.

Invocation

user $repo-cd --help

Printing information

To print the information for a package, pass it as an argument:

user $repo-cd app-editors/vim

Scrub-patch

scrub-patch strips patches of any unnecessary data to reduce size and improve readability.

Invocation

user $scrub-patch --help

Scrubbing a patch

To scrub a patch, pass it in as the first argument:

user $scrub-patch fix.patch

Configuration

Portage integration

Iwdevtools provides hooks into portage via a bashrc file at /usr/share/iwdevtools/bashrc. To add these to Portage's bashrc for hooks, copy iwdevtools's bashrc:

FILE /etc/portage/bashrc
# Either symlink, copy, or source using /etc/portage/bashrc to load everything.
# Assumes not already using post_pkg_*(), adjust if needed (just an example).

if \
	. "/usr/share/iwdevtools/qa-cmp.bashrc" &&
	. "/usr/share/iwdevtools/qa-openrc.bashrc" &&
	. "/usr/share/iwdevtools/qa-sed.bashrc" &&
	. "/usr/share/iwdevtools/qa-vdb.bashrc"; then
	post_pkg_preinst() {
		qa-cmp_post_pkg_preinst
		qa-openrc_post_pkg_preinst
	}

	post_pkg_postinst() {
		qa-vdb_post_pkg_postinst
	}
fi

# vim: ts=4 ft=ebuild

See also

  • Pkgdev — a collection of tools for Gentoo development.