aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Lecher <jlec@gentoo.org>2015-05-24 10:28:21 +0200
committerJustin Lecher <jlec@gentoo.org>2015-06-06 14:34:57 +0200
commit116c78640289d6d8fccea17a03536fafd7569412 (patch)
treefb0503bf8454cf0a9d2509148d28bea35712d6a0
parentsys-cluster/htcondor: Add github to remote-id in metadata.xml (diff)
downloadsci-116c78640289d6d8fccea17a03536fafd7569412.tar.gz
sci-116c78640289d6d8fccea17a03536fafd7569412.tar.bz2
sci-116c78640289d6d8fccea17a03536fafd7569412.zip
Update to latest alternative progress
Package-Manager: portage-2.2.20
-rw-r--r--app-admin/eselect/ChangeLog8
-rw-r--r--app-admin/eselect/eselect-1.4.4-r100.ebuild72
-rw-r--r--app-admin/eselect/eselect-1.4.4-r102.ebuild (renamed from app-admin/eselect/eselect-1.4.4-r101.ebuild)0
-rw-r--r--app-admin/eselect/files/eselect-1.4.2-alternatives.patch616
-rw-r--r--app-admin/eselect/files/eselect-1.4.4-alternatives.patch311
-rw-r--r--app-misc/aa/ChangeLog11
-rw-r--r--app-misc/aa/aa-0.ebuild33
-rw-r--r--app-misc/aa/metadata.xml8
-rw-r--r--app-misc/bb/ChangeLog11
-rw-r--r--app-misc/bb/bb-0.ebuild33
-rw-r--r--app-misc/bb/metadata.xml8
-rw-r--r--eclass/alternatives-2.eclass136
12 files changed, 424 insertions, 823 deletions
diff --git a/app-admin/eselect/ChangeLog b/app-admin/eselect/ChangeLog
index 47d1515ce..79d1aacfc 100644
--- a/app-admin/eselect/ChangeLog
+++ b/app-admin/eselect/ChangeLog
@@ -2,6 +2,14 @@
# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect/ChangeLog,v 1.179 2011/01/22 21:38:52 ulm Exp $
+*eselect-1.4.4-r102 (06 Jun 2015)
+
+ 06 Jun 2015; Justin Lecher <jlec@gentoo.org> +eselect-1.4.4-r102.ebuild,
+ -eselect-1.4.4-r100.ebuild, -eselect-1.4.4-r101.ebuild,
+ -files/eselect-1.4.2-alternatives.patch,
+ files/eselect-1.4.4-alternatives.patch:
+ app-admin/eselect: Add latest patch
+
*eselect-1.4.4-r101 (24 May 2015)
24 May 2015; Justin Lecher <jlec@gentoo.org> +eselect-1.4.4-r101.ebuild,
diff --git a/app-admin/eselect/eselect-1.4.4-r100.ebuild b/app-admin/eselect/eselect-1.4.4-r100.ebuild
deleted file mode 100644
index 8001cf173..000000000
--- a/app-admin/eselect/eselect-1.4.4-r100.ebuild
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-EAPI=5
-
-inherit autotools eutils bash-completion-r1
-
-DESCRIPTION="Gentoo's multi-purpose configuration and management tool"
-HOMEPAGE="http://wiki.gentoo.org/wiki/Project:Eselect"
-SRC_URI="http://dev.gentoo.org/~ulm/eselect/${P}.tar.xz"
-
-LICENSE="GPL-2+ || ( GPL-2+ CC-BY-SA-3.0 )"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="doc emacs vim-syntax"
-
-RDEPEND="sys-apps/sed
- || (
- sys-apps/coreutils
- sys-freebsd/freebsd-bin
- app-misc/realpath
- )"
-DEPEND="${RDEPEND}
- app-arch/xz-utils
- doc? ( dev-python/docutils )"
-RDEPEND="!app-admin/eselect-news
- ${RDEPEND}
- sys-apps/file
- sys-libs/ncurses"
-
-PDEPEND="emacs? ( app-emacs/eselect-mode )
- vim-syntax? ( app-vim/eselect-syntax )"
-
-src_prepare() {
- epatch "${FILESDIR}"/${PN}-1.4.2-alternatives.patch
- AT_M4DIR="." eautoreconf
-}
-
-src_compile() {
- emake
- use doc && emake html
-}
-
-src_install() {
- emake DESTDIR="${D}" install
- newbashcomp misc/${PN}.bashcomp ${PN}
- dodoc AUTHORS ChangeLog NEWS README TODO doc/*.txt
- use doc && dohtml *.html doc/*
-
- # needed by news module
- keepdir /var/lib/gentoo/news
- if ! use prefix; then
- fowners root:portage /var/lib/gentoo/news
- fperms g+w /var/lib/gentoo/news
- fi
-
- # band aid for prefix
- if use prefix; then
- cd "${ED}"/usr/share/eselect/libs || die
- sed -i "s:ALTERNATIVESDIR_ROOTLESS=\"${EPREFIX}:ALTERNATIVESDIR_ROOTLESS=\":" alternatives.bash || die
- fi
-}
-
-pkg_postinst() {
- # fowners in src_install doesn't work for the portage group:
- # merging changes the group back to root
- if ! use prefix; then
- chgrp portage "${EROOT}/var/lib/gentoo/news" \
- && chmod g+w "${EROOT}/var/lib/gentoo/news"
- fi
-}
diff --git a/app-admin/eselect/eselect-1.4.4-r101.ebuild b/app-admin/eselect/eselect-1.4.4-r102.ebuild
index 67b835c52..67b835c52 100644
--- a/app-admin/eselect/eselect-1.4.4-r101.ebuild
+++ b/app-admin/eselect/eselect-1.4.4-r102.ebuild
diff --git a/app-admin/eselect/files/eselect-1.4.2-alternatives.patch b/app-admin/eselect/files/eselect-1.4.2-alternatives.patch
deleted file mode 100644
index 3f4a34bcf..000000000
--- a/app-admin/eselect/files/eselect-1.4.2-alternatives.patch
+++ /dev/null
@@ -1,616 +0,0 @@
-Index: bin/eselect.in
-===================================================================
---- bin/eselect.in (revision 863)
-+++ bin/eselect.in (working copy)
-@@ -22,10 +22,15 @@
- # Where are modules installed by default?
- ESELECT_DEFAULT_MODULES_PATH="${ESELECT_DATA_PATH}/modules"
-
-+# Where are auto-generated modules placed? (e.g. from alternatives-2.eclass)
-+ESELECT_AUTO_GENERATED_MODULES_PATH="${ESELECT_DEFAULT_MODULES_PATH}/auto"
-+
- # Look in these places for modules
--ESELECT_MODULES_PATH=( \
-- "${HOME}/.eselect/modules" \
-- "${ESELECT_DEFAULT_MODULES_PATH}" )
-+ESELECT_MODULES_PATH=(
-+ "${HOME}/.eselect/modules"
-+ "${ESELECT_DEFAULT_MODULES_PATH}"
-+ "${ESELECT_AUTO_GENERATED_MODULES_PATH}"
-+)
-
- # Look in this place for libraries
- ESELECT_CORE_PATH="${ESELECT_DATA_PATH}/libs"
---- bin/Makefile.am.orig 2013-09-02 14:35:05.328684465 +0400
-+++ bin/Makefile.am 2013-09-02 14:49:50.895842067 +0400
-@@ -4,6 +4,7 @@
- dosed = @SED@ -e 's%\@BASH\@%$(BASH)%g' \
- -e 's%\@DATADIR\@%$(datadir)%g' \
- -e 's%\@EPREFIX\@%$(EPREFIX)%g' \
-+ -e 's%\@LIBEXECDIR\@%$(datadir)%g' \
- -e 's%\@VERSION\@%$(VERSION)$(EXTRAVERSION)%g'
-
- % : %.in
-Index: libs/Makefile.am
-===================================================================
---- libs/Makefile.am (revision 863)
-+++ libs/Makefile.am (working copy)
-@@ -1,6 +1,7 @@
- eselectlibsdir = $(datadir)/$(PACKAGE_NAME)/libs/
-
- eselectlibs_DATA = \
-+ alternatives.bash \
- config.bash \
- core.bash \
- default.eselect \
-@@ -14,6 +15,7 @@
- tests.bash
-
- EXTRA_DIST = \
-+ alternatives.bash.in \
- config.bash.in \
- core.bash.in \
- default.eselect.in \
-@@ -30,7 +32,8 @@
- -e 's%\@SED\@%@SED@%g' \
- -e 's%\@PORTAGEQ\@%@PORTAGEQ@%g' \
- -e 's%\@ENV_UPDATE\@%@ENV_UPDATE@%g' \
-- -e 's%\@CANONICALISE\@%@CANONICALISE@%g'
-+ -e 's%\@CANONICALISE\@%@CANONICALISE@%g' \
-+ -e 's%\@sysconfdir\@%@sysconfdir@%g'
-
- %.bash : %.bash.in
- @$(dosed) $< > $@
---- libs/alternatives.bash.in.orig 1970-01-01 01:00:00.000000000 +0100
-+++ libs/alternatives.bash.in 2011-09-06 18:55:43.000000000 +0100
-@@ -0,0 +1,550 @@
-+# Copyright 2008 Mike Kelly
-+# Copyright 2009 David Leverton
-+# Copyright 2010 Bo Ørsted Andresen
-+# 2010: Adapted to eselect Sebastien Fabbro (who doesn't like copyrights)
-+# Distributed under the terms of the GNU General Public License v2
-+
-+inherit config output path-manipulation
-+
-+ALTERNATIVESDIR_ROOTLESS="@sysconfdir@/env.d/alternatives"
-+ALTERNATIVESDIR="${EROOT}${ALTERNATIVESDIR_ROOTLESS}"
-+
-+get_current_provider() {
-+ local dieprefix="Could not determine current provider for ${ALTERNATIVE}"
-+ if [[ -L ${ALTERNATIVESDIR}/${ALTERNATIVE}/_current ]]; then
-+ local provider=$(readlink "${ALTERNATIVESDIR}/${ALTERNATIVE}/_current" || die "${dieprefix}: readlink ${symlink} failed")
-+ [[ ${provider} == */* ]] && die "${dieprefix}: malformed target for ${symlink}"
-+
-+ if [[ -L ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider} ||
-+ ( -e ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider} && ! -d ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider} ) ]]; then
-+ die "${dieprefix}: ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider} is not a directory"
-+ fi
-+
-+ echo "${provider}"
-+
-+ elif [[ -e ${ALTERNATIVESDIR}/${ALTERNATIVE}/_current ]]; then
-+ die "${dieprefix}: ${ALTERNATIVESDIR}/${ALTERNATIVE}/_current is not a symlink"
-+ fi
-+}
-+
-+compare_importance() {
-+ local IFS=.
-+ local a=( ${1} ) b=( ${2} )
-+ local -i i=0
-+ while (( i<${#a[@]} && i<${#b[@]} )); do
-+ if (( a[i]<b[i] )); then
-+ return 0
-+ elif (( a[i]>b[i] )); then
-+ return 1
-+ fi
-+ i+=1
-+ done
-+ (( i<${#b[@]} ))
-+}
-+
-+sort_providers() {
-+ local begin=${1:-0}
-+ local count=${2:-${#providers[@]}}
-+ [[ ${count} -le 1 ]] && return 0
-+ sort_providers ${begin} $((count/2))
-+ sort_providers $((begin+count/2)) $((count-count/2))
-+ local left=( "${providers[@]:begin:count/2}" )
-+ local right=( "${providers[@]:begin+count/2:count-count/2}" )
-+ local -i x i=0 j=0
-+ for (( x=begin; x<begin+count; ++x )); do
-+ if (( j>=${#right[@]} )) || { (( i<${#left[@]} )) && compare_importance "${left[i]%%:*}" "${right[j]%%:*}"; }; then
-+ providers[x]=${left[i++]}
-+ else
-+ providers[x]=${right[j++]}
-+ fi
-+ done
-+}
-+
-+get_providers() {
-+ local p= importance providers=()
-+ for p in "${ALTERNATIVESDIR}/${ALTERNATIVE}"/* ; do
-+ [[ -d ${p} && ! -L ${p} ]] || continue
-+ p=${p##*/}
-+
-+ importance=$(< "${ALTERNATIVESDIR}/${ALTERNATIVE}/${p}/_importance")
-+ importance=${importance:-0}
-+ [[ "${importance}" =~ ^[0123456789]+(\.[0123456789]+)*$ ]] || die "_importance (${importance}) for ${p} is not a dot-separated list of integers"
-+
-+ providers+=( "${importance}:${p}" )
-+ done
-+
-+ sort_providers
-+ for (( p=${#providers[@]}-1 ; p>=0 ; --p )); do
-+ echo "${providers[p]#*:}"
-+ done
-+}
-+
-+### show action ###
-+describe_show() {
-+ echo "Show the current provider in use for ${ALTERNATIVE}"
-+}
-+
-+do_show() {
-+ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
-+ local current="$(get_current_provider)"
-+ if [[ -z "${current}" ]] ; then
-+ echo "(none)"
-+ return 2
-+ fi
-+ echo "${current}"
-+}
-+
-+options_show() {
-+ :
-+}
-+
-+### list action ###
-+describe_list() {
-+ echo "Lists all available providers for ${ALTERNATIVE}"
-+}
-+
-+do_list() {
-+ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
-+ local n cur= providers=( $(get_providers) )
-+ write_list_start "Available providers for ${ALTERNATIVE}:"
-+
-+ cur="$(get_current_provider)"
-+
-+ if [[ -n "${providers[@]}" ]] ; then
-+ for (( n = 0 ; n < ${#providers[@]} ; ++n )) ; do
-+ [[ ${cur} == "${providers[${n}]}" ]] && \
-+ providers[${n}]="${providers[${n}]} $(highlight '*')"
-+ done
-+ write_numbered_list "${providers[@]}"
-+ else
-+ write_kv_list_entry "(none found)" ""
-+ fi
-+}
-+
-+options_list() {
-+ :
-+}
-+
-+### files action ###
-+describe_files() {
-+ echo "Lists symlinks provided by the currently selected provider"
-+}
-+
-+do_files() {
-+ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
-+
-+ local cur="$(get_current_provider)" p=
-+ [[ -n "${cur}" ]] || die -q "No selected provider, hence no symlinks provided"
-+ local dieprefix="Could not list symlinks provided for ${ALTERNATIVE}"
-+
-+ local errors symlink rootsymlink
-+ while read -r -d '' symlink; do
-+ rootsymlink="${EROOT}${symlink}"
-+ rootsymlink=${rootsymlink//+(\/)/\/}
-+ echo "${rootsymlink}"
-+ if [[ -L ${rootsymlink} ]]; then
-+ if [[ ! -e ${rootsymlink} ]]; then
-+ write_error_msg "${rootsymlink} is dangling symlink"
-+ errors=yes
-+ fi
-+ elif [[ -d ${rootsymlink} ]]; then
-+ write_error_msg "${rootsymlink} is a directory"
-+ errors=yes
-+ elif [[ -e ${rootsymlink} ]]; then
-+ write_error_msg "${rootsymlink} exists but is not a symlink"
-+ errors=yes
-+ else
-+ write_error_msg "${rootsymlink} does not exist"
-+ errors=yes
-+ fi
-+ done <"${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list"
-+}
-+
-+options_files() {
-+ :
-+}
-+
-+### set action ###
-+
-+describe_set() {
-+ echo "Sets a provider for ${ALTERNATIVE}"
-+}
-+
-+describe_set_parameters() {
-+ echo "[ --force ] <provider>"
-+}
-+
-+describe_set_options() {
-+ echo "--force : overwrite or remove existing non-symlink files (but not directories) if necessary"
-+ echo "<provider> : the name of the provider to use or the index of the provider preceeded by a dash"
-+}
-+
-+do_set() {
-+ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
-+
-+ local force provider providers
-+ if [[ ${1} == --force ]]; then
-+ force=yes
-+ shift
-+ fi
-+
-+ if [[ ${1} == -+([[:digit:]]) ]]; then
-+ providers=( $(get_providers) )
-+ (( ${1#-} <= ${#providers[@]} )) || die -q "The given provider with index (${1#-}) does not exist"
-+ provider=${providers[${1#-}-1]}
-+ else
-+ provider="${1}"
-+ fi
-+ [[ -z "${provider}" ]] && die -q "Missing required parameter 'provider'"
-+ local dieprefix="Could not set provider ${provider} for alternative ${ALTERNATIVE}"
-+
-+ if [[ ! -d ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider} ]] ; then
-+ if is_number ${provider} ; then
-+ providers=( $(get_providers) )
-+ [[ -n ${providers[${1#-}-1]} ]] &&
-+ die -q "The given provider (${provider}) does not exist, did you mean -${provider} (${providers[${1#-}-1]})?"
-+ fi
-+ die -q "The given provider (${provider}) does not exist"
-+ fi
-+
-+ local symlink newsymlinks=() oldsymlinks=()
-+
-+ while read -r -d '' symlink; do
-+ local nicesymlink=${symlink#.}
-+ nicesymlink=${nicesymlink//+(\/)/\/}
-+ [[ ${nicesymlink} == /* ]] || die "${dieprefix}: bad symlink ${symlink}?"
-+ [[ ${nicesymlink} == */ ]] && die "${dieprefix}: bad symlink ${symlink}?"
-+
-+ newsymlinks+=( "${nicesymlink}" )
-+ done < <(
-+ cd "${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider}" || die "${dieprefix}: cd failed"
-+ find . -type l -print0 | LC_ALL=C sort -r -u -z)
-+ [[ ${#newsymlinks[@]} -gt 0 ]] || die "${dieprefix}: does not provide any symlinks?"
-+
-+ if [[ -f ${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list ]]; then
-+ while read -r -d '' symlink; do
-+ local nicesymlink=${symlink//+(\/)/\/}
-+ [[ ${nicesymlink} == /* ]] || die "${dieprefix}: old provider ${oldcur} provides bad symlink ${symlink}?"
-+ [[ ${nicesymlink} == */ ]] && die "${dieprefix}: old provider ${oldcur} provides bad symlink ${symlink}?"
-+
-+ oldsymlinks+=( "${nicesymlink}" )
-+ done < <(LC_ALL=C sort -r -u -z "${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list")
-+ [[ ${#oldsymlinks[@]} -gt 0 ]] || die "${dieprefix}: old provider ${oldcur} does not provide any symlinks?"
-+
-+ elif [[ -L ${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list || -e ${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list ]]; then
-+ die "${dieprefix}: ${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list is not a file"
-+ fi
-+
-+ local pass errors=
-+ for pass in check perform; do
-+ local -i new_i=0 old_i=0
-+ while [[ -n ${newsymlinks[new_i]} || -n ${oldsymlinks[old_i]} ]]; do
-+
-+ if ( LC_ALL=C; [[ ${newsymlinks[new_i]} < ${oldsymlinks[old_i]} ]] ); then
-+ if [[ ${pass} == check ]]; then
-+ if [[ -L ${EROOT}${oldsymlinks[old_i]} ]]; then
-+ :
-+ elif [[ -d ${EROOT}${oldsymlinks[old_i]} ]]; then
-+ write_error_msg "Can't remove ${EROOT}${oldsymlinks[old_i]}: is a directory${force:+ which is a fatal error that cannot be ignored by --force}"
-+ errors=yes
-+ elif [[ -e ${EROOT}${oldsymlinks[old_i]} ]]; then
-+ if [[ -n ${force} ]]; then
-+ write_warning_msg "Removing ${EROOT}${oldsymlinks[old_i]} due to --force: is not a symlink"
-+ else
-+ write_error_msg "Refusing to remove ${EROOT}${oldsymlinks[old_i]}: is not a symlink (use --force to override)"
-+ errors=yes
-+ fi
-+ fi
-+
-+ elif [[ ${pass} == perform ]]; then
-+ rm -f "${ROOT}${oldsymlinks[old_i]}" || die "${dieprefix}: rm failed"
-+ else
-+ die "${dieprefix}: unknown \${pass} ${pass}???"
-+ fi
-+
-+ old_i+=1
-+
-+ else
-+ local target=${ALTERNATIVESDIR_ROOTLESS#/}/${ALTERNATIVE}/_current${newsymlinks[new_i]} dir=${newsymlinks[new_i]%/*}
-+ while [[ -n ${dir} ]]; do
-+ target=../${target}
-+ dir=${dir%/*}
-+ done
-+
-+ if [[ ${pass} == check ]]; then
-+ if [[ -L ${EROOT}${newsymlinks[new_i]} ]]; then
-+ :
-+ elif [[ -d ${EROOT}${newsymlinks[new_i]} ]]; then
-+ write_error_msg "Can't overwrite ${EROOT}${newsymlinks[new_i]}: is a directory${force:+ which is a fatal error that cannot be ignored by --force}"
-+ errors=yes
-+ elif [[ -e ${EROOT}${newsymlinks[new_i]} ]]; then
-+ if [[ -n ${force} ]]; then
-+ write_warning_msg "Overwriting ${EROOT}${newsymlinks[new_i]} due to --force: is not a symlink"
-+ else
-+ write_error_msg "Refusing to overwrite ${EROOT}${newsymlinks[new_i]}: is not a symlink (use --force to override)"
-+ errors=yes
-+ fi
-+ fi
-+
-+ elif [[ ${pass} == perform ]]; then
-+ mkdir -p "${EROOT}${newsymlinks[new_i]%/*}" || die "${dieprefix}: mkdir -p failed"
-+ ln -snf "${target#/}" "${EROOT}${newsymlinks[new_i]}" || die "${dieprefix}: ln -snf failed"
-+ else
-+ die "${dieprefix}: unknown \${pass} ${pass}???"
-+ fi
-+
-+ [[ ${newsymlinks[new_i]} == ${oldsymlinks[old_i]} ]] && old_i+=1
-+ new_i+=1
-+ fi
-+ done
-+
-+ [[ -n ${errors} ]] && die "${dieprefix}: see previous errors"
-+ done
-+
-+ local oldcur="$(get_current_provider)"
-+ ln -snf "${provider}" "${ALTERNATIVESDIR}/${ALTERNATIVE}/_current" || die "${dieprefix}: ln -snf failed"
-+
-+ : >"${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list" || die "${dieprefix}: emptying/creating _current_list failed"
-+ for symlink in "${newsymlinks[@]}"; do
-+ echo -n -e "${symlink}\\0" >>"${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list" || die "${dieprefix}: appending ${symlink} to _current_list failed"
-+ done
-+ return 0
-+}
-+
-+_options_parameters() {
-+ [[ -n ${2} && ${2} != --descriptions ]] && die -q "Unrecognised option ${2}"
-+ local describe_func=describe_${1#options_}_options descriptions=${2} opt options oldifs=$IFS
-+ if is_function ${describe_func}; then
-+ IFS=$'\n'
-+ options=( $(${describe_func}) )
-+ IFS=$oldifs
-+ for opt in "${options[@]}"; do
-+ [[ ${opt} == --* ]] || continue
-+ if [[ -n ${descriptions} ]]; then
-+ echo "${opt/ : /:}"
-+ else
-+ echo "${opt%% : *}"
-+ fi
-+ done
-+ fi
-+}
-+
-+options_set() {
-+ _options_parameters $FUNCNAME "$@"
-+ get_providers
-+}
-+
-+### update action ###
-+
-+describe_update() {
-+ echo "Set a default provider if no valid one currently exists"
-+}
-+
-+describe_update_parameters() {
-+ echo "[--ignore] <provider>"
-+}
-+
-+describe_update_options() {
-+ echo "--ignore : update to any valid provider EXCEPT the specified provider"
-+ echo "<provider> : the name of the provider to use"
-+}
-+
-+do_update() {
-+ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
-+
-+ local p cur=$(get_current_provider) providers=( $(get_providers) ) ignore
-+ if [[ "--ignore" == ${1} ]] ; then
-+ # Try everything except setting the provider to the given
-+ # one. So, if it isn't the given one, we end up doing
-+ # nothing. Bug #128
-+ shift
-+ ignore=${1}
-+ fi
-+
-+ if [[ ${cur} == ${1} && -z ${ignore} ]]; then
-+ # if current provider was just updated, reselect it since it could have changed
-+ do_set "${cur}" && return 0
-+ elif [[ -n ${cur} && ${cur} != ${ignore} ]] ; then
-+ # verify existing provider's symlinks
-+ local p= bad=0
-+ while read -r -d '' p ; do
-+ [[ -L "${EROOT}${p}" && -e "${EROOT}${p}" ]] || (( bad++ ))
-+ done < "${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list"
-+
-+ [[ "${bad}" -eq 0 ]] && return 0
-+ # fix existing provider if possible
-+ has "${cur}" "${providers[@]}" && do_set "${cur}" && return 0
-+ elif has "${1}" "${providers[@]}" && [[ -z ${ignore} ]] ; then
-+ # switch to new provider if none was set before or it can't be fixed
-+ do_set "${1}" && return 0
-+ fi
-+
-+ # if no valid provider has been selected switch to first available, valid
-+ # provider, sorted according to importance
-+ for p in "${providers[@]}"; do
-+ [[ ${ignore} != ${p} ]] && do_set "${p}" && return 0
-+ done
-+
-+ # if a provider is set but no providers are available anymore cleanup
-+ cur=$(get_current_provider)
-+ if [[ -n ${cur} ]]; then
-+ do_unset "${cur}" && return 2
-+ fi
-+ # if no provider is set and none are available that are not ignored, return 2 for cleanup
-+ [[ -z ${providers[@]} || ${providers[@]} == ${ignore} ]] && return 2
-+
-+ # we tried everything to select a valid provider, but failed
-+ return 1
-+}
-+
-+options_update() {
-+ _options_parameters $FUNCNAME "$@"
-+ get_providers
-+}
-+
-+### unset action ###
-+
-+describe_unset() {
-+ echo "Unset any symlinks created for the current provider for ${ALTERNATIVE}."
-+}
-+
-+describe_unset_parameters() {
-+ echo "[ --force ]"
-+}
-+
-+describe_unset_options() {
-+ echo "--force : remove existing non-symlink files (but not directories) if necessary"
-+}
-+
-+do_unset() {
-+ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
-+
-+ local force=
-+ if [[ ${1} == --force ]]; then
-+ force=yes
-+ shift
-+ fi
-+
-+ local cur="$(get_current_provider)" p=
-+ [[ -n "${cur}" ]] || die -q "Nothing to unset"
-+ local dieprefix="Could not unset provider for ${ALTERNATIVE}"
-+
-+ local one=false symlink pass errors=
-+ for pass in check perform; do
-+ while read -r -d '' symlink; do
-+ one=true
-+ if [[ ${pass} == check ]]; then
-+ if [[ -L ${EROOT}${symlink} ]]; then
-+ :
-+ elif [[ -d ${EROOT}${symlink} ]]; then
-+ write_error_msg "Can't remove ${EROOT}${symlink}: is a directory${force:+ which is a fatal error that cannot be ignored by --force}"
-+ errors=yes
-+ elif [[ -e ${EROOT}${symlink} ]]; then
-+ if [[ -n ${force} ]]; then
-+ write_warning_msg "Removing ${EROOT}${symlink} due to --force: is not a symlink"
-+ else
-+ write_error_msg "Refusing to remove ${EROOT}${symlink}: is not a symlink (use --force to override)"
-+ errors=yes
-+ fi
-+ fi
-+
-+ elif [[ ${pass} == perform ]]; then
-+ rm -f "${EROOT}${symlink}" || die "${dieprefix}: rm failed"
-+ else
-+ die "${dieprefix}: unknown \${pass} ${pass}???"
-+ fi
-+ done <"${ALTERNATIVESDIR}/${ALTERNATIVE}/_current_list"
-+
-+ [[ -n ${errors} ]] && die "${dieprefix}: see previous errors"
-+ done
-+
-+ ${one} || die "${dieprefix}: does not provide any symlinks?"
-+
-+ rm "${ALTERNATIVESDIR}/${ALTERNATIVE}"/{_current,_current_list} || die "${dieprefix}: rm failed"
-+}
-+
-+options_unset() {
-+ _options_parameters $FUNCNAME "$@"
-+ get_current_provider
-+}
-+
-+### script action ###
-+
-+describe_script() {
-+ echo "Output an evalable script fragment to set PATH, LD_LIBRARY_PATH and MANPATH to use the specified provider"
-+}
-+
-+describe_script_parameters() {
-+ echo "[--sh | --csh] [<provider>]"
-+}
-+
-+describe_script_options() {
-+ echo "--sh : use Bourne shell syntax (default)"
-+ echo "--csh : use C shell syntax"
-+ echo "<provider> : the provider to use or the index of the provider preceeded by a dash (if not specified, use the system default)"
-+}
-+
-+do_script() {
-+ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
-+ local syntax=sh provider providers
-+ if [[ ${1} == --sh ]]; then
-+ shift
-+ elif [[ ${1} == --csh ]]; then
-+ syntax=csh
-+ shift
-+ fi
-+
-+ if [[ ${1} == -+([[:digit:]]) ]]; then
-+ providers=( $(get_providers) )
-+ (( ${1#-} <= ${#providers[@]} )) || die -q "The given provider with index (${1#-}) does not exist"
-+ provider=${providers[${1#-}-1]}
-+ else
-+ provider="${1}"
-+ fi
-+ [[ -z "${provider}" ]] && die -q "Missing required parameter 'provider'"
-+
-+ if [[ ! -d ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider} ]] ; then
-+ if is_number ${provider} ; then
-+ providers=( $(get_providers) )
-+ [[ -n ${providers[${1#-}-1]} ]] &&
-+ die -q "The given provider (${provider}) does not exist, did you mean -${provider} (${providers[${1#-}-1]})?"
-+ fi
-+ die -q "The given provider (${provider}) does not exist"
-+ fi
-+
-+ local variables=( PATH LD_LIBRARY_PATH MANPATH )
-+ [[ -n ${!default_*} ]] && local ${!default_*}
-+ local default_LD_LIBRARY_PATH=$(grep '^[^#]' "${EROOT}"/etc/ld.so.conf | tr '\n' ':')/lib:/usr/lib
-+ local default_MANPATH=$(MANPATH= man -C"${EROOT}"/etc/man.conf -w)
-+
-+ local var IFS=:
-+ for var in "${variables[@]}"; do
-+ local defvar=default_${var} path paths=( )
-+ for path in ${!var}; do
-+ [[ ${path} == ${ALTERNATIVESDIR_ROOTLESS}/${ALTERNATIVE}/* ]] && continue
-+ [[ -n ${provider} && -d ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider}/${path#/} ]] && paths+=( "${ALTERNATIVESDIR_ROOTLESS}/${ALTERNATIVE}/${provider}/${path#/}" )
-+ paths+=( "${path}" )
-+ done
-+
-+ [[ -n ${provider} ]] && for path in ${!defvar}; do
-+ [[ -d ${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider}/${path#/} ]] && paths+=( "${ALTERNATIVESDIR_ROOTLESS}/${ALTERNATIVE}/${provider}/${path#/}" )
-+ done
-+
-+ local newval=${paths[*]}
-+ if [[ ${newval} != ${!var} ]]; then
-+ newval=${newval//\'/\'\\\'\'}
-+ if [[ ${syntax} == sh ]]; then
-+ echo "${var}='${newval}'; export ${var}"
-+ else
-+ echo "setenv ${var} '${newval}'"
-+ fi
-+ fi
-+ done
-+}
-+
-+options_script() {
-+ _options_parameters $FUNCNAME "$@"
-+ get_providers
-+}
-+
-+# vim: set ft=eselect sw=4 sts=4 ts=4 et tw=80 :
diff --git a/app-admin/eselect/files/eselect-1.4.4-alternatives.patch b/app-admin/eselect/files/eselect-1.4.4-alternatives.patch
index 71c2e67da..b2b943274 100644
--- a/app-admin/eselect/files/eselect-1.4.4-alternatives.patch
+++ b/app-admin/eselect/files/eselect-1.4.4-alternatives.patch
@@ -226,10 +226,10 @@ index 027ef73..a5fe373 100644
@$(dosed) $< > $@
diff --git a/libs/alternatives-common.bash.in b/libs/alternatives-common.bash.in
new file mode 100644
-index 0000000..99de48e
+index 0000000..64d74df
--- /dev/null
+++ b/libs/alternatives-common.bash.in
-@@ -0,0 +1,372 @@
+@@ -0,0 +1,488 @@
+# Copyright 2015 Gentoo Foundation
+# Copyright 2008 Mike Kelly
+# Copyright 2009, 2013 David Leverton
@@ -238,7 +238,7 @@ index 0000000..99de48e
+
+inherit config output path-manipulation
+
-+ALTERNATIVESDIR_ROOTLESS="@sysconfdir@/env.d/alternatives"
++: "${ALTERNATIVESDIR_ROOTLESS:=@sysconfdir@/env.d/alternatives}"
+ALTERNATIVESDIR="${EROOT%/}${ALTERNATIVESDIR_ROOTLESS}"
+
+get_current_provider() {
@@ -298,7 +298,8 @@ index 0000000..99de48e
+ [[ -d ${p} && ! -L ${p} ]] || continue
+ p=${p##*/}
+
-+ importance=$(< "${ALTERNATIVESDIR}/${ALTERNATIVE}/${p}/_importance")
++ [[ -e "${ALTERNATIVESDIR}/${ALTERNATIVE}/${p}/_importance" ]] &&
++ importance=$(< "${ALTERNATIVESDIR}/${ALTERNATIVE}/${p}/_importance")
+ importance=${importance:-0}
+ [[ "${importance}" =~ ^[0123456789]+(\.[0123456789]+)*$ ]] || die "_importance (${importance}) for ${p} is not a dot-separated list of integers"
+
@@ -466,6 +467,117 @@ index 0000000..99de48e
+ return 0
+}
+
++### add action ###
++alternatives_describe_add() {
++ echo "Add provider to selected alternative"
++}
++
++alternatives_describe_add_parameters() {
++ echo "<provider> <importance> <source> <target> [<source> <target> [...]]"
++}
++
++alternatives_describe_add_options() {
++ echo "<provider> : the name of the alternative provider"
++ echo "<importance> : interger value, representing the importance of the provider"
++ echo "<source> : source of the symlink"
++ echo "<target> : destination for the symlink"
++}
++
++alternatives_do_add() {
++ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
++
++ (( $# >= 4 )) && (( ($#-2)%2 == 0)) || \
++ die "exactly 3+N*2 arguments where N>=1 required"
++ local provider=${1}
++ local importance=${2}
++ shift 2
++ local index src target ret=0
++ local provider_dir="${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider}"
++
++ # Creating base dir
++ if [[ ! -e "${provider_dir}" ]]; then
++ mkdir -p "${provider_dir}" || die "Failed to create ${provider_dir}"
++ elif [[ ! -d "${provider_dir}" ]]; then
++ die "${provider_dir} exists but is a file"
++ else
++ die "${provider_dir} already present. You need ot remove it before adding it again"
++ fi
++
++ # Make sure importance is a signed integer
++ if [[ -n ${importance} ]] && ! [[ ${importance} =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
++ die "Invalid importance (${importance}) detected"
++ else
++ # Setting importance
++ echo ${importance} > "${provider_dir}/_importance"
++ fi
++
++ # Process source-target pairs
++ while (( $# >= 2 )); do
++ src=${1//+(\/)/\/}; target=${2//+(\/)/\/}
++ if [[ ${src} != /* ]]; then
++ die "Source path must be absolute, but got ${src}"
++ else
++ local reltarget= dir=${provider_dir}${src%/*}
++ while [[ -n ${dir} ]]; do
++ reltarget+=../
++ dir=${dir%/*}
++ done
++
++ reltarget=${reltarget%/}
++ [[ ${target} == /* ]] || reltarget+=${src%/*}/
++ reltarget+=${target}
++ mkdir -p "${provider_dir}${src%/*}" || die "Failed to create ${provider_dir}${src%/*}"
++ ln -sf "${reltarget}" "${provider_dir}${src}" || die "Failed to create symlink"
++ # The -e test will fail if existing symlink points to non-existing target,
++ # so check for -L also.
++ # Say ${ED}/sbin/init exists and links to /bin/systemd (which doesn't exist yet).
++# if [[ -e ${ED}${src} || -L ${ED}${src} ]]; then
++# local fulltarget=${target}
++# [[ ${fulltarget} != /* ]] && fulltarget=${src%/*}/${fulltarget}
++# if [[ -e ${ED}${fulltarget} || -L ${ED}${fulltarget} ]]; then
++# die "${src} defined as provider for ${fulltarget}, but both already exist in \${ED}"
++# else
++# mv "${ED}${src}" "${ED}${fulltarget}" || die
++# fi
++# fi
++ fi
++ shift 2
++ done
++}
++
++alternatives_options_add() {
++ _options_parameters ${FUNCNAME#alternatives_} "$@"
++}
++
++### remove action ###
++
++alternatives_describe_remove() {
++ echo "Remove a provider for selected alternative"
++}
++
++alternatives_describe_remove_parameters() {
++ echo "<provider>"
++}
++
++alternatives_describe_remove_options() {
++ echo "<provider> : the name of the alternative provider to be removed"
++}
++
++alternatives_do_remove() {
++ [[ -z "${ALTERNATIVE}" ]] && die "Need to set ALTERNATIVE in the eselect module"
++
++ if [[ -d "${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider}" ]]; then
++ rm -r "${ALTERNATIVESDIR}/${ALTERNATIVE}/${provider}" || \
++ die "Failed to remove '${provider}' for '${ALTERNATIVE}'"
++ else
++ einfo "'${provider}' is not a provider for '${ALTERNATIVE}'"
++ fi
++}
++
++alternatives_options_remove() {
++ _options_parameters ${FUNCNAME#alternatives_} "$@"
++}
++
+### update action ###
+
+# available in both "eselect alternatives" and individual modules
@@ -502,6 +614,10 @@ index 0000000..99de48e
+ [[ -n ${best} && -n ${1} && -z ${ignore} ]] && die -q "Cannot specify both --best and a provider"
+
+ if [[ -n ${best} ]] ; then
++ # set best provider
++ : # fall through to "switch to first available" loop below
++ elif [[ $# == "0" ]] && [[ -z ${cur} ]]; then
++ # if nothing is specified
+ : # fall through to "switch to first available" loop below
+ elif [[ ${cur} == ${1} && -z ${ignore} ]]; then
+ # if current provider was just updated, reselect it since it could have changed
@@ -541,13 +657,13 @@ index 0000000..99de48e
+
+alternatives_options_update() {
+ _options_parameters ${FUNCNAME#alternatives_} "$@"
-+ if [[ -n ${ALTERNATIVE} ]]; then
-+ get_providers
-+ else
-+ for alt in ${ALTERNATIVESDIR_ROOTLESS}/_*/*/_importance; do
-+ echo ${alt} | cut -d/ -f5
-+ done | sort -u
-+ fi
++ if [[ -n ${ALTERNATIVE} ]]; then
++ get_providers
++ else
++ for alt in ${ALTERNATIVESDIR_ROOTLESS}/_*/*/_importance; do
++ echo ${alt} | cut -d/ -f5
++ done | sort -u
++ fi
+}
+
+### unset action stub ###
@@ -604,10 +720,10 @@ index 0000000..99de48e
+# vim: set ft=eselect sw=4 sts=4 ts=4 et tw=80 :
diff --git a/libs/alternatives.bash.in b/libs/alternatives.bash.in
new file mode 100644
-index 0000000..c2512e1
+index 0000000..1b5a2b0
--- /dev/null
+++ b/libs/alternatives.bash.in
-@@ -0,0 +1,249 @@
+@@ -0,0 +1,293 @@
+# Copyright 2015 Gentoo Foundation
+# Copyright 2008 Mike Kelly
+# Copyright 2009, 2013 David Leverton
@@ -726,6 +842,50 @@ index 0000000..c2512e1
+ get_providers
+}
+
++### add action ###
++
++describe_add() {
++ alternatives_describe_add
++}
++
++describe_add_parameters() {
++ alternatives_describe_add_parameters
++}
++
++describe_add_options() {
++ alternatives_describe_add_options
++}
++
++do_add() {
++ alternatives_do_add
++
++ # make sure we have something selected
++ eselect ${provider} show > /dev/null || eselect ${provider} update --best
++}
++
++### remove action ###
++
++describe_remove() {
++ alternatives_describe_remove
++}
++
++describe_remove_parameters() {
++ alternatives_describe_remove_parameters
++}
++
++describe_remove_options() {
++ alternatives_describe_remove_options
++}
++
++do_remove() {
++ alternatives_do_remove
++
++# if no provider is present, remove whole Alternative
++ if ! eselect ${provider} update --best > /dev/null; then
++ eselect alternatives remove ${ALTERNATIVE}
++ fi
++}
++
+### update action ###
+
+# all functions implemented in alternatives-common.bash as defined for
@@ -803,7 +963,7 @@ index 0000000..c2512e1
+
+ local idx=${!}
+ if [[ ${idx} == +(-|+|[[:digit:]]) ]]; then
-+ idx=${1#+(-|+)}
++ idx=${1#+(-|+)}
+ providers=( $(get_providers) )
+ (( ${idx} <= ${#providers[@]} )) || die -q "The given provider with index (${idx}) does not exist"
+ provider=${providers[${idx}-1]}
@@ -871,10 +1031,10 @@ index 73960c4..4da6465 100644
env.eselect \
diff --git a/modules/alternatives.eselect b/modules/alternatives.eselect
new file mode 100644
-index 0000000..b1c219f
+index 0000000..912bb3d
--- /dev/null
+++ b/modules/alternatives.eselect
-@@ -0,0 +1,50 @@
+@@ -0,0 +1,165 @@
+# Copyright 2015 Gentoo Foundation
+# Copyright 2008 Mike Kelly
+# Copyright 2009, 2013 David Leverton
@@ -896,11 +1056,11 @@ index 0000000..b1c219f
+ ENDOFTEXT
+}
+
-+### update action ###
-+
+# all functions implemented in alternatives-common.bash as defined for
+# both "eselect alternatives" and individual modules
+
++### update action ###
++
+describe_update() {
+ alternatives_describe_update
+}
@@ -925,6 +1085,121 @@ index 0000000..b1c219f
+ alternatives_options_update
+}
+
++### create action ###
++
++describe_create() {
++ echo "Create a new alternative"
++}
++
++describe_create_parameters() {
++ echo "<alternative>"
++}
++
++describe_create_options() {
++ echo "<alternative> : the name of the alternative to create"
++}
++
++do_create() {
++ [[ $# == 1 ]] || die "Need exactly one alternative name"
++
++ local auto_dir="${ESELECT_AUTO_GENERATED_MODULES_PATH}"
++ local auto_file="${auto_dir}/${1}.eselect"
++
++ if [[ ! -e "${auto_file}" ]]; then
++ if [[ ! -e "${auto_dir}" ]]; then
++ mkdir -p "${auto_dir}" || die "Failed to create ${auto_dir}"
++ elif [[ ! -d "${auto_dir}" ]]; then
++ die "${auto_dir} exists but is a file"
++ fi
++ cat >> ${auto_file} <<- ENDOFTEXT
++ DESCRIPTION="${DESCRIPTION} for ${1}"
++ VERSION="${VERSION}"
++ MAINTAINER="${MAINTAINER}"
++ ESELECT_MODULE_GROUP="Alternatives"
++
++ ALTERNATIVE="${1}"
++
++ inherit alternatives
++ ENDOFTEXT
++ fi
++}
++
++### delete action ###
++
++describe_delete() {
++ echo "Delete an existing alternative"
++}
++
++describe_delete_parameters() {
++ echo "<alternative>"
++}
++
++describe_delete_options() {
++ echo "<alternative> : the name of the alternative to delete"
++}
++
++do_delete() {
++ [[ $# == 1 ]] || die "Need exactly one alternative name"
++
++ local auto_dir="${ESELECT_AUTO_GENERATED_MODULES_PATH}"
++ local auto_file="${auto_dir}/${1}.eselect"
++
++ if [[ -e "${auto_file}" ]]; then
++ rm "${auto_file}" || die "Failed to remove alternative: ${1}"
++ fi
++}
++
++### add action ###
++
++describe_add() {
++ alternatives_describe_add
++}
++
++describe_add_parameters() {
++ echo "<alternative> $(alternatives_describe_add_parameters)"
++}
++
++describe_add_options() {
++ echo "<alternative> : the name of the alternative to add a provider for"
++ alternatives_describe_add_options
++}
++
++do_add() {
++ local ALTERNATIVE=$1
++ shift
++ [[ -z "${ALTERNATIVE}" ]] && die -q "Missing required parameter 'alternative'"
++ alternatives_do_add "$@"
++}
++
++options_add() {
++ alternatives_options_add
++}
++
++### remove action ###
++
++describe_remove() {
++ alternatives_describe_remove
++}
++
++describe_remove_parameters() {
++ echo "<alternative> $(alternatives_describe_remove_parameters)"
++}
++
++describe_remove_options() {
++ echo "<alternative> : the name of the alternative to remove a provider from"
++ alternatives_describe_remove_options
++}
++
++do_remove() {
++ local ALTERNATIVE=$1
++ shift
++ [[ -z "${ALTERNATIVE}" ]] && die -q "Missing required parameter 'alternative'"
++ alternatives_do_remove "$@"
++}
++
++options_remove() {
++ alternatives_options_remove
++}
diff --git a/modules/modules.eselect b/modules/modules.eselect
index 038f630..eb73e16 100644
--- a/modules/modules.eselect
diff --git a/app-misc/aa/ChangeLog b/app-misc/aa/ChangeLog
new file mode 100644
index 000000000..e1e42cb39
--- /dev/null
+++ b/app-misc/aa/ChangeLog
@@ -0,0 +1,11 @@
+# ChangeLog for app-misc/aa
+# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+ 24 May 2015; Justin Lecher <jlec@gentoo.org> aa-0.ebuild:
+ app-misc/aa: Fix usage
+
+*aa-0 (24 May 2015)
+
+ 24 May 2015; Justin Lecher <jlec@gentoo.org> +aa-0.ebuild, +metadata.xml:
+ app-misc/aa: Dummy package
diff --git a/app-misc/aa/aa-0.ebuild b/app-misc/aa/aa-0.ebuild
new file mode 100644
index 000000000..142e1c7a6
--- /dev/null
+++ b/app-misc/aa/aa-0.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit alternatives-2
+
+DESCRIPTION="AA"
+HOMEPAGE="http://www.gentoo.org"
+SRC_URI=""
+
+SLOT="0"
+LICENSE="BSD"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+"
+
+S="${WORKDIR}"
+
+src_install() {
+ cat > aa <<- EOF
+ #!/bin/bash
+ echo "aa"
+ EOF
+
+ dobin aa
+
+ alternatives_for alternatives-2 aa 0 /usr/bin/alternatives aa
+}
diff --git a/app-misc/aa/metadata.xml b/app-misc/aa/metadata.xml
new file mode 100644
index 000000000..7bc6ee8ea
--- /dev/null
+++ b/app-misc/aa/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>jlec@gentoo.org</email>
+ <name>Justin Lecher</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/app-misc/bb/ChangeLog b/app-misc/bb/ChangeLog
new file mode 100644
index 000000000..9b385c022
--- /dev/null
+++ b/app-misc/bb/ChangeLog
@@ -0,0 +1,11 @@
+# ChangeLog for app-misc/bb
+# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
+# $Header: $
+
+ 24 May 2015; Justin Lecher <jlec@gentoo.org> bb-0.ebuild:
+ app-misc/bb: Fix usage
+
+*bb-0 (24 May 2015)
+
+ 24 May 2015; Justin Lecher <jlec@gentoo.org> +bb-0.ebuild, +metadata.xml:
+ app-misc/bb: Dummy package
diff --git a/app-misc/bb/bb-0.ebuild b/app-misc/bb/bb-0.ebuild
new file mode 100644
index 000000000..befb22737
--- /dev/null
+++ b/app-misc/bb/bb-0.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=5
+
+inherit alternatives-2
+
+DESCRIPTION="BB"
+HOMEPAGE="http://www.gentoo.org"
+SRC_URI=""
+
+SLOT="0"
+LICENSE="BSD"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE=""
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+"
+
+S="${WORKDIR}"
+
+src_install() {
+ cat > bb <<- EOF
+ #!/bin/bash
+ echo "bb"
+ EOF
+
+ dobin bb
+
+ alternatives_for alternatives-2 bb 0 /usr/bin/alternatives aa
+}
diff --git a/app-misc/bb/metadata.xml b/app-misc/bb/metadata.xml
new file mode 100644
index 000000000..7bc6ee8ea
--- /dev/null
+++ b/app-misc/bb/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>jlec@gentoo.org</email>
+ <name>Justin Lecher</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass
index 5a7eb6cc2..4fcf67295 100644
--- a/eclass/alternatives-2.eclass
+++ b/eclass/alternatives-2.eclass
@@ -21,17 +21,17 @@
# sure you explicitly run alternatives-2_pkg_{postinst,prerm} where appropriate.
case "${EAPI:-0}" in
- 0|1|2|3)
+ 0|1|2|3|4)
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
;;
- 4|5)
+ 5)
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
;;
esac
-DEPEND=">=app-admin/eselect-1.4.4-r100"
+DEPEND=">=app-admin/eselect-1.4.4-r102"
RDEPEND="${DEPEND}
!app-admin/eselect-blas
!app-admin/eselect-cblas
@@ -56,87 +56,12 @@ ALTERNATIVES_DIR="/etc/env.d/alternatives"
alternatives_for() {
debug-print-function ${FUNCNAME} "${@}"
- (( $# >= 5 )) && (( ($#-3)%2 == 0)) || \
- die "${FUNCNAME} requires exactly 3+N*2 arguments where N>=1"
- local alternative=${1} provider=${2} importance=${3} index src target ret=0
- shift 3
+ dodir /etc/env.d/alternatives
- # Make sure importance is a signed integer
- if [[ -n ${importance} ]] && ! [[ ${importance} =~ ^[0-9]+(\.[0-9]+)*$ ]]; then
- eerror "Invalid importance (${importance}) detected"
- ((ret++))
- fi
-
- # Create alternative provider subdirectories under ALTERNATIVES_DIR if needed
- [[ -d "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}" ]] || \
- dodir "${ALTERNATIVES_DIR}/${alternative}/${provider}"
-
- # Keep track of provided alternatives for use in pkg_{postinst,prerm}.
- # Keep a mapping between importance and provided alternatives
- # and make sure the former is set to only one value.
- if ! has "${alternative}:${provider}" "${ALTERNATIVES_PROVIDED[@]}"; then
- # Add new provider and set its importance
- index=${#ALTERNATIVES_PROVIDED[@]}
- ALTERNATIVES_PROVIDED+=( "${alternative}:${provider}" )
- ALTERNATIVES_IMPORTANCE[index]=${importance}
- [[ -n ${importance} ]] && \
- echo "${importance}" > "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}/_importance"
- else
- # Set importance for existing provider
- for ((index=0;index<${#ALTERNATIVES_PROVIDED[@]};index++)); do
- if [[ ${alternative}:${provider} == ${ALTERNATIVES_PROVIDED[index]} ]]; then
- if [[ -n ${ALTERNATIVES_IMPORTANCE[index]} ]]; then
- if [[ -n ${importance} && ${ALTERNATIVES_IMPORTANCE[index]} != ${importance} ]]; then
- eerror "Differing importance (${ALTERNATIVES_IMPORTANCE[index]} != ${importance}) detected"
- ((ret++))
- fi
- else
- ALTERNATIVES_IMPORTANCE[index]=${importance}
- [[ -n ${importance} ]] && \
- echo "${importance}" > "${ED}${ALTERNATIVES_DIR}/${alternative}/${provider}/_importance"
- fi
- fi
- done
- fi
+ ALTERNATIVESDIR_ROOTLESS="${ED}/etc/env.d/alternatives" \
+ eselect alternatives add ${@} || die
- # Process source-target pairs
- while (( $# >= 2 )); do
- src=${1//+(\/)/\/}; target=${2//+(\/)/\/}
- if [[ ${src} != /* ]]; then
- eerror "Source path must be absolute, but got ${src}"
- ((ret++))
-
- else
- local reltarget= dir=${ALTERNATIVES_DIR}/${alternative}/${provider}${src%/*}
- while [[ -n ${dir} ]]; do
- reltarget+=../
- dir=${dir%/*}
- done
-
- reltarget=${reltarget%/}
- [[ ${target} == /* ]] || reltarget+=${src%/*}/
- reltarget+=${target}
- dodir "${ALTERNATIVES_DIR}/${alternative}/${provider}${src%/*}"
- dosym "${reltarget}" "${ALTERNATIVES_DIR}/${alternative}/${provider}${src}"
-
- # The -e test will fail if existing symlink points to non-existing target,
- # so check for -L also.
- # Say ${ED}/sbin/init exists and links to /bin/systemd (which doesn't exist yet).
- if [[ -e ${ED}${src} || -L ${ED}${src} ]]; then
- local fulltarget=${target}
- [[ ${fulltarget} != /* ]] && fulltarget=${src%/*}/${fulltarget}
- if [[ -e ${ED}${fulltarget} || -L ${ED}${fulltarget} ]]; then
- die "${src} defined as provider for ${fulltarget}, but both already exist in \${ED}"
- else
- mv "${ED}${src}" "${ED}${fulltarget}" || die
- fi
- fi
- fi
- shift 2
- done
-
- # Stop if there were any errors
- [[ ${ret} -eq 0 ]] || die "Errors detected for ${provider}, provided for ${alternative}"
+ ALTERNATIVES_CREATED+=( ${1} )
}
# @FUNCTION: cleanup_old_alternatives_module
@@ -151,7 +76,7 @@ cleanup_old_alternatives_module() {
if [[ -f "${old_module}" && $(grep 'ALTERNATIVE=' "${old_module}" | cut -d '=' -f 2) == "${alt}" ]]; then
local version="$(grep 'VERSION=' "${old_module}" | grep -o '[0-9.]\+')"
if [[ "${version}" == "0.1" || "${version}" == "20080924" ]]; then
- echo "rm ${old_module}"
+ einfo "rm ${old_module}"
rm "${old_module}" || eerror "rm ${old_module} failed"
fi
fi
@@ -168,30 +93,12 @@ cleanup_old_alternatives_module() {
alternatives-2_pkg_postinst() {
debug-print-function ${FUNCNAME} "${@}"
- local a alt provider module_version="20150521"
- local EAUTO="${EROOT%/}/usr/share/eselect/modules/auto"
-
- for a in "${ALTERNATIVES_PROVIDED[@]}"; do
- alt="${a%:*}"
- provider="${a#*:}"
- if [[ ! -f "${EAUTO}/${alt}.eselect" \
- || "$(grep '^VERSION=' "${EAUTO}/${alt}.eselect" | grep -o '[0-9]\+')" \
- -ne "${module_version}" ]]; then
- if [[ ! -d ${EAUTO} ]]; then
- install -d "${EAUTO}" || eerror "Could not create eselect modules dir"
- fi
- einfo "Creating alternatives eselect module for ${alt}"
- cat > "${EAUTO}/${alt}.eselect" <<- EOF
- # This module was automatically generated by alternatives-2.eclass
- DESCRIPTION="Alternatives for ${alt}"
- VERSION="${module_version}"
- MAINTAINER="eselect@gentoo.org"
- ESELECT_MODULE_GROUP="Alternatives"
-
- ALTERNATIVE="${alt}"
-
- inherit alternatives
- EOF
+ local alt
+
+ for alt in ${ALTERNATIVES_CREATED[@]}; do
+ if ! eselect ${alt} show > /dev/null; then
+ einfo "Creating Alternative for ${alt}"
+ eselect alternatives create ${alt}
fi
# Set alternative provider if there is no valid provider selected
@@ -211,25 +118,20 @@ alternatives-2_pkg_postinst() {
alternatives-2_pkg_prerm() {
debug-print-function ${FUNCNAME} "${@}"
- local a alt provider ignore ret
- local EAUTO="${EROOT%/}/usr/share/eselect/modules/auto"
+ local alt ret
# If we are uninstalling, update alternatives to valid provider
[[ -n ${REPLACED_BY_VERSION} ]] || ignore="--ignore"
- for a in "${ALTERNATIVES_PROVIDED[@]}"; do
- alt="${a%:*}"
- provider="${a#*:}"
+
+ for alt in ${ALTERNATIVES_CREATED[@]}; do
eselect "${alt}" update ${ignore} "${provider}"
- ret=$?
- [[ -n ${REPLACED_BY_VERSION} ]] || \
- einfo "Removing ${provider} alternative module for ${alt}, current is $(eselect ${alt} show)"
+
case ${ret} in
0) : ;;
2)
# This was last provider for the alternative, remove eselect module
einfo "Cleaning up unused alternatives module for ${alt}"
- rm "${EAUTO}/${alt}.eselect" || \
- eerror "rm ${EAUTO}/${alt}.eselect failed"
+ eselect alternatives delete "${alt}" || eerror "Failed to remove ${alt}"
;;
*)
eerror "eselect ${alt} update ${provider} returned ${ret}"