rt.spec 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. ##
  2. ## rt.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2003 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # FIXME: rse: Error: MM: mm:core: failed to open semaphore file (Permission denied): OS: No such file or directory
  26. # package versions
  27. %define V_real 3-0-6
  28. %define V_here 3.0.6
  29. %define V_log_dispatch 2.04
  30. %define V_html_mason 1.24
  31. %define V_mldbm 2.01
  32. %define V_html_format 2.03
  33. %define V_test_inline 0.15
  34. %define V_locale_maketext_lexicon 0.32
  35. %define V_locale_maketext_fuzzy 0.02
  36. %define V_regexp_common 2.113
  37. %define V_cache_cache 1.02
  38. # package information
  39. Name: rt
  40. Summary: Request Tracker
  41. URL: http://bestpractical.com/rt/
  42. Vendor: Best Practical
  43. Packager: The OpenPKG Project
  44. Distribution: OpenPKG [EVAL]
  45. Group: Database
  46. License: GPL
  47. Version: %{V_here}
  48. Release: 20031113
  49. # package options
  50. %option with_color_primary 336699
  51. %option with_color_secondary dddddd
  52. %option with_db_mysql yes
  53. %option with_db_postgresql no
  54. %option with_db_oracle no
  55. # fixing conflicting options
  56. %if "%{with_db_oracle}" == "yes"
  57. %undefine with_db_postgresql
  58. %define with_db_postgresql no
  59. %endif
  60. %if "%{with_db_oracle}" == "yes" || "%{with_db_postgresql}" == "yes"
  61. %undefine with_db_mysql
  62. %define with_db_mysql no
  63. %endif
  64. # list of sources
  65. Source0: http://www.cpan.org/modules/by-module/Log/Log-Dispatch-%{V_log_dispatch}.tar.gz
  66. Source1: http://www.cpan.org/modules/by-module/HTML/HTML-Mason-%{V_html_mason}.tar.gz
  67. Source2: http://www.cpan.org/modules/by-authors/id/C/CH/CHAMAS/MLDBM-%{V_mldbm}.tar.gz
  68. Source3: http://www.cpan.org/modules/by-authors/id/S/SB/SBURKE/HTML-Format-%{V_html_format}.tar.gz
  69. Source4: http://www.cpan.org/modules/by-authors/id/M/MS/MSCHWERN/Test-Inline-%{V_test_inline}.tar.gz
  70. Source5: http://www.cpan.org/modules/by-authors/id/A/AU/AUTRIJUS/Locale-Maketext-Lexicon-%{V_locale_maketext_lexicon}.tar.gz
  71. Source6: http://www.cpan.org/modules/by-authors/id/A/AU/AUTRIJUS/Locale-Maketext-Fuzzy-%{V_locale_maketext_fuzzy}.tar.gz
  72. Source7: http://www.cpan.org/modules/by-authors/id/A/AB/ABIGAIL/Regexp-Common-%{V_regexp_common}.tar.gz
  73. Source8: http://www.cpan.org/modules/by-authors/id/D/DC/DCLINTON/Cache-Cache-%{V_cache_cache}.tar.gz
  74. Source9: http://bestpractical.com/pub/rt/release/rt-%{V_real}.tar.gz
  75. Source10: rc.rt
  76. Source11: rtsetup
  77. Source12: rtcleanup
  78. Source13: rtupgrade
  79. Source14: rtapachectl
  80. Source15: rtapache.conf
  81. Source16: config.layout
  82. Source17: rt-mailgate.sh
  83. Patch0: rt.patch
  84. # build information
  85. Prefix: %{l_prefix}
  86. BuildRoot: %{l_buildroot}
  87. BuildPreReq: OpenPKG, openpkg >= 20030718, perl, perl-openpkg >= 20030718
  88. BuildPreReq: perl-sys, perl-util, perl-ds, perl-text, perl-apache
  89. BuildPreReq: perl-dbi, perl-dbix, perl-mail, perl-www
  90. BuildPreReq: apache, apache::with_mod_perl = yes
  91. PreReq: OpenPKG, openpkg >= 20030718, perl
  92. PreReq: perl-sys, perl-util, perl-ds, perl-text, perl-apache
  93. PreReq: perl-dbi, perl-dbix, perl-mail, perl-www
  94. PreReq: apache, apache::with_mod_perl = yes
  95. %if "%{with_db_mysql}" == "yes"
  96. PreReq: mysql, perl-dbi::with_dbd_mysql = yes
  97. %endif
  98. %if "%{with_db_postgresql}" == "yes"
  99. PreReq: postgresql, perl-dbi::with_dbd_pg = yes
  100. %endif
  101. %if "%{with_db_oracle}" == "yes"
  102. PreReq: oracle, perl-dbi::with_dbd_oracle = yes
  103. %endif
  104. PreReq: MTA
  105. AutoReq: no
  106. AutoReqProv: no
  107. %description
  108. RT is an industrial-grade ticketing system. It lets a group of
  109. people intelligently and efficiently manage requests submitted by a
  110. community of users. RT is used by systems administrators, customer
  111. support staffs, NOCs, developers and even marketing departments at
  112. over a thousand sites around the world.
  113. %prep
  114. # unpack distribution tarballs
  115. %setup -q -c
  116. %setup -q -T -D -a 1
  117. %setup -q -T -D -a 2
  118. %setup -q -T -D -a 3
  119. %setup -q -T -D -a 4
  120. %setup -q -T -D -a 5
  121. %setup -q -T -D -a 6
  122. %setup -q -T -D -a 7
  123. %setup -q -T -D -a 8
  124. %setup -q -T -D -a 9
  125. # patch RT distribution
  126. cd rt-%{V_real}
  127. %patch0 -p0
  128. %{l_shtool} install -c -m 0644 %{l_value -s -a} \
  129. %{SOURCE config.layout} .
  130. %{l_shtool} subst \
  131. -e 's;chown;true;g' \
  132. -e 's;chgrp;true;g' \
  133. -e 's;chmod;true;g' \
  134. -e 's;mkdir -p;%{l_shtool} mkdir -p;g' \
  135. Makefile.in
  136. %{l_shtool} subst \
  137. -e 's;Locale::Maketext 1\.04;Locale::Maketext 1.03;' \
  138. lib/RT/I18N.pm
  139. %{l_shtool} subst \
  140. -e 's;/usr/sbin/sendmail;%{l_prefix}/sbin/sendmail;g' \
  141. etc/RT_Config.pm.in
  142. %build
  143. # configure RT part
  144. cd rt-%{V_real}
  145. PERL=%{l_prefix}/bin/perl
  146. ./configure \
  147. --enable-layout=OPKG \
  148. --with-db-type=mysql \
  149. --with-db-host=localhost \
  150. --with-db-home=%{l_prefix} \
  151. %if "%{with_db_mysql}" == "yes"
  152. --with-db-dba=root \
  153. --with-db-database=rt \
  154. --with-db-user=rt \
  155. --with-db-pass=XXX \
  156. %endif
  157. %if "%{with_db_postgresql}" == "yes"
  158. --with-db-dba=postgresql \
  159. --with-db-database=rt \
  160. --with-db-user=rt \
  161. --with-db-pass=XXX \
  162. %endif
  163. %if "%{with_db_oracle}" == "yes"
  164. --with-db-dba=system \
  165. --with-db-database=rt \
  166. --with-db-user=rt \
  167. --with-db-pass=XXX \
  168. %endif
  169. --with-web-user=%{l_nusr} \
  170. --with-web-group=%{l_ngrp} \
  171. --with-customdir=%{l_prefix}/etc/rt/local \
  172. --with-customhtmldir=%{l_prefix}/etc/rt/local/html \
  173. --with-customlibdir=%{l_prefix}/etc/rt/local/lib \
  174. --with-customlexdir=%{l_prefix}/etc/rt/local/po
  175. %install
  176. rm -rf $RPM_BUILD_ROOT
  177. # perform common Perl prolog operations
  178. rt=%{l_prefix}/libexec/rt
  179. %{l_shtool} mkdir -f -p -m 755 ${RPM_BUILD_ROOT}$rt
  180. %{l_prefix}/bin/perl-openpkg prolog
  181. # install remaining prerequisite Perl modules which
  182. # are not part of the OpenPKG perl-xxx packages.
  183. %{l_prefix}/bin/perl-openpkg install \
  184. -d Regexp-Common-%{V_regexp_common} \
  185. -p ${RPM_BUILD_ROOT}$rt
  186. %{l_prefix}/bin/perl-openpkg install \
  187. -d Log-Dispatch-%{V_log_dispatch} \
  188. -p ${RPM_BUILD_ROOT}$rt
  189. %{l_prefix}/bin/perl-openpkg install \
  190. -d Cache-Cache-%{V_cache_cache} \
  191. -p ${RPM_BUILD_ROOT}$rt
  192. %{l_prefix}/bin/perl-openpkg install \
  193. -d HTML-Mason-%{V_html_mason} \
  194. -p ${RPM_BUILD_ROOT}$rt
  195. %{l_prefix}/bin/perl-openpkg install \
  196. -d MLDBM-%{V_mldbm} \
  197. -p ${RPM_BUILD_ROOT}$rt
  198. %{l_prefix}/bin/perl-openpkg install \
  199. -d HTML-Format-%{V_html_format} \
  200. -p ${RPM_BUILD_ROOT}$rt
  201. %{l_prefix}/bin/perl-openpkg install \
  202. -d Test-Inline-%{V_test_inline} \
  203. -p ${RPM_BUILD_ROOT}$rt
  204. %{l_prefix}/bin/perl-openpkg install \
  205. -d Locale-Maketext-Lexicon-%{V_locale_maketext_lexicon} \
  206. -p ${RPM_BUILD_ROOT}$rt
  207. %{l_prefix}/bin/perl-openpkg install \
  208. -d Locale-Maketext-Fuzzy-%{V_locale_maketext_fuzzy} \
  209. -p ${RPM_BUILD_ROOT}$rt
  210. # perform common Perl epilog operations
  211. %{l_prefix}/bin/perl-openpkg epilog
  212. # create installation file hierarchy
  213. %{l_shtool} mkdir -f -p -m 0755 \
  214. $RPM_BUILD_ROOT%{l_prefix}/sbin \
  215. $RPM_BUILD_ROOT%{l_prefix}/etc/rt \
  216. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  217. $RPM_BUILD_ROOT%{l_prefix}/cgi/rt \
  218. $RPM_BUILD_ROOT%{l_prefix}/share/rt \
  219. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/tools \
  220. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/etc/upgrade \
  221. $RPM_BUILD_ROOT%{l_prefix}/var/rt/mason-data \
  222. $RPM_BUILD_ROOT%{l_prefix}/var/rt/mason-session \
  223. $RPM_BUILD_ROOT%{l_prefix}/var/rt/log \
  224. $RPM_BUILD_ROOT%{l_prefix}/var/rt/run
  225. # perform RT installation procedure
  226. ( cd rt-%{V_real}
  227. %{l_make} %{l_mflags} \
  228. config-install dirs libs-install etc-install bin-install \
  229. sbin-install html-install doc-install \
  230. DESTDIR=$RPM_BUILD_ROOT
  231. %{l_shtool} install -c -m 0644 \
  232. etc/upgrade/* \
  233. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/etc/upgrade/
  234. %{l_shtool} install -c -m 0644 \
  235. -e '/Set($WebBaseURL/s;"[^"]*";"";' \
  236. etc/RT_Config.pm \
  237. $RPM_BUILD_ROOT%{l_prefix}/etc/rt/RT_SiteConfig.pm
  238. ) || exit $?
  239. # post-adjust installation hierarchy
  240. %{l_shtool} mkln -f -s \
  241. $RPM_BUILD_ROOT%{l_prefix}/etc/rt/RT_SiteConfig.pm \
  242. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/etc/RT_SiteConfig.pm
  243. mv \
  244. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/WebRT/html/NoAuth/webrt.css \
  245. $RPM_BUILD_ROOT%{l_prefix}/etc/rt/webrt.css
  246. %{l_shtool} mkln -f -s \
  247. $RPM_BUILD_ROOT%{l_prefix}/etc/rt/webrt.css \
  248. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/WebRT/html/NoAuth/webrt.css
  249. mv \
  250. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/local \
  251. $RPM_BUILD_ROOT%{l_prefix}/etc/rt/local
  252. %{l_shtool} mkln -f -s \
  253. $RPM_BUILD_ROOT%{l_prefix}/etc/rt/local \
  254. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/local
  255. mv \
  256. $RPM_BUILD_ROOT%{l_prefix}/bin/webmux.pl \
  257. $RPM_BUILD_ROOT%{l_prefix}/bin/mason_handler.fcgi \
  258. $RPM_BUILD_ROOT%{l_prefix}/cgi/rt/
  259. mv \
  260. $RPM_BUILD_ROOT%{l_prefix}/bin/rt-crontool \
  261. $RPM_BUILD_ROOT%{l_prefix}/bin/rt-mailgate \
  262. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/tools/
  263. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  264. %{SOURCE rt-mailgate.sh} \
  265. $RPM_BUILD_ROOT%{l_prefix}/bin/rt-mailgate
  266. # strip installation hierarchy
  267. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/*.svc
  268. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/tools/rt-test-dependencies
  269. rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/t
  270. rm -f $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/RT.pm.in
  271. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/xgettext.pl
  272. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/pod2test
  273. rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
  274. rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/rt
  275. # install own setup/cleanup/upgrade script
  276. %if "%{with_db_mysql}" == "yes"
  277. rt_db_dba=root
  278. %endif
  279. %if "%{with_db_postgresql}" == "yes"
  280. rt_db_dba=postgresql
  281. %endif
  282. %if "%{with_db_oracle}" == "yes"
  283. rt_db_dba=system
  284. %endif
  285. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  286. -e "s;@rt_db_dba@;$rt_db_dba;g" \
  287. %{SOURCE rtsetup} %{SOURCE rtcleanup} %{SOURCE rtupgrade} \
  288. $RPM_BUILD_ROOT%{l_prefix}/sbin/
  289. # install OpenPKG run-command script
  290. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  291. %{SOURCE rc.rt} \
  292. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  293. # install Apache "apachectl" wrapper
  294. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  295. %{SOURCE rtapachectl} \
  296. $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/tools/
  297. # install Apache configuration
  298. l_hostname=`%{l_shtool} echo -e %h`
  299. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  300. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  301. -e "s;@l_hostname@;$l_hostname;g" \
  302. -e "s;@l_domainname@;$l_domainname;g" \
  303. %{SOURCE rtapache.conf} \
  304. $RPM_BUILD_ROOT%{l_prefix}/etc/rt/
  305. # final post-adjustments to installation hierarchy
  306. %{l_shtool} subst \
  307. -e 's;#336699;#%{with_color_primary};g' \
  308. -e 's;#dddddd;#%{with_color_secondary};g' \
  309. `find $RPM_BUILD_ROOT%{l_prefix}/libexec/rt/WebRT \
  310. -type f -print | grep -v gif | grep -v jpg | grep -v .orig`
  311. # determine installation files
  312. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  313. %{l_files_std} \
  314. '%{l_prefix}/libexec/rt' \
  315. '%attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/libexec/rt/tools/rt-setup-database' \
  316. '%attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/libexec/rt/tools/rt-crontool' \
  317. '%attr(755,%{l_musr},%{l_mgrp}) %{l_prefix}/libexec/rt/tools/rt-mailgate' \
  318. '%config %attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/rt/RT_SiteConfig.pm' \
  319. '%config %attr(640,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/rt/rtapache.conf' \
  320. '%config %attr(644,%{l_musr},%{l_rgrp}) %{l_prefix}/etc/rt/webrt.css' \
  321. '%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rt/mason-data' \
  322. '%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rt/mason-data/*' \
  323. '%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rt/mason-session' \
  324. '%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rt/log' \
  325. '%attr(750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/rt/run'
  326. %files -f files
  327. %clean
  328. rm -rf $RPM_BUILD_ROOT
  329. %post
  330. if [ $1 -eq 1 ]; then
  331. # activate in MTA configuration
  332. aliases_file=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_file`
  333. aliases_update=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_update`
  334. if [ ".$aliases_file" != . ]; then
  335. ( echo "rt: \"|$RPM_INSTALL_PREFIX/bin/rt-mailgate --action correspond --queue general --url http://127.0.0.1:8380/\""
  336. echo "rt-comment: \"|$RPM_INSTALL_PREFIX/bin/rt-mailgate --action comment --queue general --url http://127.0.0.1:8380/\""
  337. ) | %{l_rpmtool} config -a -i "$RPM_INSTALL_PREFIX:rt" $aliases_file
  338. fi
  339. if [ ".$aliases_update" != . ]; then
  340. eval $aliases_update
  341. fi
  342. # display final hint after initial installation
  343. ( echo "To complete installation of the RT package please check the"
  344. echo "file $RPM_INSTALL_PREFIX/etc/rt/RT_SiteConfig.pm. In particular,"
  345. echo "you have to assign a password to the RT database user."
  346. echo "Then you have to create the RT database in the RDBMS with:"
  347. echo "\$ $RPM_INSTALL_PREFIX/sbin/rtsetup"
  348. ) | %{l_rpmtool} msg -b -t notice
  349. elif [ $1 -gt 1 ]; then
  350. # display final hint after upgrading
  351. ( echo "If you have an old RT database you can erase it with:"
  352. echo "\$ $RPM_INSTALL_PREFIX/sbin/rtcleanup"
  353. echo "Upgrading from an earlier RT 3.x database you can with:"
  354. echo "\$ $RPM_INSTALL_PREFIX/sbin/rtupgrade <old-rt-version>"
  355. ) | %{l_rpmtool} msg -b -t notice
  356. fi
  357. %preun
  358. if [ $1 -eq 0 ]; then
  359. # stop perhaps still running server
  360. $RPM_INSTALL_PREFIX/etc/rc rt stop
  361. # deactivate in MTA configuration
  362. aliases_file=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_file`
  363. aliases_update=`$RPM_INSTALL_PREFIX/etc/rc --query MTA_aliases_update`
  364. if [ ".$aliases_file" != . ]; then
  365. %{l_rpmtool} config -r -i "$RPM_INSTALL_PREFIX:rt" $aliases_file
  366. fi
  367. if [ ".$aliases_update" != . ]; then
  368. eval $aliases_update
  369. fi
  370. # remove generated files
  371. rm -f $RPM_INSTALL_PREFIX/var/rt/mason-session/*
  372. rm -rf $RPM_INSTALL_PREFIX/var/rt/mason-data/*/*
  373. rm -f $RPM_INSTALL_PREFIX/var/rt/log/*
  374. rm -f $RPM_INSTALL_PREFIX/var/rt/run/apache.pid
  375. rm -f $RPM_INSTALL_PREFIX/var/rt/run/ssl_scache
  376. fi