/[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.1.1.1 Revision 1.20
1# Copyright 1999-2004 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.1.1.1 2005/11/30 09:59:19 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.20 2012/04/29 23:25:05 flameeyes 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 /usr/bin/install-catalog --add $1 $2 &>/dev/null 37 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
38 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
24} 39}
25 40
41# @FUNCTION: sgml-catalog_cat_doremove
42# @USAGE: <centralized catalog> <ordinary catalog>
43# @DESCRIPTION:
44# Removes an ordinary catalog from a centralized catalog.
26sgml-catalog_cat_doremove() { 45sgml-catalog_cat_doremove() {
27 debug-print function $FUNCNAME $* 46 debug-print function $FUNCNAME $*
28 /usr/bin/install-catalog --remove $1 $2 &>/dev/null 47 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
48 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
29} 49}
30 50
31sgml-catalog_pkg_postinst() { 51sgml-catalog_pkg_postinst() {
32 debug-print function $FUNCNAME $* 52 debug-print function $FUNCNAME $*
53 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
33 54
34 for entry in ${SGML_TOINSTALL}; do 55 set -- "${SGML_TOINSTALL[@]}"
35 arg1=`echo ${entry} | cut -f1 -d\:` 56
36 arg2=`echo ${entry} | cut -f2 -d\:` 57 while (( $# )); do
37 if [ ! -e ${arg2} ] 58 if [[ ! -e "${EPREFIX}$2" ]]; then
38 then
39 ewarn "${arg2} doesn't appear to exist, although it ought to!" 59 ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
60 shift 2
40 continue 61 continue
41 fi 62 fi
42 einfo "Now adding ${arg2} to ${arg1} and /etc/sgml/catalog" 63 einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
43 sgml-catalog_cat_doinstall ${arg1} ${arg2} 64 sgml-catalog_cat_doinstall "$1" "$2"
65 shift 2
44 done 66 done
45 sgml-catalog_cleanup 67 sgml-catalog_cleanup
46} 68}
47 69
48sgml-catalog_pkg_prerm() { 70sgml-catalog_pkg_prerm() {
49 sgml-catalog_cleanup 71 sgml-catalog_cleanup
50} 72}
51 73
52sgml-catalog_pkg_postrm() { 74sgml-catalog_pkg_postrm() {
53 debug-print function $FUNCNAME $* 75 debug-print function $FUNCNAME $*
76 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
54 77
55 for entry in ${SGML_TOINSTALL}; do 78 set -- "${SGML_TOINSTALL[@]}"
56 arg1=`echo ${entry} | cut -f1 -d\:` 79
57 arg2=`echo ${entry} | cut -f2 -d\:` 80 while (( $# )); do
58 if [ -e ${arg2} ] 81 einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
59 then
60 ewarn "${arg2} still exists! Not removing from ${arg1}"
61 ewarn "This is normal behavior for an upgrade ..."
62 continue
63 fi
64 einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog"
65 sgml-catalog_cat_doremove ${arg1} ${arg2} 82 sgml-catalog_cat_doremove "$1" "$2"
83 shift 2
66 done 84 done
67} 85}
68 86
69sgml-catalog_cleanup() { 87sgml-catalog_cleanup() {
88 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
70 if [ -e /usr/bin/gensgmlenv ] 89 if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
71 then 90 then
72 einfo Regenerating SGML environment variables ... 91 einfo Regenerating SGML environment variables ...
73 gensgmlenv 92 gensgmlenv
74 grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite 93 grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
75 fi 94 fi
76} 95}
77 96
78sgml-catalog_src_compile() { 97sgml-catalog_src_compile() {
79 return 98 return

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.20

  ViewVC Help
Powered by ViewVC 1.1.20