Several programs can fulfill the same or similar function and be installed with the same name.
For example, the ar command is available from the
busybox, binutils and
elfutils packages.
The update-alternatives.bbclass class handles renaming the
binaries so that multiple packages can be installed without conflicts.
The ar command still works regardless of which packages are installed
or subsequently removed.
The class renames the conflicting binary in each package and symlinks the highest
priority binary during installation or removal of packages.
Four variables control this class:
ALTERNATIVE_NAME ‐ The name of the
binary that is replaced (ar in this example).
ALTERNATIVE_LINK ‐ The path to
the resulting binary (/bin/ar in this example).
ALTERNATIVE_PATH ‐ The path to the
real binary (/usr/bin/ar.binutils in this example).
ALTERNATIVE_PRIORITY ‐ The priority of
the binary.
The version with the most features should have the highest priority.
Currently, the OpenEmbedded build system supports only one binary per package.