/[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.7 Revision 1.15
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2004 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.7 2004/04/10 13:02:38 usata Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.15 2010/05/13 21:38:11 darkside Exp $
4# 4#
5# Author Matthew Turk <satai@gentoo.org> 5# Author Matthew Turk <satai@gentoo.org>
6 6
7inherit base 7inherit base
8INHERITED="$INHERITED $ECLASS"
9 8
10DEPEND=">=app-text/sgml-common-0.6.3-r2" 9DEPEND=">=app-text/sgml-common-0.6.3-r2"
11ECLASS=sgml-catalog
12 10
13declare -a toinstall 11
14declare -i catcounter 12# List of catalogs to install
15let "catcounter=0" 13SGML_TOINSTALL=""
14
16 15
17sgml-catalog_cat_include() { 16sgml-catalog_cat_include() {
18 debug-print function $FUNCNAME $* 17 debug-print function $FUNCNAME $*
19 toinstall["catcounter++"]="${1}:${2}" 18 SGML_TOINSTALL="${SGML_TOINSTALL} ${1}:${2}"
20} 19}
21 20
22sgml-catalog_cat_doinstall() { 21sgml-catalog_cat_doinstall() {
23 debug-print function $FUNCNAME $* 22 debug-print function $FUNCNAME $*
24 /usr/bin/install-catalog --add $1 $2 &>/dev/null 23 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
24 "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}/$1" "${EPREFIX}/$2" &>/dev/null
25} 25}
26 26
27sgml-catalog_cat_doremove() { 27sgml-catalog_cat_doremove() {
28 debug-print function $FUNCNAME $* 28 debug-print function $FUNCNAME $*
29 /usr/bin/install-catalog --remove $1 $2 &>/dev/null 29 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
30 "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}/$1" "${EPREFIX}/$2" &>/dev/null
30} 31}
31 32
32sgml-catalog_pkg_postinst() { 33sgml-catalog_pkg_postinst() {
33 debug-print function $FUNCNAME $* 34 debug-print function $FUNCNAME $*
34 declare -i topindex 35 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
35 topindex="catcounter-1" 36
36 for i in `seq 0 ${topindex}` 37 for entry in ${SGML_TOINSTALL}; do
37 do 38 arg1=${entry%%:*}
38 arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` 39 arg2=${entry#*:}
39 arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` 40 if [ ! -e "${EPREFIX}"${arg2} ]
40 if [ ! -e $arg2 ] 41 then
41 then
42 ewarn "${arg2} doesn't appear to exist, although it ought to!" 42 ewarn "${EPREFIX}${arg2} doesn't appear to exist, although it ought to!"
43 continue 43 continue
44 fi 44 fi
45 einfo "Now adding $arg2 to $arg1 and /etc/sgml/catalog" 45 einfo "Now adding ${EPREFIX}${arg2} to ${EPREFIX}${arg1} and ${EPREFIX}/etc/sgml/catalog"
46 sgml-catalog_cat_doinstall $arg1 $arg2 46 sgml-catalog_cat_doinstall ${arg1} ${arg2}
47 done 47 done
48 sgml-catalog_cleanup 48 sgml-catalog_cleanup
49} 49}
50 50
51sgml-catalog_pkg_prerm() { 51sgml-catalog_pkg_prerm() {
52 sgml-catalog_cleanup 52 sgml-catalog_cleanup
53} 53}
54 54
55sgml-catalog_pkg_postrm() { 55sgml-catalog_pkg_postrm() {
56 debug-print function $FUNCNAME $* 56 debug-print function $FUNCNAME $*
57 declare -i topindex 57 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
58 topindex="catcounter-1" 58
59 for i in `seq 0 ${topindex}` 59 for entry in ${SGML_TOINSTALL}; do
60 do 60 arg1=${entry%%:*}
61 arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` 61 arg2=${entry#*:}
62 arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` 62 if [ -e "${EPREFIX}"${arg2} ]
63 if [ -e $arg2 ] 63 then
64 then
65 ewarn "${arg2} still exists! Not removing from ${arg1}" 64 ewarn "${EPREFIX}${arg2} still exists! Not removing from ${EPREFIX}${arg1}"
66 ewarn "This is normal behavior for an upgrade..." 65 ewarn "This is normal behavior for an upgrade ..."
67 continue 66 continue
68 fi 67 fi
69 einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" 68 einfo "Now removing ${EPREFIX}${arg1} from ${EPREFIX}${arg2} and ${EPREFIX}/etc/sgml/catalog"
70 sgml-catalog_cat_doremove $arg1 $arg2 69 sgml-catalog_cat_doremove ${arg1} ${arg2}
71 done 70 done
72} 71}
73 72
74sgml-catalog_cleanup() { 73sgml-catalog_cleanup() {
74 has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
75 if [ -e /usr/bin/gensgmlenv ] 75 if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
76 then 76 then
77 einfo Regenerating SGML environment variables... 77 einfo Regenerating SGML environment variables ...
78 gensgmlenv 78 gensgmlenv
79 grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite 79 grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
80 fi 80 fi
81} 81}
82 82
83sgml-catalog_src_compile() { 83sgml-catalog_src_compile() {
84 return 84 return
85} 85}
86 86
87EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm 87EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20