summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-irc/rbot')
-rw-r--r--net-irc/rbot/Manifest1
-rw-r--r--net-irc/rbot/files/rbot-rakefile.patch30
-rw-r--r--net-irc/rbot/files/rbot.conf22
-rw-r--r--net-irc/rbot/files/rbot.conf226
-rw-r--r--net-irc/rbot/files/rbot.init55
-rw-r--r--net-irc/rbot/files/rbot.init254
-rw-r--r--net-irc/rbot/metadata.xml69
-rw-r--r--net-irc/rbot/rbot-0.9.15_p20131020-r1.ebuild176
8 files changed, 433 insertions, 0 deletions
diff --git a/net-irc/rbot/Manifest b/net-irc/rbot/Manifest
new file mode 100644
index 000000000000..c65965d144b1
--- /dev/null
+++ b/net-irc/rbot/Manifest
@@ -0,0 +1 @@
+DIST rbot-0.9.15_p20131020.tar.gz 773953 SHA256 74b4db6a2b24784a1779518cd070bbf8cb6d4a5059167579d8226a0fc69cef15 SHA512 3319031361f7ab23e43a997a94663790775047c50eb8eb51f3f579cf879ca822b48118060fdd9f2816d5d97c57de8f6fb7ce883457336f961ff25cf6c49a8d2a WHIRLPOOL 8e77fdeb290dae0c4932628e010768217df223e94a5ec902ed48e9db3a2c2985ef2df932e84048ab8721b8d4bb954852397974afa02f1bdfc1e1b8533b58d812
diff --git a/net-irc/rbot/files/rbot-rakefile.patch b/net-irc/rbot/files/rbot-rakefile.patch
new file mode 100644
index 000000000000..35747263870f
--- /dev/null
+++ b/net-irc/rbot/files/rbot-rakefile.patch
@@ -0,0 +1,30 @@
+--- Rakefile.old 2013-08-20 01:00:05.000000000 +0200
++++ Rakefile 2013-10-21 19:42:06.800019343 +0200
+@@ -1,5 +1,6 @@
+ require 'rake'
+-require 'rake/gempackagetask'
++require 'rubygems'
++require 'rubygems/package_task'
+
+ task :default => [:buildext]
+
+@@ -15,7 +16,7 @@
+ # we must (and can) skip defining the gem packaging tasks.
+ if File.exist? SPECFILE
+ spec = eval(File.read(SPECFILE), nil, SPECFILE)
+- Rake::GemPackageTask.new(spec) do |pkg|
++ Gem::PackageTask.new(spec) do |pkg|
+ pkg.need_zip = true
+ pkg.need_tar = true
+ end
+@@ -125,8 +126,8 @@
+ }) do |t|
+ po_file, mo_file = t.source, t.name
+ puts "#{po_file} => #{mo_file}"
+- require 'gettext/utils'
+- GetText.rmsgfmt po_file, mo_file
++ require 'gettext/tools'
++ GetText::Tools::MsgFmt.run po_file, mo_file
+ end
+
+ task :check_po_tools do
diff --git a/net-irc/rbot/files/rbot.conf b/net-irc/rbot/files/rbot.conf
new file mode 100644
index 000000000000..0c22544f385a
--- /dev/null
+++ b/net-irc/rbot/files/rbot.conf
@@ -0,0 +1,22 @@
+# 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"
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.init b/net-irc/rbot/files/rbot.init
new file mode 100644
index 000000000000..e703cbf67532
--- /dev/null
+++ b/net-irc/rbot/files/rbot.init
@@ -0,0 +1,55 @@
+#!/sbin/runscript
+# Copyright 2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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/${myservice}"
+ 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
+
+ # for a series of reason, we can't rely on the process being started
+ # with 'ruby' name. As using ruby18 would break for ruby 1.9, get the
+ # linked name to use as rubyname.
+ ruby="$(readlink /usr/bin/ruby)"
+
+ export USER="${RBOTUSER%%:*}"
+ export HOME="/dev/null"
+ ebegin "Starting rbot"
+ start-stop-daemon \
+ --start \
+ --exec "/usr/bin/${ruby}" --name "${ruby}" \
+ --pidfile "${RBOTDIR}/rbot.pid" \
+ --chuid "${RBOTUSER}" \
+ -- /usr/bin/rbot --background "${RBOTDIR}"
+ eend $?
+}
+
+stop() {
+ # for a series of reason, we can't rely on the process being started
+ # with 'ruby' name. As using ruby18 would break for ruby 1.9, get the
+ # linked name to use as rubyname.
+ ruby="$(readlink /usr/bin/ruby)"
+
+ ebegin "Stopping rbot"
+ start-stop-daemon --stop \
+ --exec "/usr/bin/${ruby}" \
+ --pidfile "${RBOTDIR}/rbot.pid" \
+ --user "${RBOTUSER%%:*}"
+ eend $?
+}
diff --git a/net-irc/rbot/files/rbot.init2 b/net-irc/rbot/files/rbot.init2
new file mode 100644
index 000000000000..e77ae42a36cb
--- /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
+# $Id$
+
+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/metadata.xml b/net-irc/rbot/metadata.xml
new file mode 100644
index 000000000000..5ea626901d56
--- /dev/null
+++ b/net-irc/rbot/metadata.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>net-irc</herd>
+<maintainer>
+ <email>a3li@gentoo.org</email>
+ <name>Alex Legler</name>
+ <description>Primary maintainer</description>
+</maintainer>
+<use>
+ <flag name="timezone">
+ Add dependency over <pkg>dev-ruby/tzinfo</pkg> to enable the "time"
+ plugin for rbot. If the USE flag is disabled the plugin is also
+ disabled by default.
+ </flag>
+ <flag name="aspell">
+ Use aspell instead of ispell in the "spell" plugin for rbot. The
+ vanilla plugin uses ispell, but enabling this flag makes it use
+ the ispell interface from aspell instead.
+ </flag>
+ <flag name="translator">
+ Add dependency over <pkg>dev-ruby/mechanize</pkg>, which is needed
+ to enable the "translator" plugin for rbot. If the USE flag is
+ disabled the plugin is also disabled by default.
+ </flag>
+ <flag name="shorturl">
+ Add dependency over <pkg>dev-ruby/shorturl</pkg>, which is needed
+ to enable the "shortenurl" plugin for rbot. If the USE flag is
+ disabled the plugin is also disabled by default.
+ </flag>
+ <flag name="nls">
+ Build and install translation for the messages coming from the bot
+ and its plugins (through <pkg>dev-ruby/ruby-gettext</pkg>).
+ </flag>
+ <flag name="dict">
+ Add dependency over <pkg>dev-ruby/ruby-dict</pkg>, which is needed
+ to enable the "dict" plugin for rbot. If the USE flag is disabled
+ the plugin is also disabled by default.
+ </flag>
+ <flag name="figlet">
+ Add dependency over <pkg>app-misc/figlet</pkg>, which is used by
+ the "figlet" plugin for rbot. If the USE flag is disabled the
+ plugin will be unable to use figlet; if toilet is also disabled,
+ the plugin will be disabled.
+ </flag>
+ <flag name="toilet">
+ Add dependency over <pkg>app-misc/toilet</pkg>, which is used by
+ the "figlet" plugin for rbot. If the USE flag is disabled the
+ plugin will be unable to use toilet; if figlet is also disabled,
+ the plugin will be disabled.
+ </flag>
+ <flag name="fortune">
+ Add dependency over <pkg>games-misc/fortune-mod</pkg>, which is
+ needed to enable the "fortune" plugin for rbot. If the USE flag is
+ disabled the plugin is also disabled by default.
+ </flag>
+ <flag name="cal">
+ Add dependency over a package providing the /usr/bin/cal command,
+ which is needed to enable the "cal" plugin for rbot. If the USE
+ flag is disabled the plugin is also disabled by default.
+ </flag>
+ <flag name="host">
+ Add dependency over <pkg>net-dns/bind-tools</pkg> (providing
+ /usr/bin/host), which is needed to enable the "host" plugin for
+ rbot. If the USE flag is disabled the plugin is also disabled by
+ default.
+ </flag>
+</use>
+</pkgmetadata>
diff --git a/net-irc/rbot/rbot-0.9.15_p20131020-r1.ebuild b/net-irc/rbot/rbot-0.9.15_p20131020-r1.ebuild
new file mode 100644
index 000000000000..5c5c2792dcd2
--- /dev/null
+++ b/net-irc/rbot/rbot-0.9.15_p20131020-r1.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+USE_RUBY="ruby19 ruby20 ruby21"
+
+inherit ruby-ng eutils user
+
+DESCRIPTION="A ruby IRC bot"
+HOMEPAGE="http://ruby-rbot.org/"
+SRC_URI="http://dev.a3li.li/gentoo/distfiles/${P}.tar.gz"
+
+LICENSE="|| ( feh GPL-2 )"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="spell aspell timezone translator shorturl nls dict figlet
+ fortune cal host toilet"
+ILINGUAS="zh_CN zh_TW ru nl de fi fr it ja"
+RUBY_S="${PN}-master"
+
+for lang in $ILINGUAS; do
+ IUSE="${IUSE} linguas_${lang}"
+done
+
+RDEPEND+="
+ spell? (
+ aspell? ( app-text/aspell )
+ !aspell? ( app-text/hunspell )
+ )
+ 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_bdepend "
+ nls? (
+ >=dev-ruby/ruby-gettext-2
+ dev-ruby/rake
+ )"
+
+ruby_add_rdepend "
+ dev-ruby/tokyocabinet
+ timezone? ( dev-ruby/tzinfo )
+ translator? ( dev-ruby/mechanize )
+ shorturl? ( dev-ruby/shorturl )
+ nls? ( dev-ruby/ruby-gettext >=dev-ruby/locale-2.0.5-r2 )
+ dict? ( >=dev-ruby/ruby-dict-0.9.4-r2 )"
+
+RUBY_PATCHES=( "rbot-rakefile.patch" )
+
+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/hunspell -i"
+ if use !spell; then
+ disable_rbot_plugin spell
+ spell_program="/bin/false"
+ elif use aspell; then
+ spell_program="/usr/bin/ispell-aspell"
+ 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
+
+ ${RUBY} /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() {
+ elog "rbot can be started as a normal service."
+ elog "Check /etc/conf.d/rbot file for more information about this feature."
+ ewarn "DEPRECATION NOTICE:"
+ ewarn "The bdb database backend is deprecated and only available on Ruby 1.8."
+ ewarn "To migrate to the new tokyocabinet-based backend, change the core.db"
+ ewarn "parameter in your bot's conf.yaml to 'tc' and restart rbot."
+ ewarn "This procedure requires a Ruby version supporting both BDB and TC."
+}