commit:     6dbe59e6269ce97942db9617250fc8cddd7ee931
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 26 15:46:26 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jan 26 15:46:26 2016 +0000
URL:        https://gitweb.gentoo.org/proj/rbot-gentoo.git/commit/?id=6dbe59e6

!herd: Remove

 gentoo-data.rb | 71 +---------------------------------------------------------
 1 file changed, 1 insertion(+), 70 deletions(-)

diff --git a/gentoo-data.rb b/gentoo-data.rb
index 0be1177..5782ff5 100644
--- a/gentoo-data.rb
+++ b/gentoo-data.rb
@@ -31,7 +31,6 @@
 #GLSA_SRC = 
"http://www.gentoo.org/security/en/glsa/glsa-@GLSA_ID@.xml?passthru=1";
 VALID_PACKAGE_SRC = "/dev/shm/qsearch.txt"
 GLSA_SRC = "#{ENV['PORTDIR']}/metadata/glsa/glsa-@GLSA_ID@.xml"
-HERDS_SRC = 'https://api.gentoo.org/packages/herds.xml'
 PROJECTS_SRC = 'https://api.gentoo.org/metastructure/projects.xml'
 PGO_RESOLVE_URI = 'https://packages.gentoo.org/packages/resolve.json?atom=%s'
 PGO_DATA_URI = 'https://packages.gentoo.org/packages/%s.json'
@@ -145,67 +144,9 @@ class GentooPlugin < Plugin
   def initialize
     super
     @@cached = {}
-    @@cached['herds'] = [0, nil]
     @@cached['projects'] = [0, nil]
     @@cached['pkgindex'] = [0, nil]
     @@cached['alias'] = [0, nil]
-    @@cached['notherds'] = [0, nil]
-  end
-
-  def herd(m, params)
-    now = Time.now.tv_sec
-    unless @@cached['herds'] and @@cached['herds'][0] > now-600
-      #m.reply "Fetch #{@@cached['herds'][0]} > #{now-600}"
-      res = @bot.httputil.get(HERDS_SRC)
-      herds = REXML::Document.new(res)
-      @@cached['herds'] = [now, herds]
-    else
-      #m.reply "Cache #{@@cached['herds'][0]} > #{now-600}"
-      herds = @@cached['herds'][1]
-    end
-
-    unless @@cached['notherds'] and @@cached['notherds'][0] > now-600
-      notherds = {}
-      File.foreach("#{scriptdir}/not-a-herd.txt") { |line|
-        k,v = line.split(/\s+/, 2)
-        notherds[k] = v
-      }
-      if notherds.length > 0
-        @@cached['notherds'] = [now, notherds]
-      else
-        @@cached['notherds'] = [0, nil]
-      end
-    else
-      notherds = @@cached['notherds'][1]
-    end
-
-    # Parse data
-    # xpath queries with REXML appear to be extremely slow, which is why we 
took the approach below
-    herd = nil
-    herds.elements[1].each_element { |elem|
-        if elem.get_elements('name')[0].text == params[:herd]
-          herd = elem
-          break
-        end }
-    if herd
-      emails = []
-      for maintainer in herd.get_elements("maintainer")
-        emails << maintainer.get_elements('email')[0].text.split('@')[0]
-      end
-      for project in herd.get_elements("maintainingproject")
-        res = 
@bot.httputil.get("http://www.gentoo.org/#{project.text}?passthru=1";)
-        proj_xml = REXML::Document.new(res)
-        for dev in proj_xml.get_elements("/project/dev")
-          emails << dev.text
-        end
-      end
-      m.reply "(#{params[:herd]}) #{emails.sort.join(', ')}"
-    elsif notherds.has_key?(params[:herd])
-      herddata = notherds[params[:herd]]
-      m.reply "(#{params[:herd]}) #{herddata}"      
-    else
-      m.reply "No such herd #{params[:herd]}"
-    end
   end
 
   def project(m, params)
@@ -420,14 +361,13 @@ class GentooPlugin < Plugin
   end
 
   @@help_gentoo = {
-    "gentoo" => "Available commands: #{Bold}meta#{Bold}, 
#{Bold}changelog#{Bold}, #{Bold}devaway#{Bold}, #{Bold}herd#{Bold}, 
#{Bold}proj#{Bold}, #{Bold}expn#{Bold}, #{Bold}glsa#{Bold}, 
#{Bold}earch#{Bold}, #{Bold}rdep#{Bold}, #{Bold}ddep#{Bold}, 
#{Bold}pdep#{Bold}",
+    "gentoo" => "Available commands: #{Bold}meta#{Bold}, 
#{Bold}changelog#{Bold}, #{Bold}devaway#{Bold}, #{Bold}proj#{Bold}, 
#{Bold}expn#{Bold}, #{Bold}glsa#{Bold}, #{Bold}earch#{Bold}, 
#{Bold}rdep#{Bold}, #{Bold}ddep#{Bold}, #{Bold}pdep#{Bold}",
     "meta" => [
             "meta #{Bold}[cat/]package#{Bold} : Print metadata for the given 
package",
             "meta -v #{Bold}[cat/]package#{Bold} : Print metadata for the 
given package and the members of the maintaining projects.",
             ].join("\n"),
     "changelog" => "changelog #{Bold}[cat/]package#{Bold} : Produce changelog 
statistics for a given package",
     "devaway" => "devaway #{Bold}devname|list#{Bold} : Print the .away for a 
developer (if any). Using 'list' shows the developers who are away.",
-    "herd" => "herd #{Bold}herdname#{Bold} : Print the members of a herd.",
     "proj" => "proj #{Bold}project-email#{Bold} : Print the members of a 
project.",
     "expn" => "expn #{Bold}alias#{Bold} : Print the addresses on a Gentoo mail 
alias.",
     "glsa" => [
@@ -459,7 +399,6 @@ plugin.default_auth( 'view', true )
 
 REGEX_CP = /^(?:[-[:alnum:]]+\/)?[-+_[:alnum:]]+$/
 REGEX_DEV = /^[-_[:alnum:]]+$/
-REGEX_HERD = /^[-_[:alnum:]]+$/
 REGEX_PROJECT = /^[-_@.[:alnum:]]+$/
 REGEX_GLSA = /^[-1234567890]+$/
 
@@ -510,14 +449,6 @@ plugin.map 'away :dev',
   :thread => 'yes',
   :auth_path => 'view'
 
-plugin.map 'herd :herd',
-  :requirements => {
-    :herd => REGEX_HERD,
-  },
-  :action => 'herd',
-  :thread => 'yes',
-  :auth_path => 'view'
-
 plugin.map 'proj :project',
   :requirements => {
     :project => REGEX_PROJECT,

Reply via email to