summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-admin/eselect-yacc/files/yacc.eselect')
-rw-r--r--app-admin/eselect-yacc/files/yacc.eselect148
1 files changed, 0 insertions, 148 deletions
diff --git a/app-admin/eselect-yacc/files/yacc.eselect b/app-admin/eselect-yacc/files/yacc.eselect
deleted file mode 100644
index 967be72..0000000
--- a/app-admin/eselect-yacc/files/yacc.eselect
+++ /dev/null
@@ -1,148 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-
-inherit output path-manipulation
-
-DESCRIPTION="Manage /usr/bin/yacc symlink"
-MAINTAINER="base-system@gentoo.org"
-VERSION="0.1"
-YACC_SYMLINK=${ROOT}/usr/bin/yacc
-
-# find_targets
-# returns available targets for symlink
-# Note: first match is best match for do_update command
-find_targets() {
- local f
- for f in "${ROOT}/usr/bin/"{yacc.bison,yacc.yacc} ; do
- [[ -x $f ]] && echo "${f}"
- done
-}
-
-# is_active $target
-# returns true if ${YACC_SYMLINK} points to $target
-is_active() {
- [[ ${#@} -eq 1 ]] || die "Need exactly 1 argument!"
- [[ -L ${YACC_SYMLINK} && $(canonicalise ${YACC_SYMLINK}) -ef ${1} ]]
-}
-
-# is_updateable
-# returns true if ${YACC_SYMLINK} could be updated
-# That means it does either is symlink or does not exist
-is_updateable() {
- [[ -L ${YACC_SYMLINK} || ! -a ${YACC_SYMLINK} ]]
-}
-
-# safe_set_symlink $target
-# does some safety checks and points $YACC_SYMLINK to $target
-safe_set_symlink() {
- [[ ${#@} -eq 1 ]] || die "Need exactly 1 argument!"
- [[ -x ${1} ]] || die "${1} is not executable!"
- is_updateable || die "${YACC_SYMLINK} exists but is not symlink!"
- ln -sf "${1}" "${YACC_SYMLINK}" || \
- die "Failed to set symlink! How could this happen? :("
-}
-
-### list action ###
-
-describe_list() {
- echo "List available targets for ${YACC_SYMLINK} symlink can point to"
-}
-
-do_list() {
- local targets i=0 active
-
- targets=( $(find_targets) )
-
- write_list_start "Available possibilities for ${YACC_SYMLINK} symlink can point to:"
- write_list_start "( $(highlight '*') - designates where symlink points now)"
- if [[ -n ${targets[@]} ]] ; then
- for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
- active=''
- is_active "${targets[${i}]}" && active=' *'
- write_numbered_list_entry ${i} "${targets[${i}]}$(highlight "${active}")"
- done
- else
- write_kv_list_entry "(none found)" ""
- fi
-
- return 0
-}
-
-### show action ###
-
-describe_show() {
- echo "Show where ${YACC_SYMLINK} currently points to"
-}
-
-do_show() {
- if [[ -L ${YACC_SYMLINK} ]]; then
- echo $(canonicalise "${YACC_SYMLINK}")
- else
- write_warning_msg "${YACC_SYMLINK} is not a symlink!"
- fi
-}
-
-### set action ###
-
-describe_set() {
- echo "Set ${YACC_SYMLINK} symlink"
-}
-
-describe_set_parameters() {
- echo "<target>"
-}
-
-describe_set_options() {
- echo "<target> : Target name or number (from 'list' action)"
-}
-
-do_set() {
- [[ ${#@} == 1 ]] || \
- die -q "Please specify exactly one version to activate!"
-
- local target targets i=0
-
- targets=( $(find_targets) )
-
- if is_number "${1}"; then
- target=${targets[${1}]}
- else
- for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
- [[ ${targets[${i}]} == ${1} ]] && \
- target=${1}
- done
- fi
-
- [[ -z "${target}" ]] && \
- die -q "Target \"${target}\" doesn't appear to be valid!"
-
- safe_set_symlink ${target}
-}
-
-### update action ###
-
-describe_update() {
- echo "Atomaticaly detect providers for ${YACC_SYMLINK} symlink and set it"
-}
-
-do_update() {
- local target targets i=0
-
- targets=( $(find_targets) )
- if [[ -n ${targets[@]} ]] ; then
- for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do
- [[ ${targets[${i}]} -ef $(canonicalise "${YACC_SYMLINK}") ]] && \
- return 0
- done
- safe_set_symlink ${targets[0]}
- else
- write_warning_msg "No targets exist to update symlink. Removing ${YACC_SYMLINK} if exist."
- write_warning_msg "Ignore this warning if you removed all yacc providers."
- is_updateable || \
- die -q "${YACC_SYMLINK} is not symlink. I'd better not remove it!"
- [[ -L ${YACC_SYMLINK} ]] && rm -r ${YACC_SYMLINK}
- fi
-}
-
-# vim: set ft=eselect :