diff options
author | Alex Legler <a3li@gentoo.org> | 2012-01-20 23:12:52 +0100 |
---|---|---|
committer | Alex Legler <a3li@gentoo.org> | 2012-01-20 23:12:52 +0100 |
commit | 30c1aa6d94c189d4ee19603f1dba6e9b3be846c7 (patch) | |
tree | ef575c05c8ab9cbebebb668f26c077b72336bb15 | |
parent | Fix double escaping when emailing the finished draft. (diff) | |
download | glsamaker-30c1aa6d94c189d4ee19603f1dba6e9b3be846c7.tar.gz glsamaker-30c1aa6d94c189d4ee19603f1dba6e9b3be846c7.tar.bz2 glsamaker-30c1aa6d94c189d4ee19603f1dba6e9b3be846c7.zip |
Add support for arches.
-rw-r--r-- | app/models/package.rb | 1 | ||||
-rw-r--r-- | app/views/glsa/_show_package_row.txt.erb | 7 | ||||
-rw-r--r-- | app/views/glsa/edit.html.erb | 2 | ||||
-rw-r--r-- | app/views/glsa/show.txt.erb | 10 |
4 files changed, 16 insertions, 4 deletions
diff --git a/app/models/package.rb b/app/models/package.rb index 0e4b3a7..d396c3a 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -13,6 +13,7 @@ class Package < ActiveRecord::Base belongs_to :revision validates :comp, :inclusion => { :in => %w[>= > = <= < *< *<= *> *>=] } + validates :arch, :format => { :with => /^(\*|((alpha|amd64|arm|hppa|ia64|m68k|mips|ppc|ppc64|s390|sh|sparc|x86) )*(alpha|amd64|arm|hppa|ia64|m68k|mips|ppc|ppc64|s390|sh|sparc|x86))$/ } # Mapping XML comparators to internally used ones COMP_MAP = { diff --git a/app/views/glsa/_show_package_row.txt.erb b/app/views/glsa/_show_package_row.txt.erb index 1c6e297..be33882 100644 --- a/app/views/glsa/_show_package_row.txt.erb +++ b/app/views/glsa/_show_package_row.txt.erb @@ -17,7 +17,12 @@ print_vulnerable = (unaffected_versions.size == 0 ? true : false) while vulnerable_versions.size > 0 or unaffected_versions.size > 0 v = (vulnerable_versions.shift if vulnerable_versions.size > 0) || nil line = (v ? "#{v.comp} #{v.version}" : "").center(20) - + + if v and v.arch != '*' + @arches[@packages_count] ||= [] + @arches[@packages_count] += v.arch.split(' ') + end + if print_vulnerable line += "Vulnerable!".rjust(22) print_vulnerable = false diff --git a/app/views/glsa/edit.html.erb b/app/views/glsa/edit.html.erb index 3d5b801..882f503 100644 --- a/app/views/glsa/edit.html.erb +++ b/app/views/glsa/edit.html.erb @@ -75,7 +75,7 @@ <tr> <th><%= image_tag 'icons/atom.png' %> Atom</th> <th class="odd" colspan="2">Version</th> - <th><%= image_tag 'icons/arch.png' %> Arch</th> + <th title="* or space-separated list of arches"><%= image_tag 'icons/arch.png' %> Arch</th> <th class="odd"><%= image_tag 'icons/auto.png' %> Auto</th> </tr> diff --git a/app/views/glsa/show.txt.erb b/app/views/glsa/show.txt.erb index d10efc8..66d9d2f 100644 --- a/app/views/glsa/show.txt.erb +++ b/app/views/glsa/show.txt.erb @@ -1,6 +1,7 @@ <%- @packages = @rev.packages_by_atom @packages_count = 0 - @tf = ::Text::Format.new -%> + @tf = ::Text::Format.new + @arches = {} -%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Gentoo Linux Security Advisory GLSA <%= @glsa.glsa_id %> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -48,8 +49,13 @@ Affected packages <% if @packages_count > 1 -%> ------------------------------------------------------------------- <%= @packages_count %> affected packages -<% # on all of their supported architectures. REMOVE? -%> +<% end -%> +<% if @arches != {} -%> ------------------------------------------------------------------- + <% @arches.each_pair do |num, arches| -%> + # Package <%= num %> only applies to users of these architectures: + <%= arches.sort.join ", " %> + <% end -%> <% end -%> Description |