Gentoo Development Guide

EUTILS.ECLASS

Section: portage (5)
Updated: Nov 2017
Index Return to Main Contents
 

NAME

eutils.eclass - many extra (but common) functions that are used in ebuilds  

DESCRIPTION

The eutils eclass contains a suite of functions that complement the ones that ebuild.sh already contain. The idea is that the functions are not required in all ebuilds but enough utilize them to have a common home rather than having multiple ebuilds implementing the same thing.

Due to the nature of this eclass, some functions may have maintainers different from the overall eclass!  

FUNCTIONS

eqawarn [message]
Proxy to ewarn for package managers that don't provide eqawarn and use the PM implementation if available. Reuses PORTAGE_ELOG_CLASSES as set by the dev profile.
ecvs_clean [list of dirs]
Remove CVS directories recursiveley. Useful when a source tarball contains internal CVS directories. Defaults to $PWD.
esvn_clean [list of dirs]
Remove .svn directories recursiveley. Useful when a source tarball contains internal Subversion directories. Defaults to $PWD.
egit_clean [list of dirs]
Remove .git* directories/files recursiveley. Useful when a source tarball contains internal Git directories. Defaults to $PWD.
emktemp [temp dir]
Cheap replacement for when debianutils (and thus mktemp) does not exist on the users system.
edos2unix <file> [more files ...]
A handy replacement for dos2unix, recode, fixdos, etc... This allows you to remove all of these text utilities from DEPEND variables because this is a script based solution. Just give it a list of files to convert and they will all be changed from the DOS CRLF format to the UNIX LF format.
make_desktop_entry make_desktop_entry(<command>, [name], [icon], [type], [fields])
Make a .desktop file.

binary:   what command does the app run with ?
name:     the name that will show up in the menu
icon:     the icon to use in the menu entry
          this can be relative (to /usr/share/pixmaps) or
          a full path to an icon
type:     what kind of application is this?
          for categories:
          https://specifications.freedesktop.org/menu-spec/latest/apa.html
          if unset, function tries to guess from package's category
fields: extra fields to append to the desktop file; a printf string
validate_desktop_entries [directories]
Validate desktop entries using desktop-file-utils
make_session_desktop <title> <command> [command args...]
Make a GDM/KDM Session file. The title is the file to execute to start the Window Manager. The command is the name of the Window Manager.

You can set the name of the file via the ${wm} variable.

domenu <menus>
Install the list of .desktop menu files into the appropriate directory (/usr/share/applications).
newmenu <menu> <newname>
Like all other new* functions, install the specified menu as newname.
doicon [options] <icons>
Install icon into the icon directory /usr/share/icons or into /usr/share/pixmaps if "--size" is not set. This is useful in conjunction with creating desktop/menu files.

 options:
 -s, --size
   !!! must specify to install into /usr/share/icons/... !!!
   size of the icon, like 48 or 48x48
   supported icon sizes are:
   16 22 24 32 36 48 64 72 96 128 192 256 512 scalable
 -c, --context
   defaults to "apps"
 -t, --theme
   defaults to "hicolor"

icons: list of icons

example 1: doicon foobar.png fuqbar.svg suckbar.png
results in: insinto /usr/share/pixmaps
            doins foobar.png fuqbar.svg suckbar.png

example 2: doicon -s 48 foobar.png fuqbar.png blobbar.png
results in: insinto /usr/share/icons/hicolor/48x48/apps
            doins foobar.png fuqbar.png blobbar.png
newicon [options] <icon> <newname>
Like doicon, install the specified icon as newname.

example 1: newicon foobar.png NEWNAME.png
results in: insinto /usr/share/pixmaps
            newins foobar.png NEWNAME.png

example 2: newicon -s 48 foobar.png NEWNAME.png
results in: insinto /usr/share/icons/hicolor/48x48/apps
            newins foobar.png NEWNAME.png
