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

Contents of /eclass/sgml-catalog.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (hide annotations) (download)
Fri Mar 23 07:30:54 2012 UTC (2 years, 8 months ago) by floppym
Branch: MAIN
Changes since 1.18: +40 -21 lines
Convert SGML_TOINSTALL to a bash array. Add some documentation.

1 floppym 1.18 # Copyright 1999-2012 Gentoo Foundation
2 satai 1.1 # Distributed under the terms of the GNU General Public License v2
3 floppym 1.19 # $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.18 2012/03/23 06:16:15 floppym Exp $
4    
5     # @ECLASS: sgml-catalog.eclass
6     # @MAINTAINER:
7     # SGML Herd <sgml@gentoo.org>
8     # @AUTHOR:
9 satai 1.1 # Author Matthew Turk <satai@gentoo.org>
10 floppym 1.19 # @BLURB: Functions for installing SGML catalogs
11 satai 1.1
12     inherit base
13    
14 usata 1.7 DEPEND=">=app-text/sgml-common-0.6.3-r2"
15 satai 1.1
16 floppym 1.19 # @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.
20     SGML_TOINSTALL=()
21    
22     # @FUNCTION: sgml-catalog_cat_include
23     # @USAGE: <centralized catalog> <ordinary catalog>
24     # @DESCRIPTION:
25     # Appends a catalog pair to the SGML_TOINSTALL array.
26 leonardop 1.12 sgml-catalog_cat_include() {
27 swegener 1.11 debug-print function $FUNCNAME $*
28 floppym 1.19 SGML_TOINSTALL+=("$1" "$2")
29 satai 1.1 }
30    
31 floppym 1.19 # @FUNCTION: sgml-catalog_cat_doinstall
32     # @USAGE: <centralized catalog> <ordinary catalog>
33     # @DESCRIPTION:
34     # Adds an ordinary catalog to a centralized catalog.
35 satai 1.1 sgml-catalog_cat_doinstall() {
36 swegener 1.11 debug-print function $FUNCNAME $*
37 darkside 1.15 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
38 abcd 1.16 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
39 satai 1.1 }
40    
41 floppym 1.19 # @FUNCTION: sgml-catalog_cat_doremove
42     # @USAGE: <centralized catalog> <ordinary catalog>
43     # @DESCRIPTION:
44     # Removes an ordinary catalog from a centralized catalog.
45 satai 1.1 sgml-catalog_cat_doremove() {
46 swegener 1.11 debug-print function $FUNCNAME $*
47 darkside 1.15 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
48 abcd 1.16 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
49 satai 1.1 }
50    
51     sgml-catalog_pkg_postinst() {
52 swegener 1.11 debug-print function $FUNCNAME $*
53 darkside 1.15 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
54 leonardop 1.14
55 floppym 1.19 set -- "${SGML_TOINSTALL[@]}"
56    
57     while (( $# )); do
58     if [[ ! -e "${EPREFIX}$2" ]]; then
59     ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
60 swegener 1.11 continue
61     fi
62 floppym 1.19 einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
63     sgml-catalog_cat_doinstall "$1" "$2"
64     shift 2
65 swegener 1.11 done
66     sgml-catalog_cleanup
67 satai 1.3 }
68    
69     sgml-catalog_pkg_prerm() {
70 swegener 1.11 sgml-catalog_cleanup
71 satai 1.1 }
72    
73 satai 1.2 sgml-catalog_pkg_postrm() {
74 swegener 1.11 debug-print function $FUNCNAME $*
75 darkside 1.15 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
76 leonardop 1.14
77 floppym 1.19 set -- "${SGML_TOINSTALL[@]}"
78    
79     while (( $# )); do
80     einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
81     sgml-catalog_cat_doremove "$1" "$2"
82     shift 2
83 swegener 1.11 done
84 satai 1.1 }
85    
86 satai 1.3 sgml-catalog_cleanup() {
87 darkside 1.15 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
88     if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
89 swegener 1.11 then
90     einfo Regenerating SGML environment variables ...
91     gensgmlenv
92 darkside 1.15 grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
93 swegener 1.11 fi
94 satai 1.3 }
95    
96 satai 1.1 sgml-catalog_src_compile() {
97 swegener 1.11 return
98 satai 1.1 }
99    
100 satai 1.3 EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm

  ViewVC Help
Powered by ViewVC 1.1.20