46e99a19beb736e497754af40172c20bf820fcfb
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

1) # Copyright 1999-2006 Gentoo Foundation
2) # Distributed under the terms of the GNU General Public License v2
3) # $Header: $
4) 
5) #
6) # Original Author: Lars Strojny <lars@strojny.net>
7) # Purpose: Providing macros to handle installation and setup of the py-transport
8) # family
9) #
10) 
Lars Strojny D net-im/pyicq-t/files/p...

Lars Strojny authored 17 years ago

11) 
12) PYTRANSPORT_LIB_DIR=${PYTRANSPORT_LIB_DIR:=tools data src}
13) 
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

14) inherit eutils python
15) 
16) ECLASS="pytransport"
17) INHERITED="$INHERITED $ECLASS"
18) 
Lars Strojny x

Lars Strojny authored 17 years ago

19) EXPORT_FUNCTIONS src_install pkg_postinst
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

20) 
21) LICENSE="GPL-2"
22) 
23) pytransport_is_subversion() {
Lars Strojny x

Lars Strojny authored 17 years ago

24) 	[[ "${PV}" = 9999 ]] && return 0 || return 1
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

25) }
26) 
27) pytransport_is_subversion && S=${WORKDIR}/${PN}
28) 
29) 
30) if pytransport_is_subversion; then
31) 	inherit subversion
Lars Strojny x

Lars Strojny authored 17 years ago

32) 	[ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="http://svn.blathersource.org/${PN}/trunk"
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

33) 	SRC_URI=""
34) else
Lars Strojny x

Lars Strojny authored 17 years ago

35) 	SRC_URI="http://www.blathersource.org/download.php/${PN}/${P}.tar.gz"
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

36) fi
37) 
Lars Strojny x

Lars Strojny authored 17 years ago

38) HOMEPAGE="http://${PN}.blathersource.org/"
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

39) 
40) DEPEND=">=net-im/jabber-base-0.0
41) 	>=dev-lang/python-2.3"
42) 	
Lars Strojny x

Lars Strojny authored 17 years ago

43) RDEPEND="<dev-python/twisted-2.4
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

44) 	>=dev-python/twisted-words-0.1.0
Lars Strojny Upgrade to ejabberd-1.1.3

Lars Strojny authored 17 years ago

45) 	<dev-python/twisted-words-0.4
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

46) 	>=dev-python/twisted-xish-0.1.0
Lars Strojny Upgrade to ejabberd-1.1.3

Lars Strojny authored 17 years ago

47) 	=dev-python/twisted-web-0.5*
48) 	<dev-python/nevow-0.8
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

49) 	>=dev-python/imaging-1.1"
50) 
51) 
Lars Strojny x

Lars Strojny authored 17 years ago

52) PYTRANSPORT_CONFIG=config_example.xml
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

53) 
54) # Create the minimal token name from the package name
55) #
56) # Example: pyicq-t-svn
57) #
58) pytransport_get_human_name() {
Lars Strojny x

Lars Strojny authored 17 years ago

59) 	echo "${PN}" \
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

60) 		| sed -e "s:^py\([a-z]*\)-t$:\1:g" \
61) 		| tr [:lower:] [:upper:]
62) }
63) 
64) #
65) # Guess the script name
66) #
67) pytransport_get_script_name() {
68) 	echo "Py$(pytransport_get_human_name ${PN})t.py"
69) }
70) 
Lars Strojny x

Lars Strojny authored 17 years ago

71) #
72) # Adjust configuration file defaults
73) #
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

74) pytransport_adjust_configfile() {
75) 	local configfile="$1"
76) 	dosed \
77) 		"s:<spooldir>[^\<]*</spooldir>:<spooldir>/var/spool/jabber/</spooldir>:" \
78) 		"${configfile}" || die "Could not sed ${configfile}"
79) 	dosed \
80) 		"s:<pid>[^\<]*</pid>:<pid>/var/run/jabber/${PN}.pid</pid>:" \
81) 		"${configfile}" || die "Could not sed ${configfile}"
82) 	return 0
83) }
84) 
Lars Strojny x

Lars Strojny authored 17 years ago

85) #
86) # Get python version
87) #
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

88) pytransport_get_python_version() {
89) 	[ -z "${PYVER}" ] && python_version
90) 	echo "${PYVER}"
91) }
92) 
Lars Strojny x

Lars Strojny authored 17 years ago

93) #
94) # Install transport libraries
95) #
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

96) pytransport_install_libs() {
97) 	insinto /usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/
Lars Strojny D net-im/pyicq-t/files/p...

Lars Strojny authored 17 years ago

98) 	doins -r ${PYTRANSPORT_LIB_DIR} || \
99) 		die "Could not install library"
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

100) 	newins $(pytransport_get_script_name) ${PN}.py || \
101) 		die "Could not find initial .py-scripts"
102) 	return 0
103) }
104) 
Lars Strojny x

Lars Strojny authored 17 years ago

105) #
106) # Install configuration
107) #
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

108) pytransport_install_config() {
109) 	insinto /etc/jabber
110) 	newins "${PYTRANSPORT_CONFIG}" ${PN}.xml
111) 	fperms 600 /etc/jabber/${PN}.xml || die "Could not adjust perms"
Lars Strojny x

Lars Strojny authored 17 years ago

112) 	pytransport_adjust_configfile /etc/jabber/${PN}.xml || die "Could not adjust config"
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

113) 	fowners jabber:jabber /etc/jabber/${PN}.xml || die "Could not adjust perms"
114) 	return 0
115) }
116) 
Lars Strojny x

Lars Strojny authored 17 years ago

117) #
118) # Generate init.d-script
119) #
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

120) pytransport_generate_initd() {
121) 	pytransport_is_subversion && local suffix=" (Subversion)"
Lars Strojny M eclass/pytransport.ecl...

Lars Strojny authored 17 years ago

122) 	echo "#!/sbin/runscript
123) 
124) 
125) depend() {
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

126) 	need net
127) 	use jabber-server
128) }
129) 
130) start() {
131) 	ebegin \"Starting $(pytransport_get_human_name) Jabber Transport${suffix}\"
132) 	start-stop-daemon --start --quiet \\
133) 	--background --name \"${PN}\" --chuid jabber:jabber \\
134) 		--exec /usr/bin/softlimit -- -r 100000 \\
135) 		/usr/bin/python$(pytransport_get_python_version) \\
136) 		/usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/${PN}.py \\
137) 		-c /etc/jabber/${PN}.xml \\
138) 		-l /var/log/jabber/${PN}.log
Lars Strojny x

Lars Strojny authored 17 years ago

139) 	eend 0
Lars Strojny M net-im/pyaim-t/Manifes...

Lars Strojny authored 17 years ago

140) }
141) 
142) stop() {
143) 	ebegin \"Stopping $(pytransport_get_human_name) Jabber Transport${suffix}\"
144) 	start-stop-daemon --stop --quiet --pidfile /var/run/jabber/pyicq-t-svn.pid
145) 	sleep 3
146) 	eend \$?
147) }"
148) }
149) 
Lars Strojny x

Lars Strojny authored 17 years ago

150) #
151) # Exported install function
152) #