strip-linguas [<allow LINGUAS>|<-i|-u> <directories of .po files>]
Make sure that LINGUAS only contains languages that a package can support. The first form allows you to specify a list of LINGUAS. The -i builds a list of po files found in all the directories and uses the intersection of the lists. The -u builds a list of po files found in all the directories and uses the union of the lists.
preserve_old_lib <libs to preserve> [more libs]
These functions are useful when a lib in your package changes ABI SONAME. An example might be from libogg.so.0 to libogg.so.1. Removing libogg.so.0 would break packages that link against it. Most people get around this by using the portage SLOT mechanism, but that is not always a relevant solution, so instead you can call this from pkg_preinst. See also the preserve_old_lib_notify function.
preserve_old_lib_notify <libs to notify> [more libs]
Spit helpful messages about the libraries preserved by preserve_old_lib.
built_with_use [--hidden] [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags>

Deprecated: Use EAPI 2 use deps in DEPEND|RDEPEND and with has_version calls.

A temporary hack until portage properly supports DEPENDing on USE flags being enabled in packages. This will check to see if the specified DEPEND atom was built with the specified list of USE flags. The --missing option controls the behavior if called on a package that does not actually support the defined USE flags (aka listed in IUSE). The default is to abort (call die). The -a and -o flags control the requirements of the USE flags. They correspond to "and" and "or" logic. So the -a flag means all listed USE flags must be enabled while the -o flag means at least one of the listed IUSE flags must be enabled. The --hidden option is really for internal use only as it means the USE flag we're checking is hidden expanded, so it won't be found in IUSE like normal USE flags.

Remember that this function isn't terribly intelligent so order of optional flags matter.

make_wrapper <wrapper> <target> [chdir] [libpaths] [installpath]
Create a shell wrapper script named wrapper in installpath (defaults to the bindir) to execute target (default of wrapper) by first optionally setting LD_LIBRARY_PATH to the colon-delimited libpaths followed by optionally changing directory to chdir.
path_exists [-a|-o] <paths>
Check if the specified paths exist. Works for all types of paths (files/dirs/etc...). The -a and -o flags control the requirements of the paths. They correspond to "and" and "or" logic. So the -a flag means all the paths must exist while the -o flag means at least one of the paths must exist. The default behavior is "and". If no paths are specified, then the return value is "false".
use_if_iuse <flag>
Return true if the given flag is in USE and IUSE.

Note that this function should not be used in the global scope.

optfeature <short description> <package atom to match> [other atoms]
Print out a message suggesting an optional package (or packages) which provide the described functionality

The following snippet would suggest app-misc/foo for optional foo support, app-misc/bar or app-misc/baz[bar] for optional bar support and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.

optfeature "foo support" app-misc/foo
optfeature "bar support" app-misc/bar app-misc/baz[bar]
optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
epause [seconds]
Sleep for the specified number of seconds (default of 5 seconds). Useful when printing a message the user should probably be reading and often used in conjunction with the ebeep function. If the EPAUSE_IGNORE env var is set, don't wait at all. Defined in EAPIs 0 1 and 2.
ebeep [number of beeps]
Issue the specified number of beeps (default of 5 beeps). Useful when printing a message the user should probably be reading and often used in conjunction with the epause function. If the EBEEP_IGNORE env var is set, don't beep at all. Defined in EAPIs 0 1 and 2.
usex <USE flag> [true output] [false output] [true suffix] [false suffix]
Proxy to declare usex for package managers or EAPIs that do not provide it and use the package manager implementation when available (i.e. EAPI >= 5). If USE flag is set, echo [true output][true suffix] (defaults to "yes"), otherwise echo [false output][false suffix] (defaults to "no").
einstalldocs
Install documentation using DOCS and HTML_DOCS.

If DOCS is declared and non-empty, all files listed in it are installed. The files must exist, otherwise the function will fail. In EAPI 4 and subsequent EAPIs DOCS may specify directories as well, in other EAPIs using directories is unsupported.

If DOCS is not declared, the files matching patterns given in the default EAPI implementation of src_install will be installed. If this is undesired, DOCS can be set to empty value to prevent any documentation from being installed.

If HTML_DOCS is declared and non-empty, all files and/or directories listed in it are installed as HTML docs (using dohtml).

Both DOCS and HTML_DOCS can either be an array or a whitespace- separated list. Whenever directories are allowed, '<directory>/.' may be specified in order to install all files within the directory without creating a sub-directory in docdir.

Passing additional options to dodoc and dohtml is not supported. If you needed such a thing, you need to call those helpers explicitly.

in_iuse <flag>
Determines whether the given flag is in IUSE. Strips IUSE default prefixes as necessary.

Note that this function should not be used in the global scope.

 

MAINTAINERS

base-system@gentoo.org
 

REPORTING BUGS

Please report bugs via http://bugs.gentoo.org/  

FILES

eutils.eclass  

SEE ALSO

ebuild(5)
https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/eutils.eclass


 

Index

NAME
DESCRIPTION
FUNCTIONS
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:25:02 GMT, November 21, 2017