From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Mar 26 12:10:19 2004 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8354416A4D0 for ; Fri, 26 Mar 2004 12:10:19 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5DF3543D4C for ; Fri, 26 Mar 2004 12:10:19 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i2QKAJbv074318 for ; Fri, 26 Mar 2004 12:10:19 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.10/8.12.10/Submit) id i2QKAJoQ074317; Fri, 26 Mar 2004 12:10:19 -0800 (PST) (envelope-from gnats) Resent-Date: Fri, 26 Mar 2004 12:10:19 -0800 (PST) Resent-Message-Id: <200403262010.i2QKAJoQ074317@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, David Bushong Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1EF4216A4CE for ; Fri, 26 Mar 2004 12:08:11 -0800 (PST) Received: from bushong.net (bushong.net [216.36.66.245]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8DA0043D46 for ; Fri, 26 Mar 2004 12:08:10 -0800 (PST) (envelope-from dbushong@bushong.net) Received: from firebat.davedawn.net (dbushong@localhost [127.0.0.1]) by bushong.net (8.12.6p2/8.12.7) with ESMTP id i2QK8A6N047572 for ; Fri, 26 Mar 2004 12:08:10 -0800 (PST) (envelope-from dbushong@firebat.davedawn.net) Received: (from dbushong@localhost) by firebat.davedawn.net (8.12.6p2/8.12.7/Submit) id i2QK8ACN047571; Fri, 26 Mar 2004 12:08:10 -0800 (PST) (envelope-from dbushong) Message-Id: <200403262008.i2QK8ACN047571@firebat.davedawn.net> Date: Fri, 26 Mar 2004 12:08:10 -0800 (PST) From: David Bushong To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/64782: misc fixes to irc/rbot port for ruby 1.8 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2004 20:10:19 -0000 >Number: 64782 >Category: ports >Synopsis: misc fixes to irc/rbot port for ruby 1.8 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: maintainer-update >Submitter-Id: current-users >Arrival-Date: Fri Mar 26 12:10:18 PST 2004 >Closed-Date: >Last-Modified: >Originator: David Bushong >Release: FreeBSD 4.8-PRERELEASE i386 >Organization: >Environment: System: FreeBSD firebat.bushong.net 4.8-PRERELEASE FreeBSD 4.8-PRERELEASE #5: Sun Mar 2 11:58:22 PST 2003 dbushong@firebat.bushong.net:/stripe/obj/usr/src/sys/FIREBAT i386 >Description: There are a number of errors and warnings in rbot under ruby v1.8.x; this addresses many, hopefully backward compatibly >How-To-Repeat: apply patch >Fix: diff -ruN rbot.bak/Makefile rbot/Makefile --- rbot.bak/Makefile Fri Mar 26 11:59:40 2004 +++ rbot/Makefile Fri Mar 26 12:07:10 2004 @@ -7,6 +7,7 @@ PORTNAME= rbot PORTVERSION= 0.9.6 +PORTREVISION= 1 CATEGORIES= irc ruby MASTER_SITES= http://linuxbrit.co.uk/downloads/ @@ -22,6 +23,8 @@ post-patch: @${RUBY} -pi -e 'sub /rbotconf/, "${PREFIX}/etc/rbot"' ${WRKSRC}/rbot.rb + @rm ${WRKSRC}/rbot/*.orig + @rm ${WRKSRC}/rbot/plugins/*.orig do-install: ${INSTALL_SCRIPT} ${WRKSRC}/rbot.rb ${PREFIX}/bin/rbot diff -ruN rbot.bak/files/patch-18-syntax rbot/files/patch-18-syntax --- rbot.bak/files/patch-18-syntax Wed Dec 31 16:00:00 1969 +++ rbot/files/patch-18-syntax Thu Mar 25 18:53:08 2004 @@ -0,0 +1,101 @@ +--- rbot/ircbot.rb.orig Thu Mar 25 17:25:59 2004 ++++ rbot/ircbot.rb Thu Mar 25 17:26:12 2004 +@@ -604,7 +604,7 @@ + when (/^(version)|(introduce yourself)$/) + say m.replyto, "I'm a v. #{$version} rubybot, (c) Tom Gilbert - http://linuxbrit.co.uk/rbot/" + when (/^help(?:\s+(.*))?$/) +- say m.replyto, help $1 ++ say m.replyto, help($1) + when (/^(botsnack|ciggie)$/) + say m.replyto, @lang.get("thanks_X") % m.sourcenick if(m.public?) + say m.replyto, @lang.get("thanks") if(m.private?) +--- rbot/dbhash.rb.orig Thu Mar 25 18:00:33 2004 ++++ rbot/dbhash.rb Thu Mar 25 18:03:58 2004 +@@ -63,17 +63,17 @@ + + def DBHash.create_db(name) + debug "DBHash: creating empty db #{name}" +- return BDB::Hash.open name, nil, ++ return BDB::Hash.open(name, nil, + BDB::CREATE | BDB::EXCL | BDB::TRUNCATE, + 0600, "set_pagesize" => 1024, +- "set_cachesize" => [0, 32 * 1024, 0] ++ "set_cachesize" => [0, 32 * 1024, 0]) + end + + def DBHash.open_db(name) + debug "DBHash: opening existing db #{name}" +- return BDB::Hash.open name, nil, ++ return BDB::Hash.open(name, nil, + "r+", 0600, "set_pagesize" => 1024, +- "set_cachesize" => [0, 32 * 1024, 0] ++ "set_cachesize" => [0, 32 * 1024, 0]) + end + + end +@@ -108,17 +108,17 @@ + + def DBTree.create_db(name) + debug "DBTree: creating empty db #{name}" +- return BDB::CIBtree.open name, nil, ++ return BDB::CIBtree.open(name, nil, + BDB::CREATE | BDB::EXCL | BDB::TRUNCATE, + 0600, "set_pagesize" => 1024, +- "set_cachesize" => [0, 32 * 1024, 0] ++ "set_cachesize" => [0, 32 * 1024, 0]) + end + + def DBTree.open_db(name) + debug "DBTree: opening existing db #{name}" +- return BDB::CIBtree.open name, nil, ++ return BDB::CIBtree.open(name, nil, + "r+", 0600, "set_pagesize" => 1024, +- "set_cachesize" => [0, 32 * 1024, 0] ++ "set_cachesize" => [0, 32 * 1024, 0]) + end + + end +--- rbot/keywords.rb.orig Thu Mar 25 17:56:45 2004 ++++ rbot/keywords.rb Thu Mar 25 17:59:31 2004 +@@ -22,7 +22,7 @@ + # pick a random value for this keyword and return it + def to_s + if(@values.length > 1) +- Keyword.unescape @values[rand @values.length] ++ Keyword.unescape @values[rand(@values.length)] + else + Keyword.unescape @values[0] + end +--- rbot/language.rb.orig Thu Mar 25 17:59:39 2004 ++++ rbot/language.rb Thu Mar 25 18:00:05 2004 +@@ -34,7 +34,7 @@ + + def get(key) + if(@strings.has_key?(key)) +- return @strings[key][rand @strings[key].length] ++ return @strings[key][rand(@strings[key].length)] + else + raise "undefined language key" + end +--- rbot/plugins.rb.orig Thu Mar 25 18:07:07 2004 ++++ rbot/plugins.rb Thu Mar 25 18:08:05 2004 +@@ -48,7 +48,7 @@ + def initialize + @bot = Plugins.bot + @names = Array.new +- @registry = BotRegistryAccessor.new(@bot, self.type.to_s.gsub(/^.*::/, "")) ++ @registry = BotRegistryAccessor.new(@bot, self.class.to_s.gsub(/^.*::/, "")) + end + + # return an identifier for this plugin, defaults to a list of the message +--- rbot/registry.rb.orig Thu Mar 25 18:04:02 2004 ++++ rbot/registry.rb Thu Mar 25 18:04:16 2004 +@@ -149,7 +149,7 @@ + if @registry.has_key?(@prefix + key) + return restore(@registry[@prefix + key]) + elsif @default != nil +- return restore @default ++ return restore(@default) + else + return nil + end diff -ruN rbot.bak/files/patch-dice-roll rbot/files/patch-dice-roll --- rbot.bak/files/patch-dice-roll Wed Dec 31 16:00:00 1969 +++ rbot/files/patch-dice-roll Thu Mar 25 17:35:31 2004 @@ -0,0 +1,18 @@ +--- rbot/plugins/dice.rb.orig Thu Mar 25 17:33:36 2004 ++++ rbot/plugins/dice.rb Mon Aug 5 14:58:04 2002 +@@ -30,7 +30,7 @@ + + class DicePlugin < Plugin + def help(plugin, topic="") +- "dice (where is something like: d6 or 2d6 or 2d6+4 or 2d6+1d20 or 2d6+1d5+4d7-3d4-6) => Rolls that set of virtual dice" ++ "#{plugin} (where is something like: d6 or 2d6 or 2d6+4 or 2d6+1d20 or 2d6+1d5+4d7-3d4-6) => Rolls that set of virtual dice" + end + + def rolldice(d) +@@ -77,5 +77,6 @@ + end + plugin = DicePlugin.new + plugin.register("dice") ++plugin.register("roll") + ############################################## + #fin diff -ruN rbot.bak/files/patch-karma rbot/files/patch-karma --- rbot.bak/files/patch-karma Wed Dec 31 16:00:00 1969 +++ rbot/files/patch-karma Thu Mar 25 18:11:53 2004 @@ -0,0 +1,14 @@ +--- rbot/plugins/karma.rb.orig Thu Mar 25 18:09:37 2004 ++++ rbot/plugins/karma.rb Thu Mar 25 18:11:01 2004 +@@ -34,9 +34,9 @@ + if(m.kind_of?(PrivMessage) && m.public?) + # in channel message, the kind we are interested in + if(m.message =~ /(\+\+|--)/) +- string = m.message.sub(/\W(--|\+\+)(\(.*?\)|[^(++)(--)\s]+)/, "\2\1") ++ string = m.message.sub(/\W(--|\+\+)(\(.*?\)|[^-+\s]+)/, "\2\1") + seen = Hash.new +- while(string.sub!(/(\(.*?\)|[^(++)(--)\s]+)(\+\+|--)/, "")) ++ while(string.sub!(/(\(.*?\)|[^-+\s]+)(\+\+|--)/, "")) + key = $1 + change = $2 + next if seen[key] diff -ruN rbot.bak/files/patch-lart-suth rbot/files/patch-lart-suth --- rbot.bak/files/patch-lart-suth Wed Dec 31 16:00:00 1969 +++ rbot/files/patch-lart-suth Thu Mar 25 17:36:44 2004 @@ -0,0 +1,18 @@ +--- rbot/plugins/lart.rb.orig Thu Mar 25 17:33:36 2004 ++++ rbot/plugins/lart.rb Wed Aug 7 12:59:24 2002 +@@ -21,6 +21,7 @@ + # Keep a 1:1 relation between commands and handlers + @@handlers = { + "lart" => "handle_lart", ++ "suth" => "handle_lart", + "praise" => "handle_praise", + "addlart" => "handle_addlart", + "rmlart" => "handle_rmlart", +@@ -152,6 +153,7 @@ + end + plugin = LartPlugin.new + plugin.register("lart") ++plugin.register("suth") + plugin.register("praise") + + plugin.register("addlart") diff -ruN rbot.bak/files/patch-math rbot/files/patch-math --- rbot.bak/files/patch-math Wed Dec 31 16:00:00 1969 +++ rbot/files/patch-math Thu Mar 25 17:37:34 2004 @@ -0,0 +1,28 @@ +--- rbot/plugins/math.rb.orig Thu Mar 25 17:33:36 2004 ++++ rbot/plugins/math.rb Mon Jan 27 11:52:37 2003 +@@ -77,13 +77,13 @@ + expr.gsub!(/\bover /, "/ ") + expr.gsub!(/\bsquared/, "**2 ") + expr.gsub!(/\bcubed/, "**3 ") +- expr.gsub!(/\bto\s+(\d+)(r?st|nd|rd|th)?( power)?/, "**#$1 ") ++ expr.gsub!(/\bto\s+(\d+)(r?st|nd|rd|th)?( power)?/, '**\1 ') + expr.gsub!(/\bpercent of/, "*0.01*") + expr.gsub!(/\bpercent/, "*0.01") + expr.gsub!(/\% of\b/, "*0.01*") + expr.gsub!(/\%/, "*0.01") +- expr.gsub!(/\bsquare root of (\d+)/, "#$1 ** 0.5 ") +- expr.gsub!(/\bcubed? root of (\d+)/, "#$1 **(1.0/3.0) ") ++ expr.gsub!(/\bsquare root of (\d+)/, '\1 ** 0.5 ') ++ expr.gsub!(/\bcubed? root of (\d+)/, '\1 **(1.0/3.0) ') + expr.gsub!(/ of /, " * ") + expr.gsub!(/(bit(-| )?)?xor(\'?e?d( with))?/, "^") + expr.gsub!(/(bit(-| )?)?or(\'?e?d( with))?/, "|") +@@ -101,7 +101,7 @@ + if answer =~ /^[-+\de\.]+$/ + answer = sprintf("%1.12f", answer) + answer.gsub!(/\.?0+$/, "") +- answer.gsub!(/(\.\d+)000\d+/, $1) ++ answer.gsub!(/(\.\d+)000\d+/, '\1') + if (answer.length > 30) + answer = "a number with >30 digits..." + end diff -ruN rbot.bak/files/patch-url rbot/files/patch-url --- rbot.bak/files/patch-url Wed Dec 31 16:00:00 1969 +++ rbot/files/patch-url Thu Mar 25 17:38:31 2004 @@ -0,0 +1,11 @@ +--- rbot/plugins/url.rb.orig Thu Mar 25 17:33:36 2004 ++++ rbot/plugins/url.rb Wed Aug 21 11:58:41 2002 +@@ -42,7 +42,7 @@ + else + m.reply "in a private message, you need to specify a channel name for urls" + end +- when (/^(#.*?)\s+\d+$/) ++ when (/^(#.*?)\s+(\d+)$/) + channel = $1 + max = $2.to_i + urls m, channel, max diff -ruN rbot.bak/pkg-descr rbot/pkg-descr --- rbot.bak/pkg-descr Wed Jul 31 16:52:42 2002 +++ rbot/pkg-descr Fri Mar 26 12:06:37 2004 @@ -6,26 +6,7 @@ * Built in infobot-style keywords. See example session below. * Support for underlying fact database (infobot fact files), which can be overridden or supplemented by runtime keyword controls - * Powerful plugin architecture, comes with plugins for: - o DNS queries - o Babelfish translation - o Google searching - o Excuse generation - o Insult generation - o Karma - o Checking the weather - o Querying slashdot - o Doing Math - o Per-channel quote storage, searching and retrieval - o Reminders - o rot13 translation - o Check the spelling of a word - o Webserver Server: header examination - o RPG dice rolling (thanks to David Dorward) - o Slapping people :) - o larting people - o conversation stats - o more... + * Powerful plugin architecture, comes with plugins for many functions. * Multi-language support - comes with english definition only so far - translations welcome diff -ruN rbot.bak/pkg-message rbot/pkg-message --- rbot.bak/pkg-message Wed Dec 31 16:00:00 1969 +++ rbot/pkg-message Fri Mar 26 12:01:31 2004 @@ -0,0 +1,4 @@ +NOTE! If you are upgrading from Ruby 1.6.x to 1.8.x, the Marshal serialization +format has changed, and your plugin_registry.db will BREAK! I fixed this by +compiling marshal.c from the Ruby 1.6 distribution into a module for Ruby 1.8, +then writing a converter. YMMV. >Release-Note: >Audit-Trail: >Unformatted: