Permalink
Browse files

use Bugzilla api to retrieve bugs and their titles and last_updated

  • Loading branch information...
1 parent 49e8bbe commit f2e9a8f6665506e8cca607ca78f3b1fb17d35209 @kendhia kendhia committed with movitto Jan 9, 2013
Showing with 5 additions and 8 deletions.
  1. +5 −8 app/models/fedora_rpm.rb
View
@@ -175,17 +175,14 @@ def retrieve_bugs
puts "Importing rpm #{name} bugs"
self.bugs.clear
- bugzilla_search = URI.parse(bugzilla_url).read
- doc = Nokogiri::HTML(bugzilla_search)
-
# get bugs and their titles and last_updated
- bugs = doc.xpath("//td[@class='bz_short_desc_column']/a").collect { |bz| [bz.attr('href').gsub('show_bug.cgi?id=', ''), bz.text.strip] }
+ xmlrpc = Bugzilla::XMLRPC.new("bugzilla.redhat.com")
+ bugs = Bugzilla::Bug.new(xmlrpc).search("summary" => name, "product" => "fedora")["bugs"]
bugs.each { |bug|
- update = doc.xpath("//tr[@id='b#{bug.first}']//td[@class='bz_changeddate_column']").text
arb = Bug.new
- arb.name = bug.last
- arb.bz_id = bug.first
- arb.last_updated = update
+ arb.name = bug["summary"]
+ arb.bz_id = bug["id"]
+ arb.last_updated = bug["last_change_time"].to_time
arb.is_review = true if arb.name =~ /^Review Request.*#{name}\s.*$/
self.bugs << arb
}

0 comments on commit f2e9a8f

Please sign in to comment.