Browse files

Add support for template-filing of bugs.

What this allows is to have a quick way to file bugs by creating a [B]
link that pre-fills most of the bug data for you, including the
assignees, the product, the URL to the log, and so on.

The main comment is set to the `emerge --info` output that has to be
present in the emerge-infos directory with the reverse resolution of
the hostname reporting the log.
  • Loading branch information...
1 parent 514a27d commit 7f952f1d82705145395f77f8d1de0392c3e2cf25 @Flameeyes Flameeyes committed Jun 24, 2012
Showing with 23 additions and 9 deletions.
  1. +1 −0 Gemfile
  2. +18 −8 display.rb
  3. 0 emerge-infos/.gitkeep
  4. +4 −1 views/index.erb
View
1 Gemfile
@@ -8,4 +8,5 @@ end
group :display do
gem 'sinatra'
+ gem 'activesupport'
end
View
26 display.rb
@@ -18,6 +18,8 @@
require 'inifile'
require 'aws'
require 'sinatra'
+require 'active_support'
+require 'active_support/core_ext/object/to_query'
config = IniFile.new("./tboxanalysis.ini")
sdb = AWS::SimpleDB.new(:access_key_id => config['aws']['access_key'],
@@ -33,14 +35,22 @@
order(:date, :desc).
limit(150).
select(:all).map do |data|
- { :name => data.name,
- :host => (data.attributes["host"][0] rescue ""),
- :public_url => (data.attributes["public_url"][0] rescue ""),
- :date => (data.attributes["date"][0] rescue ""),
- :pkg => (data.attributes["pkg"][0] rescue ""),
- :matches => (data.attributes["matches"][0] rescue ""),
- :pkg_failed => (data.attributes["pkg_failed"][0] == "true" rescue false),
- :test_failed => (data.attributes["test_failed"][0] == "true" rescue false),
+ { :name => data.name,
+ :host => (data.attributes["host"][0] rescue ""),
+ :public_url => (data.attributes["public_url"][0] rescue ""),
+ :date => (data.attributes["date"][0] rescue ""),
+ :pkg => (data.attributes["pkg"][0] rescue ""),
+ :matches => (data.attributes["matches"][0] rescue ""),
+ :pkg_failed => (data.attributes["pkg_failed"][0] == "true" rescue false),
+ :test_failed => (data.attributes["test_failed"][0] == "true" rescue false),
+ :bug_template => {
+ :assigned_to => (data.attributes["bug_assignee"][0] rescue "bug-wranglers@gentoo.org"),
+ :cc => (data.attributes["bug_cc"][0] rescue ""),
+ :bug_file_loc => (data.attributes["public_url"][0] rescue ""),
+ :product => "Gentoo Linux",
+ :comment => (File.read("emerge-infos/" + data.attributes["host"][0]) rescue ""),
+ :short_desc => ("#{data.attributes["pkg"][0]}: " rescue ""),
+ }
}
end
View
0 emerge-infos/.gitkeep
No changes.
View
5 views/index.erb
@@ -15,7 +15,10 @@
<% items.each do |item| %>
<tr>
<td><%= item[:host] %></td>
- <td><a href="<%= item[:public_url] %>"><%= item[:pkg] %></a></td>
+ <td>
+ <a href="https://bugs.gentoo.org/enter_bug.cgi?<%= item[:bug_template].to_query %>">[B]</a>
+ <a href="<%= item[:public_url] %>"><%= item[:pkg] %></a>
+ </td>
<td><%= item[:date] %></td>
<td><%= item[:pkg] %></td>
<td>

0 comments on commit 7f952f1

Please sign in to comment.