Lars Strojny

Lars Strojny commited on 2007-03-18 20:02:54
Zeige 1 geänderte Dateien mit 28 Einfügungen und 31 Löschungen.

... ...
@@ -16,59 +16,47 @@ inherit eutils python
16 16
 ECLASS="pytransport"
17 17
 INHERITED="$INHERITED $ECLASS"
18 18
 
19
-EXPORT_FUNCTIONS src_install src_unpack pkg_postinst
20
-
21
-MY_PN=${PN/-svn/}
22
-MY_PV=${PV}
23
-MY_P=${MY_PN}-${MY_PV}
24
-
19
+EXPORT_FUNCTIONS src_install pkg_postinst
25 20
 
26 21
 LICENSE="GPL-2"
27 22
 
28
-
29
-
30 23
 pytransport_is_subversion() {
31
-	[[ "${PN}" =~ "^py[a-z]+-t-svn$" ]] && return 0 || return 1
24
+	[[ "${PV}" = 9999 ]] && return 0 || return 1
32 25
 }
33 26
 
34
-
35 27
 pytransport_is_subversion && S=${WORKDIR}/${PN}
36 28
 
37 29
 
38
-
39 30
 if pytransport_is_subversion; then
40 31
 	inherit subversion
41
-	[ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="http://svn.blathersource.org/${MY_PN}/trunk"
32
+	[ -z "${ESVN_REPO_URI}" ] && ESVN_REPO_URI="http://svn.blathersource.org/${PN}/trunk"
42 33
 	SRC_URI=""
43 34
 else
44
-	SRC_URI="http://www.blathersource.org/download.php/${PN}/${MY_P}.tar.gz"
35
+	SRC_URI="http://www.blathersource.org/download.php/${PN}/${P}.tar.gz"
45 36
 fi
46 37
 
47
-HOMEPAGE="http://${MY_PN}.blathersource.org/"
38
+HOMEPAGE="http://${PN}.blathersource.org/"
48 39
 
49 40
 DEPEND=">=net-im/jabber-base-0.0
50 41
 	>=dev-lang/python-2.3"
51 42
 	
52
-RDEPEND=">=dev-python/twisted-1.3.0
43
+RDEPEND="<dev-python/twisted-2.4
53 44
 	>=dev-python/twisted-words-0.1.0
54 45
 	<dev-python/twisted-words-0.4
55 46
 	>=dev-python/twisted-xish-0.1.0
56 47
 	=dev-python/twisted-web-0.5*
57
-	>=dev-python/nevow-0.4.1
58 48
 	<dev-python/nevow-0.8
59 49
 	>=dev-python/imaging-1.1"
60 50
 
61
-PYTRANSPORT_CONFIG=config_example.xml
62
-
63
-
64 51
 
52
+PYTRANSPORT_CONFIG=config_example.xml
65 53
 
66 54
 # Create the minimal token name from the package name
67 55
 #
68 56
 # Example: pyicq-t-svn
69 57
 #
70 58
 pytransport_get_human_name() {
71
-	echo "${MY_PN}" \
59
+	echo "${PN}" \
72 60
 		| sed -e "s:^py\([a-z]*\)-t$:\1:g" \
73 61
 		| tr [:lower:] [:upper:]
74 62
 }
... ...
@@ -82,7 +68,9 @@ pytransport_get_script_name() {
82 68
 	echo "Py$(pytransport_get_human_name ${PN})t.py"
83 69
 }
84 70
 
85
-
71
+#
72
+# Adjust configuration file defaults
73
+#
86 74
 pytransport_adjust_configfile() {
87 75
 	local configfile="$1"
88 76
 	dosed \
... ...
@@ -94,11 +82,17 @@ pytransport_adjust_configfile() {
94 82
 	return 0
95 83
 }
96 84
 
85
+#
86
+# Get python version
87
+#
97 88
 pytransport_get_python_version() {
98 89
 	[ -z "${PYVER}" ] && python_version
99 90
 	echo "${PYVER}"
100 91
 }
101 92
 
93
+#
94
+# Install transport libraries
95
+#
102 96
 pytransport_install_libs() {
103 97
 	insinto /usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/
104 98
 	doins -r ${PYTRANSPORT_LIB_DIR} || \
... ...
@@ -108,15 +102,21 @@ pytransport_install_libs() {
108 102
 	return 0
109 103
 }
110 104
 
111
-
105
+#
106
+# Install configuration
107
+#
112 108
 pytransport_install_config() {
113 109
 	insinto /etc/jabber
114 110
 	newins "${PYTRANSPORT_CONFIG}" ${PN}.xml
115 111
 	fperms 600 /etc/jabber/${PN}.xml || die "Could not adjust perms"
112
+	pytransport_adjust_configfile /etc/jabber/${PN}.xml || die "Could not adjust config"
116 113
 	fowners jabber:jabber /etc/jabber/${PN}.xml || die "Could not adjust perms"
117 114
 	return 0
118 115
 }
119 116
 
117
+#
118
+# Generate init.d-script
119
+#
120 120
 pytransport_generate_initd() {
121 121
 	pytransport_is_subversion && local suffix=" (Subversion)"
122 122
 	echo "#!/sbin/runscript
... ...
@@ -136,7 +136,7 @@ start() {
136 136
 		/usr/lib/python$(pytransport_get_python_version)/site-packages/${PN}/${PN}.py \\
137 137
 		-c /etc/jabber/${PN}.xml \\
138 138
 		-l /var/log/jabber/${PN}.log
139
-	eend \$?
139
+	eend 0
140 140
 }
141 141
 
142 142
 stop() {
... ...
@@ -147,14 +147,9 @@ stop() {
147 147
 }"
148 148
 }
149 149
 
150
-pytransport_src_unpack() {
151
-	if pytransport_is_subversion; then
152
-		subversion_src_unpack || die
153
-	else
154
-		unpack ${A}
155
-	fi
156
-}
157
-
150
+#
151
+# Exported install function
152
+#
158 153
 pytransport_src_install() {
159 154
 	einfo "Installing library files ..."
160 155
 	pytransport_install_libs || die "Failed installing libs"
161 156