/[gentoo-x86]/net-irc/rbot/rbot-9999-r7.ebuild
Gentoo

Contents of /net-irc/rbot/rbot-9999-r7.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Wed Feb 13 17:32:29 2008 UTC (10 years ago) by flameeyes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Revision bump, rbot moved to GIT now rather than Subversion. Drop the snapshot USE flag as there is no more a progressive number to be used.
(Portage version: 2.1.4.4)

1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/rbot-9999-r7.ebuild,v 1.2 2007/12/28 14:08:10 flameeyes Exp $
4
5 inherit ruby gems eutils
6
7 [[ ${PV} == "9999" ]] && inherit subversion
8
9 DESCRIPTION="rbot is a ruby IRC bot"
10 HOMEPAGE="http://www.linuxbrit.co.uk/rbot/"
11
12 LICENSE="as-is"
13 SLOT="0"
14 KEYWORDS=""
15 IUSE="spell aspell timezone translator shorturl nls dict"
16 ILINGUAS="zh ru nl de fr it en ja"
17
18 for lang in $ILINGUAS; do
19 IUSE="${IUSE} linguas_${lang}"
20 done
21
22 RDEPEND=">=virtual/ruby-1.8
23 dev-ruby/ruby-bdb
24 timezone? ( dev-ruby/tzinfo )
25 spell? (
26 aspell? ( app-text/aspell )
27 !aspell? ( app-text/ispell )
28 )
29 translator? ( dev-ruby/mechanize )
30 shorturl? ( dev-ruby/shorturl )
31 nls? ( dev-ruby/ruby-gettext )
32 dict? ( dev-ruby/ruby-dict )"
33 DEPEND=""
34
35 if [[ ${PV} == "9999" ]]; then
36 SRC_URI=""
37 ESVN_REPO_URI="svn://linuxbrit.co.uk/giblet/rbot/trunk"
38
39 DEPEND="${DEPEND}
40 dev-ruby/rake
41 app-arch/zip
42 dev-ruby/ruby-gettext"
43
44 IUSE="${IUSE} snapshot"
45 else
46 SRC_URI="http://www.linuxbrit.co.uk/downloads/${P}.gem"
47 fi
48
49 pkg_setup() {
50 enewuser rbot -1 -1 /var/lib/rbot nobody
51 }
52
53 svn_gem_version() {
54 use snapshot && \
55 echo 9998.${ESVN_WC_REVISION} || \
56 echo 9999
57 }
58
59 src_unpack() {
60 [[ ${PV} == "9999" ]] || return 0
61 subversion_src_unpack
62
63 cd "${S}"
64 sed -i -e "/s.version =/s:'.\+':'$(svn_gem_version)':" Rakefile \
65 || die "Unable to fix Rakefile version."
66 sed -i -e '/\$version=/s:".\+":"'$(svn_gem_version)'":' bin/rbot \
67 || die "Unable to fix rbot script version."
68 }
69
70 src_compile() {
71 [[ ${PV} == "9999" ]] || return 0
72 rake makemo || die "locale generation failed"
73 rake || die "Gem generation failed"
74 }
75
76 src_install() {
77 if [[ ${PV} == "9999" ]]; then
78 GEM_SRC="${S}/pkg/rbot-$(svn_gem_version).gem"
79 MY_P="${PN}-$(svn_gem_version)"
80 else
81 MY_P="${P}"
82 fi
83 gems_src_install
84
85 diropts -o rbot -g nobody -m 0700
86 keepdir /var/lib/rbot
87
88 newinitd "${FILESDIR}/rbot.init" rbot
89 newconfd "${FILESDIR}/rbot.conf" rbot
90
91 local rbot_datadir="${D}/${GEMSDIR}"/gems/${MY_P}/data/rbot
92
93 disable_rbot_plugin() {
94 mv "${rbot_datadir}"/plugins/$1.rb{,.disabled}
95 }
96
97 if ! use spell; then
98 disable_rbot_plugin spell || die "Unable to disable spell plugin"
99 elif use aspell; then
100 # This is not officially supported, but as ispell is quite a
101 # bad piece of code, at least give an opportunity to use
102 # something that works a bit better.
103 sed -i -e 's:ispell:ispell-aspell:' \
104 "${rbot_datadir}"/plugins/spell.rb \
105 || die "Unable to replace ispell with aspell."
106 fi
107
108 use timezone || disable_rbot_plugin time
109 use translator || disable_rbot_plugin translator
110 use shorturl || disable_rbot_plugin shortenurls
111 use dict || disable_rbot_plugin dictclient
112
113 # This is unfortunately pretty manual at the moment, but it's just
114 # to avoid having to run special scripts to package new versions
115 # of rbot. The default if new languages are added that are not
116 # considered for an opt-out here is to install them, so you just
117 # need to add them later.
118 strip-linguas ${ILINGUAS}
119 if [[ -n ${LINGUAS} ]]; then
120 # As the the language name used by the rbot data files does
121 # not correspond to the ISO codes we usually use for LINGUAS,
122 # the following list of local varables will work as a
123 # dictionary to get the name used by rbot from the ISO code.
124 local lang_rbot_zh="traditional_chinese"
125 local lang_rbot_ru="russian"
126 local lang_rbot_nl="dutch"
127 local lang_rbot_de="german"
128 local lang_rbot_fr="french"
129 local lang_rbot_it="italian"
130 local lang_rbot_en="english"
131 local lang_rbot_ja="japanese"
132
133 for lang in ${ILINGUAS}; do
134 use linguas_${lang} && continue
135
136 lang="lang_rbot_${lang}"
137 lang_rbot=${!lang}
138
139 rm \
140 ${rbot_datadir}/languages/${lang_rbot}.lang \
141 ${rbot_datadir}/templates/lart/larts-${lang_rbot} \
142 ${rbot_datadir}/templates/lart/praises-${lang_rbot} \
143 ${rbot_datadir}/templates/salut/salut-${lang_rbot}
144 done
145 fi
146 }
147
148 pkg_postinst() {
149 einfo
150 elog "rbot now can be started as a normal service."
151 elog "Check /etc/conf.d/rbot file for more information about this feature."
152 einfo
153 }

  ViewVC Help
Powered by ViewVC 1.1.20