From db87d25626c176fea330eff3a6f5de74cd27ba25 Mon Sep 17 00:00:00 2001 From: Alexis Ballier Date: Tue, 9 Sep 2008 16:51:58 +0000 Subject: Initial import: manages /usr/bin/pdftex symlinks to allow easy usage of standalone pdftex ebuild. (Portage version: 2.2_rc8/cvs/Linux 2.6.26.3 x86_64) --- app-admin/eselect-pdftex/ChangeLog | 11 ++ app-admin/eselect-pdftex/Manifest | 4 + app-admin/eselect-pdftex/eselect-pdftex-0.1.ebuild | 28 ++++ app-admin/eselect-pdftex/files/pdftex.eselect-0.1 | 153 +++++++++++++++++++++ app-admin/eselect-pdftex/metadata.xml | 5 + 5 files changed, 201 insertions(+) create mode 100644 app-admin/eselect-pdftex/ChangeLog create mode 100644 app-admin/eselect-pdftex/Manifest create mode 100644 app-admin/eselect-pdftex/eselect-pdftex-0.1.ebuild create mode 100644 app-admin/eselect-pdftex/files/pdftex.eselect-0.1 create mode 100644 app-admin/eselect-pdftex/metadata.xml diff --git a/app-admin/eselect-pdftex/ChangeLog b/app-admin/eselect-pdftex/ChangeLog new file mode 100644 index 000000000000..25cdc2efabdd --- /dev/null +++ b/app-admin/eselect-pdftex/ChangeLog @@ -0,0 +1,11 @@ +# ChangeLog for app-admin/eselect-pdftex +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-pdftex/ChangeLog,v 1.1 2008/09/09 16:51:57 aballier Exp $ + +*eselect-pdftex-0.1 (09 Sep 2008) + + 09 Sep 2008; Alexis Ballier + +files/pdftex.eselect-0.1, +metadata.xml, +eselect-pdftex-0.1.ebuild: + Initial import: manages /usr/bin/pdftex symlinks to allow easy usage of + standalone pdftex ebuild. + diff --git a/app-admin/eselect-pdftex/Manifest b/app-admin/eselect-pdftex/Manifest new file mode 100644 index 000000000000..1ec37a3a5f9c --- /dev/null +++ b/app-admin/eselect-pdftex/Manifest @@ -0,0 +1,4 @@ +AUX pdftex.eselect-0.1 3875 RMD160 6c124482765056cebbcef6d1a4c33cb246c82056 SHA1 89dd2bd47bc96c090412bc1b6d612827119c2ccb SHA256 bf5f6d30f372e15d6f5f78a0ac3f05647ef67303cec789de2876ea562f5c3bc8 +EBUILD eselect-pdftex-0.1.ebuild 816 RMD160 ba1b83d93dcf159eb3b01018828a9a4748cb624d SHA1 588ef394f7b3205c2975072caa21a1cdae45a1fc SHA256 0f4b5746bc463dadcb27ab1c633e44a7b8fa5ca78909a65134e00b9074e4baa4 +MISC ChangeLog 387 RMD160 d7435fbc74dc74ca996fa5ae3ce980e30b64c207 SHA1 52f7addac612ba1515704f64abbc2ab27d72b779 SHA256 480b699b8bd8ebfde7bac2343e12255761eb61016cd897b054a1d0c74cf079f3 +MISC metadata.xml 156 RMD160 2bf6b2ed9ff0fcef1e902cf093ccf4ae2dcc70a0 SHA1 e9260cd53905d8569cf3327ded4c6d01653fc389 SHA256 b4971b8472ab3fe4fbfe41b331a79193ca19e86c08d055ad1c20eaf9e04b79b6 diff --git a/app-admin/eselect-pdftex/eselect-pdftex-0.1.ebuild b/app-admin/eselect-pdftex/eselect-pdftex-0.1.ebuild new file mode 100644 index 000000000000..24e65c27fe93 --- /dev/null +++ b/app-admin/eselect-pdftex/eselect-pdftex-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-pdftex/eselect-pdftex-0.1.ebuild,v 1.1 2008/09/09 16:51:57 aballier Exp $ + +inherit eutils + +DESCRIPTION="pdftex 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="pdftex" + dodir ${MODULEDIR} + insinto ${MODULEDIR} + newins "${FILESDIR}/${MODULE}.eselect-${PVR}" ${MODULE}.eselect || die "failed to install" +} diff --git a/app-admin/eselect-pdftex/files/pdftex.eselect-0.1 b/app-admin/eselect-pdftex/files/pdftex.eselect-0.1 new file mode 100644 index 000000000000..f88ed70489c6 --- /dev/null +++ b/app-admin/eselect-pdftex/files/pdftex.eselect-0.1 @@ -0,0 +1,153 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: pdftex.eselect-0.1,v 1.1 2008/09/09 16:51:58 aballier Exp $ + +DESCRIPTION="Manage /usr/bin/pdftex implementations" +MAINTAINER="ml@gentoo.org" +SVN_DATE='$Date: 2008/09/09 16:51:58 $' +VERSION=$(svn_date_to_version "${SVN_DATE}" ) + +# find a list of pdftex symlink targets, best first +find_targets() { + local f + for f in "${ROOT}"/usr/bin/pdftex-*; do + if [[ -f ${f} ]] ; then + echo "${f##*/pdftex-}" + fi + done | sort +} + +# find version number of currently symlinked version +identify_target() { + local f + f="$(canonicalise "${ROOT}"/usr/bin/pdftex)" + echo "${f##*/pdftex-}" +} + +# try to remove the pdftex symlink +remove_symlinks() { + rm -f "${ROOT}"/usr/bin/pdftex &>/dev/null +} + +# set the pdftex 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/pdftex-${target}" ]] ; then + remove_symlinks + ln -s "pdftex-${target}" "${ROOT}/usr/bin/pdftex" || \ + die "Could not set ${target} /usr/bin/pdftex symlink" + echo "Updating TeX formats" + [ -z "${ROOT}" ] && fmtutil-sys --all &>/dev/null || write_warning_msg "Could not update TeX formats for some reason, pdftex may not work properly." + else + die -q "Target \"${target}\" doesn't appear to be valid!" + fi +} + +### show action ### + +describe_show() { + echo "Show the current pdftex version" +} + +do_show() { + [[ -z "${@}" ]] || die -q "Too many parameters" + + write_list_start "Current pdftex verson:" + if [[ -L "${ROOT}/usr/bin/pdftex" ]] ; then + write_kv_list_entry "$(identify_target)" "" + elif [[ -e "${ROOT}/usr/bin/pdftex" ]] ; then + write_kv_list_entry "(not a symlink)" "" + else + write_kv_list_entry "(unset)" "" + fi +} + +### list action ### + +describe_list() { + echo "List available pdftex 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 pdftex versions:" + write_numbered_list "${targets[@]}" + else + write_kv_list_entry "(none found)" "" + fi +} + +### set action ### + +describe_set() { + echo "Set a new pdftex version" +} + +describe_set_options() { + echo "target : Target version number or index from 'list' action" +} + +describe_set_parameters() { + echo "" +} + +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/pdftex" ]] ; 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/pdftex" ]] ; then + die -q "${ROOT}/usr/bin/pdftex 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 pdftex 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/pdftex" ]] ; then + [[ ${1} == "--if-unset" ]] && return + remove_symlinks || die -q "Can't remove existing symlink" + fi + if [[ -e "${ROOT}/usr/bin/pdftex" ]] ; then + die -q "${ROOT}/usr/bin/pdftex 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-pdftex/metadata.xml b/app-admin/eselect-pdftex/metadata.xml new file mode 100644 index 000000000000..ba6a8a8800d5 --- /dev/null +++ b/app-admin/eselect-pdftex/metadata.xml @@ -0,0 +1,5 @@ + + + +tex + -- cgit v1.2.3-65-gdbad