diff options
author | Alexis Ballier <aballier@gentoo.org> | 2008-09-09 16:46:31 +0000 |
---|---|---|
committer | Alexis Ballier <aballier@gentoo.org> | 2008-09-09 16:46:31 +0000 |
commit | 0d8a8c615870c15dbcfb5722499c4515701a3952 (patch) | |
tree | ab8cee81db2968b904d172cf6672e489b0b4541a /app-admin | |
parent | Bump to 2008 (diff) | |
download | gentoo-2-0d8a8c615870c15dbcfb5722499c4515701a3952.tar.gz gentoo-2-0d8a8c615870c15dbcfb5722499c4515701a3952.tar.bz2 gentoo-2-0d8a8c615870c15dbcfb5722499c4515701a3952.zip |
Initial import: manages /usr/bin/mpost symlinks to allow easy usage of mplib's mpost.
(Portage version: 2.2_rc8/cvs/Linux 2.6.26.3 x86_64)
Diffstat (limited to 'app-admin')
-rw-r--r-- | app-admin/eselect-mpost/ChangeLog | 11 | ||||
-rw-r--r-- | app-admin/eselect-mpost/Manifest | 4 | ||||
-rw-r--r-- | app-admin/eselect-mpost/eselect-mpost-0.1.ebuild | 28 | ||||
-rw-r--r-- | app-admin/eselect-mpost/files/mpost.eselect-0.1 | 153 | ||||
-rw-r--r-- | app-admin/eselect-mpost/metadata.xml | 5 |
5 files changed, 201 insertions, 0 deletions
diff --git a/app-admin/eselect-mpost/ChangeLog b/app-admin/eselect-mpost/ChangeLog new file mode 100644 index 000000000000..2a295ff5527e --- /dev/null +++ b/app-admin/eselect-mpost/ChangeLog @@ -0,0 +1,11 @@ +# ChangeLog for app-admin/eselect-mpost +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mpost/ChangeLog,v 1.1 2008/09/09 16:46:30 aballier Exp $ + +*eselect-mpost-0.1 (09 Sep 2008) + + 09 Sep 2008; Alexis Ballier <aballier@gentoo.org> + +files/mpost.eselect-0.1, +metadata.xml, +eselect-mpost-0.1.ebuild: + Initial import: manages /usr/bin/mpost symlinks to allow easy usage of + mplib's mpost. + diff --git a/app-admin/eselect-mpost/Manifest b/app-admin/eselect-mpost/Manifest new file mode 100644 index 000000000000..f14cc84448bb --- /dev/null +++ b/app-admin/eselect-mpost/Manifest @@ -0,0 +1,4 @@ +AUX mpost.eselect-0.1 3840 RMD160 680cf091f259f83f2675ad61cc398b0071695226 SHA1 7588d92cb1282f3b23a3acec4c146a3238fd5fef SHA256 736daaa6db73e405c4a1a14a14ebcf16bf4133755f575b6d8f497f535ef606fc +EBUILD eselect-mpost-0.1.ebuild 814 RMD160 36604ce1a366fec7a8798f5dcdf88f91bf86838e SHA1 0781fce555165055ddf9f4774e5aad8e8f34b861 SHA256 7a565aa6467fb11ed006c7fb85070005ee0f767922c0704ed2adf752a387c539 +MISC ChangeLog 371 RMD160 fdc9aa804bebd3b242d83114c683295be24eedec SHA1 88df0b730cf11c1414d798de1e23ca2c16f56206 SHA256 550c1f19d4c0f7e7daeb0bd111c4563887c18b3d69455c822db2e46a8890b8f3 +MISC metadata.xml 156 RMD160 2bf6b2ed9ff0fcef1e902cf093ccf4ae2dcc70a0 SHA1 e9260cd53905d8569cf3327ded4c6d01653fc389 SHA256 b4971b8472ab3fe4fbfe41b331a79193ca19e86c08d055ad1c20eaf9e04b79b6 diff --git a/app-admin/eselect-mpost/eselect-mpost-0.1.ebuild b/app-admin/eselect-mpost/eselect-mpost-0.1.ebuild new file mode 100644 index 000000000000..b695b68d26e2 --- /dev/null +++ b/app-admin/eselect-mpost/eselect-mpost-0.1.ebuild @@ -0,0 +1,28 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-mpost/eselect-mpost-0.1.ebuild,v 1.1 2008/09/09 16:46:30 aballier Exp $ + +inherit eutils + +DESCRIPTION="mpost module for eselect" +HOMEPAGE="http://www.gentoo.org/proj/en/eselect/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86-fbsd" + +IUSE="" +DEPEND="" +# Depend on texlive-core-2008 that allows usage of this module, otherwise it +# will not work so nicely. +RDEPEND=">=app-admin/eselect-1.0.5 + >=app-text/texlive-core-2008" + +src_install() { + local MODULEDIR="/usr/share/eselect/modules" + local MODULE="mpost" + dodir ${MODULEDIR} + insinto ${MODULEDIR} + newins "${FILESDIR}/${MODULE}.eselect-${PVR}" ${MODULE}.eselect || die "failed to install" +} diff --git a/app-admin/eselect-mpost/files/mpost.eselect-0.1 b/app-admin/eselect-mpost/files/mpost.eselect-0.1 new file mode 100644 index 000000000000..81022c031161 --- /dev/null +++ b/app-admin/eselect-mpost/files/mpost.eselect-0.1 @@ -0,0 +1,153 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: mpost.eselect-0.1,v 1.1 2008/09/09 16:46:31 aballier Exp $ + +DESCRIPTION="Manage /usr/bin/mpost implementations" +MAINTAINER="ml@gentoo.org" +SVN_DATE='$Date: 2008/09/09 16:46:31 $' +VERSION=$(svn_date_to_version "${SVN_DATE}" ) + +# find a list of mpost symlink targets, best first +find_targets() { + local f + for f in "${ROOT}"/usr/bin/mpost-*; do + if [[ -f ${f} ]] ; then + echo "${f##*/mpost-}" + fi + done | sort +} + +# find version number of currently symlinked version +identify_target() { + local f + f="$(canonicalise "${ROOT}"/usr/bin/mpost)" + echo "${f##*/mpost-}" +} + +# try to remove the mpost symlink +remove_symlinks() { + rm -f "${ROOT}"/usr/bin/mpost &>/dev/null +} + +# set the mpost symlink +set_symlinks() { + local target="${1}" targets + if is_number "${target}" && [[ ${target} -ge 1 ]] ; then + targets=( $(find_targets ) ) + target=${targets[$(( ${target} - 1 ))]} + fi + if [[ -f "${ROOT}/usr/bin/mpost-${target}" ]] ; then + remove_symlinks + ln -s "mpost-${target}" "${ROOT}/usr/bin/mpost" || \ + die "Could not set ${target} /usr/bin/mpost symlink" + echo "Updating TeX formats" + [ -z "${ROOT}" ] && fmtutil-sys --all &>/dev/null || write_warning_msg "Could not update TeX formats for some reason, mpost may not work properly." + else + die -q "Target \"${target}\" doesn't appear to be valid!" + fi +} + +### show action ### + +describe_show() { + echo "Show the current mpost version" +} + +do_show() { + [[ -z "${@}" ]] || die -q "Too many parameters" + + write_list_start "Current mpost verson:" + if [[ -L "${ROOT}/usr/bin/mpost" ]] ; then + write_kv_list_entry "$(identify_target)" "" + elif [[ -e "${ROOT}/usr/bin/mpost" ]] ; then + write_kv_list_entry "(not a symlink)" "" + else + write_kv_list_entry "(unset)" "" + fi +} + +### list action ### + +describe_list() { + echo "List available mpost versions" +} + +do_list() { + [[ -z "${@}" ]] || die -q "Too many parameters" + + local i targets current + targets=( $(find_targets ) ) + current=$(identify_target) + if [[ -n ${targets[@]} ]] ; then + for (( i = 0 ; i < ${#targets[@]} ; i = i + 1 )) ; do + [[ ${targets[${i}]} == ${current} ]] && \ + targets[${i}]="${targets[${i}]} $(highlight '*' )" + done + write_list_start "Available mpost versions:" + write_numbered_list "${targets[@]}" + else + write_kv_list_entry "(none found)" "" + fi +} + +### set action ### + +describe_set() { + echo "Set a new mpost version" +} + +describe_set_options() { + echo "target : Target version number or index from 'list' action" +} + +describe_set_parameters() { + echo "<target>" +} + +do_set() { + if [[ -z "${1}" ]] ; then + die -q "You didn't give me a version number" + + elif [[ -n "${2}" ]] ; then + die -q "Too many parameters" + + elif [[ -L "${ROOT}/usr/bin/mpost" ]] ; then + if ! remove_symlinks ; then + die -q "Can't remove existing version symlink" + elif ! set_symlinks "${1}" ; then + die -q "Can't set new version" + fi + + elif [[ -e "${ROOT}/usr/bin/mpost" ]] ; then + die -q "${ROOT}/usr/bin/mpost seems to be from an old ebuild, please remove manually" + else + set_symlinks "${1}" || die -q "Can't set new version" + fi +} + +### update action ### + +describe_update() { + echo "Automatically update the mpost version number" +} + +describe_update_options() { + echo "--if-unset : Do not override currently selected version" +} + +do_update() { + [[ -z "${1}" ]] || ( [[ -z "${2}" ]] && [[ "${1}" == "--if-unset" ]] ) || \ + die -q "Usage error" + + if [[ -L "${ROOT}/usr/bin/mpost" ]] ; then + [[ ${1} == "--if-unset" ]] && return + remove_symlinks || die -q "Can't remove existing symlink" + fi + if [[ -e "${ROOT}/usr/bin/mpost" ]] ; then + die -q "${ROOT}/usr/bin/mpost seems to be from an old ebuild, please remove manually" + elif ! [[ -z $(find_targets ) ]] ; then + set_symlinks 1 || die -q "Can't set a new version" + fi +} + +# vim: set ft=eselect : diff --git a/app-admin/eselect-mpost/metadata.xml b/app-admin/eselect-mpost/metadata.xml new file mode 100644 index 000000000000..ba6a8a8800d5 --- /dev/null +++ b/app-admin/eselect-mpost/metadata.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>tex</herd> +</pkgmetadata> |