/[gentoo-x86]/eclass/zproduct.eclass
Gentoo

Contents of /eclass/zproduct.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (show annotations) (download)
Tue Dec 27 17:55:13 2011 UTC (2 years, 9 months ago) by fauli
Branch: MAIN
CVS Tags: HEAD
Changes since 1.27: +2 -2 lines
Update copyright years in headers

1 # Copyright 1999-2011 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.27 2009/02/26 14:25:44 tupone 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
13 RDEPEND="net-zope/zope
14 app-admin/zprod-manager"
15
16 IUSE=""
17 SLOT="0"
18 S=${WORKDIR}
19
20 ZI_DIR="${ROOT}/var/lib/zope/"
21 ZP_DIR="${ROOT}/usr/share/zproduct"
22 DOT_ZFOLDER_FPATH="${ZP_DIR}/${PF}/.zfolder.lst"
23
24 zproduct_src_install() {
25 ## Assume that folders or files that shouldn't be installed
26 # in the zproduct directory have been already been removed.
27 ## Assume $S set to the parent directory of the zproduct(s).
28
29 debug-print-function ${FUNCNAME} ${*}
30 [ -n "${ZPROD_LIST}" ] || die "ZPROD_LIST isn't defined."
31 [ -z "${1}" ] && zproduct_src_install all
32
33 # set defaults
34 into ${ZP_DIR}
35 dodir ${ZP_DIR}/${PF}
36
37 while [ -n "$1" ] ; do
38 case ${1} in
39 do_zpfolders)
40 ## Create .zfolders.lst from $ZPROD_LIST.
41 debug-print-section do_zpfolders
42 for N in ${ZPROD_LIST} ; do
43 echo ${N} >> "${D}"/${DOT_ZFOLDER_FPATH}
44 done
45 ;;
46 do_docs)
47 #*Moves txt docs
48 debug-print-section do_docs
49 docs_move
50 for ZPROD in ${ZPROD_LIST} ; do
51 docs_move ${ZPROD}/
52 done
53 ;;
54 do_install)
55 debug-print-section do_install
56 # Copy everything that's left to ${D}${ZP_DIR}
57 # modified to not copy ownership (QA)
58 cp --recursive --no-dereference --preserve=timestamps,mode,links "${S}"/* "${D}"/${ZP_DIR}/${PF}
59 ;;
60 all)
61 debug-print-section all
62 zproduct_src_install do_zpfolders do_docs do_install ;;
63 esac
64 shift
65 done
66 debug-print "${FUNCNAME}: result is ${RESULT}"
67 }
68
69 docs_move() {
70 # if $1 == "/", then this breaks.
71 if [ -n "$1" ] ; then
72 docinto $1
73 else
74 docinto /
75 fi
76 dodoc $1HISTORY.txt $1README{.txt,} $1INSTALL{.txt,} > /dev/null 2>/dev/null
77 dodoc $1AUTHORS $1COPYING $1CREDITS.txt $1TODO{.txt,} > /dev/null 2>/dev/null
78 dodoc $1LICENSE{.GPL,.txt,} $1CHANGES{.txt,} > /dev/null 2>/dev/null
79 dodoc $1DEPENDENCIES.txt $1FAQ.txt $1UPGRADE.txt > /dev/null 2>/dev/null
80 for item in ${MYDOC} ; do
81 dodoc ${1}${item} > /dev/null 2>/dev/null
82 done
83 }
84
85 zproduct_pkg_postinst() {
86 #*check for multiple zinstances, if several display install help msg.
87
88 #*Use zprod-update to install this zproduct to the default zinstance.
89 debug-print-function ${FUNCNAME} ${*}
90
91 # this is a shared directory, so root should be owner;
92 # zprod-manager or whatever is used to copy products into the
93 # instances has to take care of setting the right permissions in
94 # the target directory
95
96 chown -R root:root ${ZP_DIR}/${PF}
97 # make shure there is nothing writable in the new dir, and all is readable
98 chmod -R go-w,a+rX ${ZP_DIR}/${PF}
99
100 einfo "Attention: ${PF} was not installed in any instance! Use 'zprod-manager add'"
101 #disabled by radek@20061228 - contact me in case of any question!
102 #${ROOT}/usr/sbin/zprod-manager add ${ZP_DIR}/${PF}
103 }
104
105 zproduct_pkg_prerm() {
106 # checks how many times product is installed and informs about it
107 # it does not remove it (change in behaviour done by radek@20061228)
108 debug-print-function ${FUNCNAME} ${*}
109 ZINST_LST=$(ls /var/lib/zope/)
110 if [ "${ZINST_LST}" ] ; then
111 # first check and warn on any installed products into instances
112 ARE_INSTALLED=0
113 for N in ${ZINST_LST} ; do
114 if [ -s $DOT_ZFOLDER_FPATH ]
115 then
116 # check only if installed product has non empty folder lists
117 #
118 # for every fodler inside product ...
119 for PFOLD in `cat $DOT_ZFOLDER_FPATH`
120 do
121 # ... check if its in instance.
122 if [ -d "${ZI_DIR}${N}/Products/${PFOLD}" ]
123 then
124 ARE_INSTALLED=$[ARE_INSTALLED + 1]
125 fi
126 done
127 fi
128 done
129 if [ $ARE_INSTALLED -gt 0 ]
130 then
131 ewarn "Detected at least $ARE_INSTALLED copies of product being unmerged."
132 ewarn "Please manually remove it from instances using 'zprod-manager del'"
133 ewarn "Product is removed from ${ZP_DIR} but not from instances!"
134 fi
135 fi
136 }
137
138 zproduct_pkg_config() {
139 einfo "To add zproducts to zope instances use:"
140 einfo "\tzprod-manager add"
141 }

  ViewVC Help
Powered by ViewVC 1.1.20