public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in app-admin/eselect-ecj/files: ecj-0.7.eselect
@ 2011-12-18  8:44 Ralph Sennhauser (sera)
  0 siblings, 0 replies; 2+ messages in thread
From: Ralph Sennhauser (sera) @ 2011-12-18  8:44 UTC (permalink / raw
  To: gentoo-commits

sera        11/12/18 08:44:56

  Added:                ecj-0.7.eselect
  Log:
  Version and EAPI bump.
  Drop PDEPEND as it doesn't guarantee packages DEPENDing on eselect-ecj the
  availability of a usable ecj. Packages must DEPEND on ecj for themself.
  Make update action always barf on invalid input.
  Make update action check for ecj.jar link as well.
  Make set action always link valid targets. #354097
  
  (Portage version: 2.1.10.41/cvs/Linux x86_64)

Revision  Changes    Path
1.1                  app-admin/eselect-ecj/files/ecj-0.7.eselect

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/eselect-ecj/files/ecj-0.7.eselect?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-admin/eselect-ecj/files/ecj-0.7.eselect?rev=1.1&content-type=text/plain

Index: ecj-0.7.eselect
===================================================================
# -*-eselect-*-  vim: ft=eselect
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: ecj-0.7.eselect,v 1.1 2011/12/18 08:44:56 sera Exp $

DESCRIPTION="Manage ECJ targets"
MAINTAINER="java@gentoo.org"
VERSION="0.7"

ECJ="${EROOT}/usr/bin/ecj"
ECJ_JAR="${EROOT}/usr/share/eclipse-ecj/ecj.jar"

# find a list of ecj symlink targets, best first.
find_targets() {
	for f in $(ls -r "${ECJ}"-[0-9]* "${ECJ}"-gcj-[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]* || "${target}" = ecj-gcj-[0-9]* ]] \
		&& [[ -f "${EROOT}/usr/bin/${target}" ]] ; then
		echo ${target}
	else
		die -q "Target \"${1}\" doesn't appear to be valid!"
	fi
}

# determine the current target.
get_target() {
	local canonicalised=$(canonicalise "${ECJ}")
	echo $(basename "${canonicalised}")
}

### 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) )

	for (( i = 0; i < ${#targets[@]}; i++ )); do
		[[ ${targets[i]} = $(basename "$(canonicalise "${ECJ}")") ]] \
			&& targets[i]=$(highlight_marker "${targets[i]}")
	done

	write_list_start "Available ECJ targets:"
	write_numbered_list -m "(none found)" "${targets[@]}"
}

### 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() {
	[[ ${1} ]] || die -q "You didn't give me a target name or number."
	[[ ${2} ]] && die -q "Too many parameters. Expected only one."

	local target=$(find_target "${1}")

	rm -f "${ECJ}" "${ECJ_JAR}"

	ln -sf "${target}" "${ECJ}" || die "Couldn't set ${target} symlink."
	mkdir -p $(dirname ${ECJ_JAR})
	[[ "${target}" != ecj-gcj* ]] && target="eclipse-${target}"
	ln -sf "${EROOT}"/usr/share/${target}/lib/ecj.jar ${ECJ_JAR} \
		|| die -q "Wasn't able to set a new provider."
}

### 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() {
	[[ ${1} ]] && find_target "${1}" >/dev/null
	[[ ${2} ]] && die -q "Too many parameters. Expected only one."

	if [[ ! -f "${ECJ}" ]] || [[ ! -f "${ECJ_JAR}" ]]; then
		local target="${1}"
		if [[ -z "${target}" ]]; then
			local all_targets=( $(find_targets) )
			target=${all_targets}
		fi
		if [[ ${target} ]]; then
			do_set ${target}
		else
			rm -f "${ECJ}" "${ECJ_JAR}"
		fi
	fi
}






^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gentoo-commits] gentoo-x86 commit in app-admin/eselect-ecj/files: ecj-0.7.eselect
@ 2015-03-31 20:35 Ulrich Mueller (ulm)
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Mueller (ulm) @ 2015-03-31 20:35 UTC (permalink / raw
  To: gentoo-commits

ulm         15/03/31 20:35:46

  Removed:              ecj-0.7.eselect
  Log:
  Package move app-admin/eselect-* to app-eselect/eselect-*.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-31 20:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-18  8:44 [gentoo-commits] gentoo-x86 commit in app-admin/eselect-ecj/files: ecj-0.7.eselect Ralph Sennhauser (sera)
  -- strict thread matches above, loose matches on Subject: below --
2015-03-31 20:35 Ulrich Mueller (ulm)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox