/[gentoo-alt]/trunk/prefix/eclass/zproduct.eclass
Gentoo

Contents of /trunk/prefix/eclass/zproduct.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (show annotations) (download)
Thu Feb 2 04:20:17 2006 UTC (13 years, 2 months ago) by kito
File size: 4532 byte(s)
Initial eclass import from gentoo-x86
1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/zproduct.eclass,v 1.21 2005/07/11 15:08:07 swegener Exp $
4 # Author: Jason Shoemaker <kutsuya@gentoo.org>
5
6 # This eclass is designed to streamline the construction of
7 # ebuilds for new zope products
8
9 EXPORT_FUNCTIONS src_install pkg_prerm pkg_postinst pkg_config
10
11 DESCRIPTION="This is a zope product"
12 #HOMEPAGE=""
13 #SRC_URI=""
14
15 RDEPEND=">=net-zope/zope-2.6.0-r2
16 app-admin/zprod-manager"
17
18 IUSE=""
19 SLOT="0"
20 KEYWORDS="x86 ~ppc"
21 S=${WORKDIR}
22
23 ZI_DIR="${ROOT}/var/lib/zope/"
24 ZP_DIR="${ROOT}/usr/share/zproduct"
25 DOT_ZFOLDER_FPATH="${ZP_DIR}/${PF}/.zfolder.lst"
26
27 zproduct_src_install()
28 {
29 ## Assume that folders or files that shouldn't be installed
30 # in the zproduct directory have been already been removed.
31 ## Assume $S set to the parent directory of the zproduct(s).
32
33 debug-print-function ${FUNCNAME} ${*}
34 [ -n "${ZPROD_LIST}" ] || die "ZPROD_LIST isn't defined."
35 [ -z "${1}" ] && zproduct_src_install all
36
37 # set defaults
38 into ${ZP_DIR}
39 dodir ${ZP_DIR}/${PF}
40
41 while [ -n "$1" ] ; do
42 case ${1} in
43 do_zpfolders)
44 ## Create .zfolders.lst from $ZPROD_LIST.
45 debug-print-section do_zpfolders
46 for N in ${ZPROD_LIST} ; do
47 echo ${N} >> ${D}/${DOT_ZFOLDER_FPATH}
48 done
49 ;;
50 do_docs)
51 #*Moves txt docs
52 debug-print-section do_docs
53 docs_move
54 for ZPROD in ${ZPROD_LIST} ; do
55 docs_move ${ZPROD}/
56 done
57 ;;
58 do_install)
59 debug-print-section do_install
60 # Copy everything that's left to ${D}${ZP_DIR}
61 # modified to not copy ownership (QA)
62 cp --recursive --no-dereference --preserve=timestamps,mode,links ${S}/* ${D}/${ZP_DIR}/${PF}
63 ;;
64 all)
65 debug-print-section all
66 zproduct_src_install do_zpfolders do_docs do_install ;;
67 esac
68 shift
69 done
70 debug-print "${FUNCNAME}: result is ${RESULT}"
71 }
72
73 docs_move()
74 {
75 # if $1 == "/", then this breaks.
76 if [ -n "$1" ] ; then
77 docinto $1
78 else
79 docinto /
80 fi
81 dodoc $1HISTORY.txt $1README{.txt,} $1INSTALL{.txt,} > /dev/null
82 dodoc $1AUTHORS $1COPYING $1CREDITS.txt $1TODO{.txt,} > /dev/null
83 dodoc $1LICENSE{.GPL,.txt,} $1CHANGES{.txt,} > /dev/null
84 dodoc $1DEPENDENCIES.txt $1FAQ.txt $1UPGRADE.txt > /dev/null
85 for item in ${MYDOC} ; do
86 dodoc ${1}${item} > /dev/null
87 done
88 }
89
90 zproduct_pkg_postinst()
91 {
92 #*check for multiple zinstances, if several display install help msg.
93
94 #*Use zprod-update to install this zproduct to the default zinstance.
95 debug-print-function ${FUNCNAME} ${*}
96
97 # this is a shared directory, so root should be owner;
98 # zprod-manager or whatever is used to copy products into the
99 # instances has to take care of setting the right permissions in
100 # the target directory
101
102 chown -R root:root ${ZP_DIR}/${PF}
103 # make shure there is nothing writable in the new dir, and all is readable
104 chmod -R go-w,a+rX ${ZP_DIR}/${PF}
105 einfo ">>> Installing ${PF} into the \"$(zope-config --zidef-get)\" zinstance ..."
106 ${ROOT}/usr/sbin/zprod-manager add ${ZP_DIR}/${PF}
107 }
108
109 # This function is deprecated! Still used, until a new system developed.
110
111 zproduct_pkg_prerm()
112 {
113 # remove this zproduct from all zinstances.
114 # process zinstance.lst and proceed with zprod-update del
115 debug-print-function ${FUNCNAME} ${*}
116 ZINST_LST=$(ls /var/lib/zope/)
117 if [ "${ZINST_LST}" ] ; then
118 # first check and warn on any installed products into instances
119 ARE_INSTALLED=0
120 for N in ${ZINST_LST} ; do
121 if [ -s $DOT_ZFOLDER_FPATH ]
122 then
123 # check only if installed product has non empty folder lists
124 #
125 # for every fodler inside product ...
126 for PFOLD in `cat $DOT_ZFOLDER_FPATH`
127 do
128 # ... check if its in instance.
129 if [ -d "${ZI_DIR}${N}/Products/${PFOLD}" ]
130 then
131 ARE_INSTALLED=$[ARE_INSTALLED + 1]
132 fi
133 done
134 fi
135 done
136 # Info and wait ...
137 if [ $ARE_INSTALLED -gt 0 ]
138 then
139 #TODO: should use ebeep and epause, but i got some inheritance errors on eutils
140 #so as for now i use local version. in futuure we should inherit ueilts
141 ewarn "Detected at least $ARE_INSTALLED copies of product being removed."
142 ewarn "Sleeping 10seconds, please use CTRL+C to abort!"
143 echo -ne "\a"
144 sleep 10
145 fi
146
147 ewarn "Uninstalling from all zinstances ..."
148 for N in ${ZINST_LST} ; do
149 ${ROOT}/usr/sbin/zprod-manager del ${ZP_DIR}/${PF} ${ZI_DIR}${N}
150 done
151 fi
152 }
153
154 # Add this zproduct to the top zinstance.
155
156 zproduct_pkg_config()
157 {
158 einfo "To add zproducts to other zinstances execute:"
159 einfo "\tzprod-manager add"
160 }

  ViewVC Help
Powered by ViewVC 1.1.20