/[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.11 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.11 2005/07/11 15:08:06 swegener 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
8 8
9DEPEND=">=app-text/sgml-common-0.6.3-r2" 9DEPEND=">=app-text/sgml-common-0.6.3-r2"
10 10
11declare -a toinstall 11sgml-catalog_cat_include() {
12declare -i catcounter 12 [ -z "${WORKDIR}" ] && return
13let "catcounter=0"
14 13
15sgml-catalog_cat_include() { 14 local catalogdir="${WORKDIR}/catalogs"
15 local catalogfile="${catalogdir}/data"
16
16 debug-print function $FUNCNAME $* 17 debug-print function $FUNCNAME $*
17 toinstall["catcounter++"]="${1}:${2}" 18
19 [ ! -d "$catalogdir" ] && mkdir -p $catalogdir
20 echo "${1}:${2}" >> $catalogfile
18} 21}
19 22
20sgml-catalog_cat_doinstall() { 23sgml-catalog_cat_doinstall() {
21 debug-print function $FUNCNAME $* 24 debug-print function $FUNCNAME $*
22 /usr/bin/install-catalog --add $1 $2 &>/dev/null 25 /usr/bin/install-catalog --add $1 $2 &>/dev/null
26 debug-print function $FUNCNAME $* 29 debug-print function $FUNCNAME $*
27 /usr/bin/install-catalog --remove $1 $2 &>/dev/null 30 /usr/bin/install-catalog --remove $1 $2 &>/dev/null
28} 31}
29 32
30sgml-catalog_pkg_postinst() { 33sgml-catalog_pkg_postinst() {
34 local catalogdir="${WORKDIR}/catalogs"
35 local catalogfile="${catalogdir}/data"
36
31 debug-print function $FUNCNAME $* 37 debug-print function $FUNCNAME $*
32 declare -i topindex 38
33 topindex="catcounter-1" 39 local toinstall
34 for i in `seq 0 ${topindex}` 40 cat ${catalogfile} | while read toinstall
35 do 41 do
36 arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` 42 arg1=`echo ${toinstall} | cut -f1 -d\:`
37 arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` 43 arg2=`echo ${toinstall} | cut -f2 -d\:`
38 if [ ! -e ${arg2} ] 44 if [ ! -e ${arg2} ]
39 then 45 then
40 ewarn "${arg2} doesn't appear to exist, although it ought to!" 46 ewarn "${arg2} doesn't appear to exist, although it ought to!"
41 continue 47 continue
42 fi 48 fi
49sgml-catalog_pkg_prerm() { 55sgml-catalog_pkg_prerm() {
50 sgml-catalog_cleanup 56 sgml-catalog_cleanup
51} 57}
52 58
53sgml-catalog_pkg_postrm() { 59sgml-catalog_pkg_postrm() {
60 local catalogdir="${WORKDIR}/catalogs"
61 local catalogfile="${catalogdir}/data"
62
54 debug-print function $FUNCNAME $* 63 debug-print function $FUNCNAME $*
55 declare -i topindex 64
56 topindex="catcounter-1" 65 local toinstall
57 for i in `seq 0 ${topindex}` 66 cat ${catalogfile} | while read toinstall
58 do 67 do
59 arg1=`echo ${toinstall[$i]} | cut -f1 -d\:` 68 arg1=`echo ${toinstall} | cut -f1 -d\:`
60 arg2=`echo ${toinstall[$i]} | cut -f2 -d\:` 69 arg2=`echo ${toinstall} | cut -f2 -d\:`
61 if [ -e ${arg2} ] 70 if [ -e ${arg2} ]
62 then 71 then
63 ewarn "${arg2} still exists! Not removing from ${arg1}" 72 ewarn "${arg2} still exists! Not removing from ${arg1}"
64 ewarn "This is normal behavior for an upgrade ..." 73 ewarn "This is normal behavior for an upgrade ..."
65 continue 74 continue

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

  ViewVC Help
Powered by ViewVC 1.1.20