/[gentoo-x86]/eclass/sgml-catalog.eclass
Gentoo

Diff of /eclass/sgml-catalog.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.18 Revision 1.19
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.18 2012/03/23 06:16:15 floppym Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.19 2012/03/23 07:30:54 floppym Exp $
4# 4
5# @ECLASS: sgml-catalog.eclass
6# @MAINTAINER:
7# SGML Herd <sgml@gentoo.org>
8# @AUTHOR:
5# Author Matthew Turk <satai@gentoo.org> 9# Author Matthew Turk <satai@gentoo.org>
10# @BLURB: Functions for installing SGML catalogs
6 11
7inherit base 12inherit base
8 13
9DEPEND=">=app-text/sgml-common-0.6.3-r2" 14DEPEND=">=app-text/sgml-common-0.6.3-r2"
10 15
16# @ECLASS-VARIABLE: SGML_TOINSTALL
17# @DESCRIPTION:
18# An array of catalogs, arranged in pairs.
19# Each pair consists of a centralized catalog followed by an ordinary catalog.
20SGML_TOINSTALL=()
11 21
12# List of catalogs to install 22# @FUNCTION: sgml-catalog_cat_include
13SGML_TOINSTALL="" 23# @USAGE: <centralized catalog> <ordinary catalog>
14 24# @DESCRIPTION:
15 25# Appends a catalog pair to the SGML_TOINSTALL array.
16sgml-catalog_cat_include() { 26sgml-catalog_cat_include() {
17 debug-print function $FUNCNAME $* 27 debug-print function $FUNCNAME $*
18 SGML_TOINSTALL="${SGML_TOINSTALL} ${1}:${2}" 28 SGML_TOINSTALL+=("$1" "$2")
19} 29}
20 30
31# @FUNCTION: sgml-catalog_cat_doinstall
32# @USAGE: <centralized catalog> <ordinary catalog>
33# @DESCRIPTION:
34# Adds an ordinary catalog to a centralized catalog.
21sgml-catalog_cat_doinstall() { 35sgml-catalog_cat_doinstall() {
22 debug-print function $FUNCNAME $* 36 debug-print function $FUNCNAME $*
23 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 37 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
24 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null 38 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
25} 39}
26 40
41# @FUNCTION: sgml-catalog_cat_doremove
42# @USAGE: <centralized catalog> <ordinary catalog>
43# @DESCRIPTION:
44# Removes an ordinary catalog from a centralized catalog.
27sgml-catalog_cat_doremove() { 45sgml-catalog_cat_doremove() {
28 debug-print function $FUNCNAME $* 46 debug-print function $FUNCNAME $*
29 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 47 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
30 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null 48 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
31} 49}
32 50
33sgml-catalog_pkg_postinst() { 51sgml-catalog_pkg_postinst() {
34 debug-print function $FUNCNAME $* 52 debug-print function $FUNCNAME $*
35 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 53 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
36 54
37 for entry in ${SGML_TOINSTALL}; do 55 set -- "${SGML_TOINSTALL[@]}"
38 arg1=${entry%%:*} 56
39 arg2=${entry#*:} 57 while (( $# )); do
40 if [ ! -e "${EPREFIX}"${arg2} ] 58 if [[ ! -e "${EPREFIX}$2" ]]; then
41 then
42 ewarn "${EPREFIX}${arg2} doesn't appear to exist, although it ought to!" 59 ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
43 continue 60 continue
44 fi 61 fi
45 einfo "Now adding ${EPREFIX}${arg2} to ${EPREFIX}${arg1} and ${EPREFIX}/etc/sgml/catalog" 62 einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
46 sgml-catalog_cat_doinstall ${arg1} ${arg2} 63 sgml-catalog_cat_doinstall "$1" "$2"
64 shift 2
47 done 65 done
48 sgml-catalog_cleanup 66 sgml-catalog_cleanup
49} 67}
50 68
51sgml-catalog_pkg_prerm() { 69sgml-catalog_pkg_prerm() {
54 72
55sgml-catalog_pkg_postrm() { 73sgml-catalog_pkg_postrm() {
56 debug-print function $FUNCNAME $* 74 debug-print function $FUNCNAME $*
57 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 75 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
58 76
59 for entry in ${SGML_TOINSTALL}; do 77 set -- "${SGML_TOINSTALL[@]}"
60 arg1=${entry%%:*} 78
61 arg2=${entry#*:} 79 while (( $# )); do
62 einfo "Now removing ${EPREFIX}${arg2} from ${EPREFIX}${arg1} and ${EPREFIX}/etc/sgml/catalog" 80 einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
63 sgml-catalog_cat_doremove ${arg1} ${arg2} 81 sgml-catalog_cat_doremove "$1" "$2"
82 shift 2
64 done 83 done
65} 84}
66 85
67sgml-catalog_cleanup() { 86sgml-catalog_cleanup() {
68 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= 87 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20