/[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.9 Revision 1.12
1# Copyright 1999-2004 Gentoo Foundation 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.9 2004/10/19 19:51:12 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/sgml-catalog.eclass,v 1.12 2005/07/15 13:50:19 leonardop 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
13declare -a toinstall
14declare -i catcounter
15let "catcounter=0"
16 10
17sgml-catalog_cat_include() { 11sgml-catalog_cat_include() {
12 [ -z "${WORKDIR}" ] && return
13
14 local catalogdir="${WORKDIR}/catalogs"
15 local catalogfile="${catalogdir}/data"
16
18 debug-print function $FUNCNAME $* 17 debug-print function $FUNCNAME $*
19 toinstall["catcounter++"]="${1}:${2}" 18
19 [ ! -d "$catalogdir" ] && mkdir -p $catalogdir
20 echo "${1}:${2}" >> $catalogfile
20} 21}
21 22
22sgml-catalog_cat_doinstall() { 23sgml-catalog_cat_doinstall() {
23 debug-print function $FUNCNAME $* 24 debug-print function $FUNCNAME $*
24 /usr/bin/install-catalog --add $1 $2 &>/dev/null 25 /usr/bin/install-catalog --add $1 $2 &>/dev/null
25} 26}
26 27
27sgml-catalog_cat_doremove() { 28sgml-catalog_cat_doremove() {
28 debug-print function $FUNCNAME $* 29 debug-print function $FUNCNAME $*
29 /usr/bin/install-catalog --remove $1 $2 &>/dev/null 30 /usr/bin/install-catalog --remove $1 $2 &>/dev/null
30} 31}
31 32
32sgml-catalog_pkg_postinst() { 33sgml-catalog_pkg_postinst() {
34 local catalogdir="${WORKDIR}/catalogs"
35 local catalogfile="${catalogdir}/data"
36
33 debug-print function $FUNCNAME $* 37 debug-print function $FUNCNAME $*
34 declare -i topindex 38
35 topindex="catcounter-1" 39 local toinstall
36 for i in `seq 0 ${topindex}` 40 cat ${catalogfile} | while read toinstall
37 do 41 do
38 arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` 42 arg1=`echo ${toinstall} | cut -f1 -d\:`
39 arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` 43 arg2=`echo ${toinstall} | cut -f2 -d\:`
40 if [ ! -e $arg2 ] 44 if [ ! -e ${arg2} ]
41 then 45 then
42 ewarn "${arg2} doesn't appear to exist, although it ought to!" 46 ewarn "${arg2} doesn't appear to exist, although it ought to!"
43 continue 47 continue
44 fi 48 fi
45 einfo "Now adding $arg2 to $arg1 and /etc/sgml/catalog" 49 einfo "Now adding ${arg2} to ${arg1} and /etc/sgml/catalog"
46 sgml-catalog_cat_doinstall $arg1 $arg2 50 sgml-catalog_cat_doinstall ${arg1} ${arg2}
47 done 51 done
48 sgml-catalog_cleanup 52 sgml-catalog_cleanup
49} 53}
50 54
51sgml-catalog_pkg_prerm() { 55sgml-catalog_pkg_prerm() {
52 sgml-catalog_cleanup 56 sgml-catalog_cleanup
53} 57}
54 58
55sgml-catalog_pkg_postrm() { 59sgml-catalog_pkg_postrm() {
60 local catalogdir="${WORKDIR}/catalogs"
61 local catalogfile="${catalogdir}/data"
62
56 debug-print function $FUNCNAME $* 63 debug-print function $FUNCNAME $*
57 declare -i topindex 64
58 topindex="catcounter-1" 65 local toinstall
59 for i in `seq 0 ${topindex}` 66 cat ${catalogfile} | while read toinstall
60 do 67 do
61 arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` 68 arg1=`echo ${toinstall} | cut -f1 -d\:`
62 arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` 69 arg2=`echo ${toinstall} | cut -f2 -d\:`
63 if [ -e $arg2 ] 70 if [ -e ${arg2} ]
64 then 71 then
65 ewarn "${arg2} still exists! Not removing from ${arg1}" 72 ewarn "${arg2} still exists! Not removing from ${arg1}"
66 ewarn "This is normal behavior for an upgrade ..." 73 ewarn "This is normal behavior for an upgrade ..."
67 continue 74 continue
68 fi 75 fi
69 einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog" 76 einfo "Now removing $arg1 from $arg2 and /etc/sgml/catalog"
70 sgml-catalog_cat_doremove $arg1 $arg2 77 sgml-catalog_cat_doremove ${arg1} ${arg2}
71 done 78 done
72} 79}
73 80
74sgml-catalog_cleanup() { 81sgml-catalog_cleanup() {
75 if [ -e /usr/bin/gensgmlenv ] 82 if [ -e /usr/bin/gensgmlenv ]
76 then 83 then
77 einfo Regenerating SGML environment variables ... 84 einfo Regenerating SGML environment variables ...
78 gensgmlenv 85 gensgmlenv
79 grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite 86 grep -v export /etc/sgml/sgml.env > /etc/env.d/93sgmltools-lite
80 fi 87 fi
81} 88}
82 89
83sgml-catalog_src_compile() { 90sgml-catalog_src_compile() {
84 return 91 return
85} 92}
86 93
87EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm 94EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20