From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- net-irc/rbot/Manifest | 11 ++ net-irc/rbot/files/rbot-rakefile-gettext.patch | 13 ++ net-irc/rbot/files/rbot.conf | 22 +++ net-irc/rbot/files/rbot.conf2 | 26 ++++ net-irc/rbot/files/rbot.init | 54 +++++++ net-irc/rbot/files/rbot.init2 | 53 +++++++ net-irc/rbot/metadata.xml | 65 ++++++++ net-irc/rbot/rbot-0.9.15_p20160325-r1.ebuild | 199 +++++++++++++++++++++++++ net-irc/rbot/rbot-0.9.15_p20160325.ebuild | 189 +++++++++++++++++++++++ 9 files changed, 632 insertions(+) create mode 100644 net-irc/rbot/Manifest create mode 100644 net-irc/rbot/files/rbot-rakefile-gettext.patch create mode 100644 net-irc/rbot/files/rbot.conf create mode 100644 net-irc/rbot/files/rbot.conf2 create mode 100644 net-irc/rbot/files/rbot.init create mode 100644 net-irc/rbot/files/rbot.init2 create mode 100644 net-irc/rbot/metadata.xml create mode 100644 net-irc/rbot/rbot-0.9.15_p20160325-r1.ebuild create mode 100644 net-irc/rbot/rbot-0.9.15_p20160325.ebuild (limited to 'net-irc/rbot') diff --git a/net-irc/rbot/Manifest b/net-irc/rbot/Manifest new file mode 100644 index 000000000000..d3509912e17d --- /dev/null +++ b/net-irc/rbot/Manifest @@ -0,0 +1,11 @@ +AUX rbot-rakefile-gettext.patch 376 SHA256 646e77e0ec84e3822f4371c78854bfc6865325e3391f5b4f405190ed70cbf5c5 SHA512 240de2ffdb6f81910f1ec5cee74a3754f5282aa636fbb0b99305a46936cd727527f2fa14e34be88a11093b89ae5a4d907b87e8c6df1279f4a612a3a5729dbe02 WHIRLPOOL 9728533616368c2f4f96352466edb8809c85ff2bef1c4213e6ad9a7a7d7ab27c602e455fbec2159fcf4493f1c8202cc13891bf2a339c3d87dcb3f572a6366754 +AUX rbot.conf 944 SHA256 89ccc3e036414c2a4b1ba8338408cc9a5b89c3bfae4268a27fb9c6094bcc95f6 SHA512 fa68050203a50cbcb8a8ec95f4cf7864d614eb23f75fa43a2236796851da590399096d3871c11a012aa58dd2466af454d5f099eb6c9b4bc0eea2110d5cb926b4 WHIRLPOOL 29557e61deb3abd13f2baea145fb3613816c9c4e18ee314ebbd8085691d05ebfeaaf2d080f4c54eaa86eb0e82bcac3f10f3080814d97f4487c80a42302d7e319 +AUX rbot.conf2 1111 SHA256 22c2b489846c56d054f3e88e1763486bcb59df621c288e8b816fd2a109b08742 SHA512 19f96fdcdd7c312da58f22f1ca089cf4e9bde03273e37ecd179e5fa94e1d59f8ebada435a0f27e7c6c5fae39b9ba575d9e397fa9543d82f846bcc5eb728bd0f8 WHIRLPOOL 7f8fc775a7abcd76c9a3a2987cdf0524c48e72e10bbb66617eb9129dd281c5acd59c40cc432017ad523499bd67ff3af69617168a1d112ff69834557f59a316bc +AUX rbot.init 1459 SHA256 0ea2be247687db9f2bebc051164bfd0070cc197afcda0e9e89d311667b11b485 SHA512 57f5504829ed7524b70102833a5de168f7ea08e594a92ece6d7c0f2eab7de8c9dd14a6d199c5e63b6298209bdf5de4adcb06aded0c23d05c35f7e9774742ecea WHIRLPOOL 29d244c8388b4aa41d4b29654613cb546d5913eb1727bd1b848fc8393218d1896e46d25ce4aed4cb73c42778e701b6b217949edeef71e78edd1facbb5cb02e75 +AUX rbot.init2 1345 SHA256 e6593b52b6ee655ce32f5507e78e57762915444f40c238f725f46ad275a19e09 SHA512 b3d8b83eea4d429a47657f4f9b6cb0aed6c283aa4e7535307305f33bc84c53c0c82e2b76a7cf45ec192c7db68c71e70ee5b000ffbd6f0ff59039de8f69f88dff WHIRLPOOL affe65fee4917f11b1b54763a33f8f690641d253fd66344310126ff64b27acfd5227ded8e687678098ee485cf845e238c66863686843f78e916a7f21f0ec4f96 +DIST rbot-0.9.15_p20160325.tar.gz 762685 SHA256 ae638f53607ad0f1d365ff3c4408ef3c27c8e0f5e83ae355742185c1076ec96e SHA512 b0bc90ee2c6ddb3cdd92cdd5f3a45520d20bc97327b3d694235f7ba94f13ef3c884d4658b083f71bfee2cbeff3cbc7a57c251c4d28bfee293e2556f64e7b4160 WHIRLPOOL e2fbeb41c065ea8642bff49ffade38992c6ab7ccee107d1e140c1810daed869e6e378ac59f7453eeacf8f24e3a980dcb5b911f706475c6f2457a61e3b0483902 +EBUILD rbot-0.9.15_p20160325-r1.ebuild 5382 SHA256 4fc69f35aee71d3204e1bb640f11f0f7a92e642a34e9b08553ed4073f53e7f95 SHA512 ba393920dd86537df7b5cd5aa08e76879613783bf90c8a35c5ca6641dcf7dcadcc78dd056fda47c18e78da0edb69ca59105b79d5b1659fd15b05527fa6944a40 WHIRLPOOL e1e6be5c584534dd45ee18cb1880af47e69f8d2d6450fee73e60a45848064a610972d2e2b5b15711e48003988da5ea1e4809538b15e43808b8d55c2ef597cb44 +EBUILD rbot-0.9.15_p20160325.ebuild 5078 SHA256 83080f4130c2af9654cc542ca754b2a25c4de1c21a4ca3d182bc752b69bf2e55 SHA512 d69608ab6e307de540d9a434c9d62edf75aa87c1b1080277bdb888a1c280689e87f846a3afa850be3cae6d610c327fd887deeadcb2b8a516a0a0859e7a8591a3 WHIRLPOOL a4199c17fa2baefdc56a5c095947d05b51562948b9ce6d1f26affeb6daf291347810752f7eafa9f7d810b7c795c7078a8c738889deb0f91378997db0c50ef890 +MISC ChangeLog 3665 SHA256 7253c91b74699f6deceef8de0809cda1d8fa047aa28baa73844eb8268678a6e1 SHA512 f953dc60668b10b55b3f8d6bdcfdb65bf07bcca748a25640aa7bc54b35d35ba403207a4c7fb31c5e03d7957a8f06d104c9c32999f1c50e62ec2538728d1d3ed0 WHIRLPOOL 831d9bad5db48488cb7d9adfacffa86613c1fdacb12c0d4e9222e382aa79763bbd0d909a0544d01e86c19b7d59da33945c91aa7dc1756ab01d3af7b6aa5ef92b +MISC ChangeLog-2015 10517 SHA256 de7d97c80656a6049d7f2f12646dfd203072075e562aa8803372ba6b9b535700 SHA512 f44bc28a2480c0549b0ee068f3c298061976be113bad0aef59289467a8654af432c8bc4793abe9d2961159d1690fc5df4d9809622cff53ac616891e8adf3db1a WHIRLPOOL ddccb544a4205f4ea30abf9d17308139e40656029af0be1204c6b685e22e88e4544b4d650c3cd370c6a5ca3257633f0b341f2c1d3385780de00cbcec85b45fea +MISC metadata.xml 2656 SHA256 00263ee4376ad48677f9e79b6bb40b91646bc031e4e68fb91011155066305cd1 SHA512 03c3fc8b4f700eb1039feb5f656f772a55c3b928658e494c542cf69d3325d08b2723e23cfb753afe5ea3bad240011e642a4923e9a84673cba1e06b24cfc60918 WHIRLPOOL e7f7143938e17198e30965d9bd16ec4866f603773fa9c9191c4facc760a63aeb7fb6cf880be7ce2e540e17b6b243478eae56612689293e3d4a5ead95f4f1c8a5 diff --git a/net-irc/rbot/files/rbot-rakefile-gettext.patch b/net-irc/rbot/files/rbot-rakefile-gettext.patch new file mode 100644 index 000000000000..4fc3735f4523 --- /dev/null +++ b/net-irc/rbot/files/rbot-rakefile-gettext.patch @@ -0,0 +1,13 @@ +--- Rakefile.old 2013-08-20 01:00:05.000000000 +0200 ++++ Rakefile 2013-10-21 19:42:06.800019343 +0200 +@@ -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..d054665f8604 --- /dev/null +++ b/net-irc/rbot/files/rbot.init @@ -0,0 +1,54 @@ +#!/sbin/openrc-run +# Copyright 2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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..52bb39d0f8a9 --- /dev/null +++ b/net-irc/rbot/files/rbot.init2 @@ -0,0 +1,53 @@ +#!/sbin/openrc-run +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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..9be5ac250eb4 --- /dev/null +++ b/net-irc/rbot/metadata.xml @@ -0,0 +1,65 @@ + + + + + ruby@gentoo.org + Gentoo Ruby Project + + + + Add dependency over dev-ruby/tzinfo to enable the "time" + plugin for rbot. If the USE flag is disabled the plugin is also + disabled by default. + + + 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. + + + Add dependency over dev-ruby/mechanize, which is needed + to enable the "translator" plugin for rbot. If the USE flag is + disabled the plugin is also disabled by default. + + + Add dependency over dev-ruby/shorturl, which is needed + to enable the "shortenurl" plugin for rbot. If the USE flag is + disabled the plugin is also disabled by default. + + + Build and install translation for the messages coming from the bot + and its plugins (through dev-ruby/ruby-gettext). + + + Add dependency over app-misc/figlet, 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. + + + Add dependency over app-misc/toilet, 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. + + + Add dependency over games-misc/fortune-mod, which is + needed to enable the "fortune" plugin for rbot. If the USE flag is + disabled the plugin is also disabled by default. + + + 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. + + + Add dependency over net-dns/bind-tools (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. + + + + ruby-rbot/rbot + + diff --git a/net-irc/rbot/rbot-0.9.15_p20160325-r1.ebuild b/net-irc/rbot/rbot-0.9.15_p20160325-r1.ebuild new file mode 100644 index 000000000000..9d5251d93d3f --- /dev/null +++ b/net-irc/rbot/rbot-0.9.15_p20160325-r1.ebuild @@ -0,0 +1,199 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 +USE_RUBY="ruby21 ruby22 ruby23" + +GITHUB_COMMIT="e358601cc521d8aced941eb928fae2d8c53cf0c2" +inherit ruby-ng eutils user + +DESCRIPTION="A ruby IRC bot" +HOMEPAGE="http://ruby-rbot.org/" +SRC_URI="https://github.com/ruby-rbot/rbot/archive/${GITHUB_COMMIT}.tar.gz -> ${P}.tar.gz" + +LICENSE="|| ( feh GPL-2 )" +SLOT="0" +KEYWORDS="~amd64" +IUSE="spell aspell timezone translator shorturl nls figlet + fortune cal host sqlite toilet" +ILINGUAS="zh_CN zh_TW ru nl de fi fr it ja" +RUBY_S="${PN}-${GITHUB_COMMIT}" + +for lang in $ILINGUAS; do + IUSE="${IUSE} linguas_${lang}" +done + +RUBY_PATCHES=( rbot-rakefile-gettext.patch ) + +RDEPEND+=" + spell? ( + aspell? ( app-text/aspell ) + !aspell? ( app-text/hunspell ) + ) + figlet? ( app-misc/figlet ) + sqlite? ( dev-ruby/sqlite3 ) + 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 " + test? ( + dev-ruby/sqlite3 + ) + 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 ) +" + +pkg_setup() { + enewuser rbot -1 -1 /var/lib/rbot nobody +} + +all_ruby_prepare() { + # Avoid tests that are only compatible with ruby22 + rm -f test/test_journal.rb || die + + # Fix deprecated code that was removed with ruby22 + sed -i -e 's/::Config/::RbConfig/' setup.rb || die + + # Avoid tests for optional dependencies that are not packaged. + sed -i -e '/RegistryDaybreakTest/,/^end/ s:^:#:' test/test_registry.rb || die + + # Avoid broken tests that call code that doesn't exist + rm -f test/test_plugins_threshold.rb || die +} + +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 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_test() { + pushd test || die + ${RUBY} -Ilib:. -e "Dir['test_*'].each{|f| require f}" || die + popd || die +} + +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." +} diff --git a/net-irc/rbot/rbot-0.9.15_p20160325.ebuild b/net-irc/rbot/rbot-0.9.15_p20160325.ebuild new file mode 100644 index 000000000000..48af140afb3e --- /dev/null +++ b/net-irc/rbot/rbot-0.9.15_p20160325.ebuild @@ -0,0 +1,189 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 +USE_RUBY="ruby20 ruby21 ruby22" + +GITHUB_COMMIT="e358601cc521d8aced941eb928fae2d8c53cf0c2" +inherit ruby-ng eutils user + +DESCRIPTION="A ruby IRC bot" +HOMEPAGE="http://ruby-rbot.org/" +SRC_URI="https://github.com/ruby-rbot/rbot/archive/${GITHUB_COMMIT}.tar.gz -> ${P}.tar.gz" + +LICENSE="|| ( feh GPL-2 )" +SLOT="0" +KEYWORDS="~amd64 ~ppc ~x86" +IUSE="spell aspell timezone translator shorturl nls figlet + fortune cal host toilet" +ILINGUAS="zh_CN zh_TW ru nl de fi fr it ja" +RUBY_S="${PN}-${GITHUB_COMMIT}" + +for lang in $ILINGUAS; do + IUSE="${IUSE} linguas_${lang}" +done + +RUBY_PATCHES=( rbot-rakefile-gettext.patch ) + +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 ) +" + +pkg_setup() { + enewuser rbot -1 -1 /var/lib/rbot nobody +} + +all_ruby_prepare() { + # Avoid tests that are only compatible with ruby22 + rm -f test/test_journal.rb || die + + # Fix deprecated code that was removed with ruby22 + sed -i -e 's/::Config/::RbConfig/' setup.rb || die +} + +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 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_test() { + pushd test || die + ${RUBY} -Ilib:. -e "Dir['test_*'].each{|f| require f}" || die + popd || die +} + +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." +} -- cgit v1.2.3