diff options
author | Jonathan Callen <abcd@gentoo.org> | 2010-02-28 18:11:03 +0000 |
---|---|---|
committer | Jonathan Callen <abcd@gentoo.org> | 2010-02-28 18:11:03 +0000 |
commit | 9d6ca75ac81e3b949964360f5a14164ba96b0ab2 (patch) | |
tree | 6200e165ae10d63e4d137b8f028cb08cc2bcce29 /app-admin/eselect-ecj | |
parent | Stable for HPPA (bug #306865). (diff) | |
download | gentoo-2-9d6ca75ac81e3b949964360f5a14164ba96b0ab2.tar.gz gentoo-2-9d6ca75ac81e3b949964360f5a14164ba96b0ab2.tar.bz2 gentoo-2-9d6ca75ac81e3b949964360f5a14164ba96b0ab2.zip |
Version bump to add prefix support, keywords
(Portage version: -svn/cvs/Linux i686)
Diffstat (limited to 'app-admin/eselect-ecj')
-rw-r--r-- | app-admin/eselect-ecj/ChangeLog | 10 | ||||
-rw-r--r-- | app-admin/eselect-ecj/eselect-ecj-0.4.ebuild | 26 | ||||
-rw-r--r-- | app-admin/eselect-ecj/files/ecj-0.4.eselect | 187 |
3 files changed, 221 insertions, 2 deletions
diff --git a/app-admin/eselect-ecj/ChangeLog b/app-admin/eselect-ecj/ChangeLog index f2458f2c3942..981935e24c88 100644 --- a/app-admin/eselect-ecj/ChangeLog +++ b/app-admin/eselect-ecj/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for app-admin/eselect-ecj -# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-ecj/ChangeLog,v 1.5 2009/11/10 20:13:57 caster Exp $ +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-ecj/ChangeLog,v 1.6 2010/02/28 18:11:02 abcd Exp $ + +*eselect-ecj-0.4 (28 Feb 2010) + + 28 Feb 2010; Jonathan Callen <abcd@gentoo.org> +eselect-ecj-0.4.ebuild, + +files/ecj-0.4.eselect: + Version bump to add prefix support, keywords 10 Nov 2009; Vlastimil Babka <caster@gentoo.org> eselect-ecj-0.3.ebuild: Remove ecj-3.2 and add ecj-3.5 in the dependency alternatives. diff --git a/app-admin/eselect-ecj/eselect-ecj-0.4.ebuild b/app-admin/eselect-ecj/eselect-ecj-0.4.ebuild new file mode 100644 index 000000000000..2b575aa43e05 --- /dev/null +++ b/app-admin/eselect-ecj/eselect-ecj-0.4.ebuild @@ -0,0 +1,26 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-ecj/eselect-ecj-0.4.ebuild,v 1.1 2010/02/28 18:11:02 abcd Exp $ + +EAPI=1 + +DESCRIPTION="Manages ECJ symlinks" +HOMEPAGE="http://www.gentoo.org/" +SRC_URI="" +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~ia64 ~ppc ~ppc64 ~x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~sparc-solaris ~x86-solaris" +IUSE="" + +RDEPEND=">=app-admin/eselect-1.2" +PDEPEND=" +|| ( + dev-java/eclipse-ecj:3.5 + dev-java/eclipse-ecj:3.4 + >=dev-java/eclipse-ecj-3.3.0-r2:3.3 +)" + +src_install() { + insinto /usr/share/eselect/modules + newins "${FILESDIR}/ecj-${PV}.eselect" ecj.eselect || die "newins failed" +} diff --git a/app-admin/eselect-ecj/files/ecj-0.4.eselect b/app-admin/eselect-ecj/files/ecj-0.4.eselect new file mode 100644 index 000000000000..196c111ffcb5 --- /dev/null +++ b/app-admin/eselect-ecj/files/ecj-0.4.eselect @@ -0,0 +1,187 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: ecj-0.4.eselect,v 1.1 2010/02/28 18:11:03 abcd Exp $ + +DESCRIPTION="Manage ECJ targets" +MAINTAINER="chewi@aura-online.co.uk" +VERSION="0.4" + +ECJ="${EROOT}/usr/bin/ecj" + +# find a list of ecj symlink targets, best first. +find_targets() { + for f in $(ls -r "${ECJ}"-[0-9]* 2> /dev/null) ; do + if [[ -f "${f}" ]] ; then + echo $(basename "${f}") + fi + done +} + +# get a named or numbered target. +find_target() { + local target=${1} + + if is_number "${target}" && [[ ${target} -ge 1 ]] ; then + targets=( $(find_targets ) ) + [[ -z "${targets}" ]] && die -q "No targets found!" + target=${targets[$(( ${target} - 1 ))]} + fi + + if [[ "${target}" = ecj-[0-9]* ]] && [[ -f "${EROOT}/usr/bin/${target}" ]] ; then + echo ${target} + else + die -q "Target \"${1}\" doesn't appear to be valid!" + fi +} + +# try to remove the ecj symlink. +remove_symlink() { + rm "${ECJ}" &>/dev/null +} + +# determine the current target. +get_target() { + local canonicalised=$(canonicalise "${ECJ}") + echo $(basename "${canonicalised}") +} + +# set the ecj symlink. +set_symlink() { + local target=$(find_target "${1}") + remove_symlink + ln -s "${EROOT}/usr/bin/${target}" "${ECJ}" || \ + die "Couldn't set ${target} symlink." +} + +### show action ### + +describe_show() { + echo "Show current ECJ target" +} + +do_show() { + if [[ ${#} -gt 0 ]]; then + die -q "No parameters allowed." + fi + + if [[ -L "${ECJ}" ]] ; then + get_target + return 0 + elif [[ -e "${ECJ}" ]] ; then + echo "(not a symlink)" >&2 + return 1 + else + echo "(unset)" >&2 + return 1 + fi +} + +### list action ### + +describe_list() { + echo "List available ECJ targets" +} + +do_list() { + if [[ ${#} -gt 0 ]]; then + die -q "Usage error: no parameters allowed." + fi + + local i targets + targets=( $(find_targets) ) + + if [[ -n ${targets[@]} ]] ; then + local canonicalised basename + + for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do + canonicalised=$(canonicalise "${ECJ}") + basename=$(basename "${canonicalised}") + + if [[ "${targets[${i}]}" = "${basename}" ]] ; then + targets[${i}]="${targets[${i}]} $(highlight '*')" + fi + done + + write_list_start "Available ECJ targets:" + write_numbered_list "${targets[@]}" + else + write_kv_list_entry "(none found)" "" + fi +} + +### set action ### + +describe_set() { + echo "Set a new ECJ target" +} + +describe_set_options() { + echo "target : Target name or number (from 'list' action)" +} + +describe_set_parameters() { + echo "<target>" +} + +do_set() { + if [[ $# -gt 1 ]]; then + die -q "Too many parameters. Expected only one." + fi + + local target=${1} + + if [[ -z "${target}" ]] ; then + die -q "You didn't give me a target name or number." + elif [[ -L "${ECJ}" ]] ; then + if ! remove_symlink ; then + die -q "Can't remove existing ecj provider." + elif ! set_symlink "${1}" ; then + die -q "Can't set new ecj provider." + fi + elif [[ -e "${ECJ}" ]] ; then + write_warning_msg "Can't set a new ecj provider. There's a file in the way at ${ECJ}. You can try removing it manually, and then re-running this command." + else + set_symlink "${target}" || die -q "Wasn't able to set a new provider." + fi +} + +### update action ### + +describe_update() { + echo "Set the ECJ target to the latest if the current target is invalid or if the given target is the latest" +} + +describe_update_options() { + echo "target (optional) : Target name (from 'list' action)" +} + +describe_update_parameters() { + echo "<target>" +} + +do_update() { + if [[ $# -gt 1 ]] ; then + die -q "Too many parameters. Expected only one." + fi + + # For pkg_postrm + if [[ ! $(find_targets) ]]; then + remove_symlink + return + fi + + local canonicalised=$(canonicalise "${ECJ}") + + if [[ ! -L "${ECJ}" ]] || [[ ! -f "${canonicalised}" ]] ; then + do_set 1 + elif [[ -n "${1}" ]] ; then + # Check whether target name is valid. + find_target "${1}" > /dev/null + + if [[ "${1}" == "$(find_target 1)" ]] ; then + do_set 1 + fi + fi +} + +# vim: set ft=eselect : |