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

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

  ViewVC Help
Powered by ViewVC 1.1.20