diff options
author | Mike Gilbert <floppym@gentoo.org> | 2012-03-23 07:30:54 +0000 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2012-03-23 07:30:54 +0000 |
commit | 8cabb221852004004755555a6b54558074d434fc (patch) | |
tree | ff59e264dcb28eec26aeff3bfd05b34edd10e9ac | |
parent | Fix tests to use the proper interpreter and drop potential jeweler dependency... (diff) | |
download | historical-8cabb221852004004755555a6b54558074d434fc.tar.gz historical-8cabb221852004004755555a6b54558074d434fc.tar.bz2 historical-8cabb221852004004755555a6b54558074d434fc.zip |
Convert SGML_TOINSTALL to a bash array. Add some documentation.
-rw-r--r-- | eclass/ChangeLog | 5 | ||||
-rw-r--r-- | eclass/sgml-catalog.eclass | 59 |
2 files changed, 43 insertions, 21 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index bf154747b8e2..b58b77fc843c 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.181 2012/03/23 06:16:15 floppym Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.182 2012/03/23 07:30:54 floppym Exp $ + + 23 Mar 2012; Mike Gilbert <floppym@gentoo.org> sgml-catalog.eclass: + Convert SGML_TOINSTALL to a bash array. Add some documentation. 23 Mar 2012; Mike Gilbert <floppym@gentoo.org> sgml-catalog.eclass: PMS says that postrm runs before postinst, so remove workaround in diff --git a/eclass/sgml-catalog.eclass b/eclass/sgml-catalog.eclass index 931108cb9fbb..b717b91de7fc 100644 --- a/eclass/sgml-catalog.eclass +++ b/eclass/sgml-catalog.eclass @@ -1,29 +1,47 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.18 2012/03/23 06:16:15 floppym Exp $ -# +# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.19 2012/03/23 07:30:54 floppym Exp $ + +# @ECLASS: sgml-catalog.eclass +# @MAINTAINER: +# SGML Herd <sgml@gentoo.org> +# @AUTHOR: # Author Matthew Turk <satai@gentoo.org> +# @BLURB: Functions for installing SGML catalogs inherit base DEPEND=">=app-text/sgml-common-0.6.3-r2" +# @ECLASS-VARIABLE: SGML_TOINSTALL +# @DESCRIPTION: +# An array of catalogs, arranged in pairs. +# Each pair consists of a centralized catalog followed by an ordinary catalog. +SGML_TOINSTALL=() -# List of catalogs to install -SGML_TOINSTALL="" - - +# @FUNCTION: sgml-catalog_cat_include +# @USAGE: <centralized catalog> <ordinary catalog> +# @DESCRIPTION: +# Appends a catalog pair to the SGML_TOINSTALL array. sgml-catalog_cat_include() { debug-print function $FUNCNAME $* - SGML_TOINSTALL="${SGML_TOINSTALL} ${1}:${2}" + SGML_TOINSTALL+=("$1" "$2") } +# @FUNCTION: sgml-catalog_cat_doinstall +# @USAGE: <centralized catalog> <ordinary catalog> +# @DESCRIPTION: +# Adds an ordinary catalog to a centralized catalog. sgml-catalog_cat_doinstall() { debug-print function $FUNCNAME $* has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null } +# @FUNCTION: sgml-catalog_cat_doremove +# @USAGE: <centralized catalog> <ordinary catalog> +# @DESCRIPTION: +# Removes an ordinary catalog from a centralized catalog. sgml-catalog_cat_doremove() { debug-print function $FUNCNAME $* has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= @@ -34,16 +52,16 @@ sgml-catalog_pkg_postinst() { debug-print function $FUNCNAME $* has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= - for entry in ${SGML_TOINSTALL}; do - arg1=${entry%%:*} - arg2=${entry#*:} - if [ ! -e "${EPREFIX}"${arg2} ] - then - ewarn "${EPREFIX}${arg2} doesn't appear to exist, although it ought to!" + set -- "${SGML_TOINSTALL[@]}" + + while (( $# )); do + if [[ ! -e "${EPREFIX}$2" ]]; then + ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!" continue fi - einfo "Now adding ${EPREFIX}${arg2} to ${EPREFIX}${arg1} and ${EPREFIX}/etc/sgml/catalog" - sgml-catalog_cat_doinstall ${arg1} ${arg2} + einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog" + sgml-catalog_cat_doinstall "$1" "$2" + shift 2 done sgml-catalog_cleanup } @@ -56,11 +74,12 @@ sgml-catalog_pkg_postrm() { debug-print function $FUNCNAME $* has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= - for entry in ${SGML_TOINSTALL}; do - arg1=${entry%%:*} - arg2=${entry#*:} - einfo "Now removing ${EPREFIX}${arg2} from ${EPREFIX}${arg1} and ${EPREFIX}/etc/sgml/catalog" - sgml-catalog_cat_doremove ${arg1} ${arg2} + set -- "${SGML_TOINSTALL[@]}" + + while (( $# )); do + einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog" + sgml-catalog_cat_doremove "$1" "$2" + shift 2 done } |