summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <a3li@gentoo.org>2010-07-28 07:58:09 +0000
committerAlex Legler <a3li@gentoo.org>2010-07-28 07:58:09 +0000
commit519eb81213eb5203ec7baead68b9aaa73ae6a671 (patch)
tree5e3e43a5e171d9e846f158dcbaedd5d5d3fae0e4 /net-irc
parentstable x86, bug 330121 (diff)
downloadgentoo-2-519eb81213eb5203ec7baead68b9aaa73ae6a671.tar.gz
gentoo-2-519eb81213eb5203ec7baead68b9aaa73ae6a671.tar.bz2
gentoo-2-519eb81213eb5203ec7baead68b9aaa73ae6a671.zip
Version bump, closes bug 330125 by Jens Pranaitis. Ebuild now uses the ruby-ng eclass. Adds support for specifying a Ruby interpreter for rbot. Add fi to LINGUAS.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'net-irc')
-rw-r--r--net-irc/rbot/ChangeLog12
-rw-r--r--net-irc/rbot/files/rbot.conf226
-rw-r--r--net-irc/rbot/files/rbot.init254
-rw-r--r--net-irc/rbot/rbot-0.9.15.ebuild177
4 files changed, 267 insertions, 2 deletions
diff --git a/net-irc/rbot/ChangeLog b/net-irc/rbot/ChangeLog
index ca075a49acb1..f5fb63c92ec9 100644
--- a/net-irc/rbot/ChangeLog
+++ b/net-irc/rbot/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for net-irc/rbot
-# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/ChangeLog,v 1.42 2009/11/07 20:28:12 a3li Exp $
+# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/ChangeLog,v 1.43 2010/07/28 07:58:09 a3li Exp $
+
+*rbot-0.9.15 (28 Jul 2010)
+
+ 28 Jul 2010; Alex Legler <a3li@gentoo.org> +rbot-0.9.15.ebuild,
+ +files/rbot.conf2, +files/rbot.init2:
+ Version bump, closes bug 330125 by Jens Pranaitis. Ebuild now uses the
+ ruby-ng eclass. Adds support for specifying a Ruby interpreter for rbot.
+ Add fi to LINGUAS.
07 Nov 2009; Alex Legler <a3li@gentoo.org> -rbot-0.9.11_rc2.ebuild,
rbot-0.9.14.ebuild, metadata.xml:
diff --git a/net-irc/rbot/files/rbot.conf2 b/net-irc/rbot/files/rbot.conf2
new file mode 100644
index 000000000000..203429d1aa24
--- /dev/null
+++ b/net-irc/rbot/files/rbot.conf2
@@ -0,0 +1,26 @@
+# Configuration file for rbot service(s)
+#
+# To allow running more than one rbot service on your box, you can
+# symlink /etc/init.d/rbot to any name starting with rbot.
+# By doing this, after this configuration file, the service will
+# source the relative /etc/conf.d/rbot.$name file, where you can set
+# your particular configuration for that rbot instance.
+#
+# NOTE: please make sure you always use a different RBOTDIR for
+# multiple instances; you can still use the same user though.
+# Also note that, as in the home of the user there will be the
+# password for both rbot and NickServ access, the directory should not
+# have world readable permissions.
+
+# Base directory for the bot, with the configuration data
+RBOTDIR="/var/lib/rbot"
+
+# User to run the rbot instance with.
+# Note 1: you can specify also a group in the form of user:group.
+# Note 2: the HOME of the user will be hardwired to /dev/null for
+# safety.
+RBOTUSER="rbot:nobody"
+
+# The Ruby interpreter to run rbot with. Use full paths.
+# This defaults to whatever is put as default by eselect ruby.
+RBOTRUBY="/usr/bin/$(readlink /usr/bin/ruby)"
diff --git a/net-irc/rbot/files/rbot.init2 b/net-irc/rbot/files/rbot.init2
new file mode 100644
index 000000000000..f08bcd46f27c
--- /dev/null
+++ b/net-irc/rbot/files/rbot.init2
@@ -0,0 +1,54 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/files/rbot.init2,v 1.1 2010/07/28 07:58:08 a3li Exp $
+
+depend() {
+ need net
+ use dns
+}
+
+start() {
+ if ! [ -d "${RBOTDIR}" ]; then
+ eerror "The path you specified (${RBOTDIR}) is not a directory."
+ eerror "Please set RBOTDIR variable in /etc/conf.d/${SVCNAME}"
+ eerror "to a proper value for an rbot base directory."
+ return 1
+ fi
+
+ if ! [ -f "${RBOTDIR}/conf.yaml" ]; then
+ eerror "You didn't configure rbot yet. Please configure rbot by running"
+ eerror " rbot ${RBOTDIR}"
+ eerror "at least once."
+ return 1
+ fi
+
+ if ! [ -x "${RBOTRUBY}" ]; then
+ eerror "The configured Ruby interpreter for rbot is not an executable."
+ eerror "Use \`eselect ruby' to set a default interpreter or adapt the"
+ eerror "RBOTRUBY variable in /etc/conf.d/${SVCNAME}."
+ return 1
+ fi
+
+ export USER="${RBOTUSER%%:*}"
+ export HOME="/dev/null"
+ ebegin "Starting rbot"
+ start-stop-daemon \
+ --start \
+ --exec "${RBOTRUBY}" --name "$(basename ${RBOTRUBY})" \
+ --pidfile "${RBOTDIR}/rbot.pid" \
+ --chuid "${RBOTUSER}" \
+ -- /usr/bin/rbot --background "${RBOTDIR}"
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping rbot"
+ start-stop-daemon --stop \
+ --exec "${RBOTRUBY}" \
+ --pidfile "${RBOTDIR}/rbot.pid" \
+ --user "${RBOTUSER%%:*}"
+ eend $?
+}
+
+# vim:set sts=8 sw=8 ts=8 noexpandtab:
diff --git a/net-irc/rbot/rbot-0.9.15.ebuild b/net-irc/rbot/rbot-0.9.15.ebuild
new file mode 100644
index 000000000000..d985f267abd0
--- /dev/null
+++ b/net-irc/rbot/rbot-0.9.15.ebuild
@@ -0,0 +1,177 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-irc/rbot/rbot-0.9.15.ebuild,v 1.1 2010/07/28 07:58:09 a3li Exp $
+
+EAPI="2"
+# ruby19 needs ruby-gettext on 19 first
+USE_RUBY="ruby18"
+
+inherit ruby-ng eutils
+
+DESCRIPTION="rbot is a ruby IRC bot"
+HOMEPAGE="http://ruby-rbot.org/"
+SRC_URI="http://ruby-rbot.org/download/${P}.tgz"
+
+LICENSE="GPL-2 as-is"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~sparc ~x86 ~x86-fbsd"
+IUSE="spell aspell timezone translator shorturl nls dict figlet
+ fortune cal host toilet hunspell"
+ILINGUAS="zh_CN zh_TW ru nl de fi fr it ja"
+
+for lang in $ILINGUAS; do
+ IUSE="${IUSE} linguas_${lang}"
+done
+
+RDEPEND="
+ spell? (
+ aspell? ( app-text/aspell )
+ !aspell? (
+ hunspell? ( app-text/hunspell )
+ !hunspell? ( app-text/ispell )
+ )
+ )
+ figlet? ( app-misc/figlet )
+ toilet? ( app-misc/toilet )
+ fortune? ( games-misc/fortune-mod )
+ cal? ( || ( sys-apps/util-linux sys-freebsd/freebsd-ubin ) )
+ host? ( net-dns/bind-tools )"
+
+ruby_add_rdepend "
+ dev-ruby/ruby-bdb
+ timezone? ( dev-ruby/tzinfo )
+ translator? ( dev-ruby/mechanize )
+ shorturl? ( dev-ruby/shorturl )
+ nls? ( dev-ruby/ruby-gettext )
+ dict? ( dev-ruby/ruby-dict )"
+
+# gettext does not yet work on 1.9, so generate locales on 1.8
+DEPEND="
+ nls? (
+ >=dev-ruby/ruby-gettext-2[ruby_targets_ruby18]
+ dev-ruby/rake[ruby_targets_ruby18]
+ )"
+
+pkg_setup() {
+ enewuser rbot -1 -1 /var/lib/rbot nobody
+}
+
+all_ruby_compile() {
+ disable_rbot_plugin() {
+ mv "${S}"/data/rbot/plugins/$1.rb{,.disabled}
+ }
+ use_rbot_plugin() {
+ use $1 && return
+ disable_rbot_plugin "$2"
+ }
+ rbot_conf() {
+ echo "$1: $2" >> "${T}"/rbot.conf
+ }
+ use_rbot_conf_path() {
+ use "$1" \
+ && rbot_conf "$2" "$3" \
+ || rbot_conf "$2" /bin/false
+ }
+
+ local spell_program="/usr/bin/ispell"
+ if use !spell; then
+ disable_rbot_plugin spell
+ spell_program="/bin/false"
+ elif use aspell; then
+ spell_program="/usr/bin/ispell-aspell"
+ elif use hunspell; then
+ spell_program="/usr/bin/hunspell -i"
+ fi
+
+ rbot_conf spell.program "${spell_program}"
+
+ if use !figlet && use !toilet; then
+ disable_rbot_plugin figlet
+ fi
+
+ use_rbot_conf_path figlet figlet.path /usr/bin/figlet
+ use_rbot_conf_path toilet toilet.path /usr/bin/toilet
+
+ use_rbot_plugin timezone time
+ use_rbot_plugin translator translator
+ use_rbot_plugin shorturl shortenurls
+ use_rbot_plugin dict dictclient
+
+ use_rbot_plugin fortune fortune
+ use_rbot_conf_path fortune fortune.path /usr/bin/fortune
+
+ use_rbot_plugin cal cal
+ use_rbot_conf_path cal cal.path /usr/bin/cal
+
+ use_rbot_plugin host host
+ use_rbot_conf_path host host.path /usr/bin/host
+
+ local rbot_datadir="${D}"/usr/share/rbot
+
+ # This is unfortunately pretty manual at the moment, but it's just
+ # to avoid having to run special scripts to package new versions
+ # of rbot. The default if new languages are added that are not
+ # considered for an opt-out here is to install them, so you just
+ # need to add them later.
+ if use nls; then
+ strip-linguas ${ILINGUAS}
+ if [[ -n ${LINGUAS} ]]; then
+ # As the the language name used by the rbot data files does
+ # not correspond to the ISO codes we usually use for LINGUAS,
+ # the following list of local varables will work as a
+ # dictionary to get the name used by rbot from the ISO code.
+ local lang_rbot_zh_CN="traditional_chinese"
+ local lang_rbot_ru="russian"
+ local lang_rbot_nl="dutch"
+ local lang_rbot_de="german"
+ local lang_rbot_fi="finnish"
+ local lang_rbot_fr="french"
+ local lang_rbot_it="italian"
+ local lang_rbot_ja="japanese"
+
+ for lang in ${ILINGUAS}; do
+ use linguas_${lang} && continue
+
+ lang_varname="lang_rbot_${lang}"
+ lang_rbot=${!lang_varname}
+
+ rm -r \
+ "${S}"/data/rbot/languages/${lang_rbot}.lang \
+ "${S}"/data/rbot/templates/lart/larts-${lang_rbot} \
+ "${S}"/data/rbot/templates/lart/praises-${lang_rbot} \
+ "${S}"/data/rbot/templates/salut/salut-${lang_rbot} \
+ "${S}"/po/${lang} &>/dev/null
+ done
+ fi
+
+ ruby18 /usr/bin/rake makemo || die "locale generation failed"
+ fi
+}
+
+each_ruby_compile() {
+ ${RUBY} setup.rb config --prefix="/usr" \
+ || die "setup.rb install failed"
+}
+
+each_ruby_install() {
+ ${RUBY} setup.rb install --prefix="${D}" \
+ || die "setup.rb install failed"
+}
+
+all_ruby_install() {
+ diropts -o rbot -g nobody -m 0700
+ keepdir /var/lib/rbot
+
+ insinto /etc
+ doins "${T}"/rbot.conf
+
+ newinitd "${FILESDIR}/rbot.init2" rbot
+ newconfd "${FILESDIR}/rbot.conf2" rbot
+}
+
+pkg_postinst() {
+ einfo
+ elog "rbot can be started as a normal service."
+ elog "Check /etc/conf.d/rbot file for more information about this feature."
+ einfo
+}