aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-07-31 00:44:13 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2008-07-31 00:44:13 +0000
commitfba8ed82f98f024b5d4a29bb2b1694c136242937 (patch)
tree17251a152f468ec83241805948fbe341225980d3
parentShorter TODO. (diff)
downloadrbot-gentoo-fba8ed82f98f024b5d4a29bb2b1694c136242937.tar.gz
rbot-gentoo-fba8ed82f98f024b5d4a29bb2b1694c136242937.tar.bz2
rbot-gentoo-fba8ed82f98f024b5d4a29bb2b1694c136242937.zip
Convert to a local copy of qsearch for package name validation.
-rw-r--r--gentoo-data.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/gentoo-data.rb b/gentoo-data.rb
index bac0699..135ee01 100644
--- a/gentoo-data.rb
+++ b/gentoo-data.rb
@@ -27,6 +27,9 @@
# end
#end
+#VALID_PACKAGE_SRC = "http://tinderbox.dev.gentoo.org/misc/qsearch.txt"
+VALID_PACKAGE_SRC = "/dev/shm/qsearch.txt"
+
class GentooPlugin < Plugin
Config.register Config::StringValue.new('gentoo.scriptdir',
:requires_rescan => true,
@@ -60,7 +63,7 @@ class GentooPlugin < Plugin
icp = params[:pkg]
cp = validate_package(m, icp)
return if cp.nil?
- m.reply "#{icp}/#{cp} is valid"
+ m.reply "#{icp} => #{cp} is valid"
end
def meta_verbose(m, params)
@@ -198,7 +201,11 @@ class GentooPlugin < Plugin
@@cached['pkgindex'] = [0, nil] unless
unless @@cached.key?('pkgindex') and @@cached['pkgindex'][0] > now-600
#m.reply "Fetch #{@@cached['pkgindex'][0]} > #{now-600}"
- pkgindex_a = @bot.httputil.get("http://tinderbox.dev.gentoo.org/misc/qsearch.txt").split("\n")
+ if (VALID_PACKAGE_SRC =~ /^http/) == 0
+ pkgindex_a = @bot.httputil.get(VALID_PACKAGE_SRC).split("\n")
+ else
+ pkgindex_a = File.readlines(VALID_PACKAGE_SRC)
+ end
pkgindex = {}
pkgindex_a.each do |pkg|
cp, desc = pkg.split(' ', 2)