diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/glsa_controller.rb | 6 | ||||
-rw-r--r-- | app/views/glsa/_glsa.xml.builder | 12 | ||||
-rw-r--r-- | app/views/glsa/_package.html.erb | 1 | ||||
-rw-r--r-- | app/views/glsa/_show_package_row.txt.erb | 14 | ||||
-rw-r--r-- | app/views/glsa/edit.html.erb | 3 | ||||
-rw-r--r-- | app/views/glsa/show.html.erb | 4 |
6 files changed, 30 insertions, 10 deletions
diff --git a/app/controllers/glsa_controller.rb b/app/controllers/glsa_controller.rb index d6408ab..b7a98fa 100644 --- a/app/controllers/glsa_controller.rb +++ b/app/controllers/glsa_controller.rb @@ -246,7 +246,7 @@ class GlsaController < ApplicationController next if package[:atom].strip == '' begin - revision.packages.create!(package.permit([:atom, :comp, :version, :arch, :automatic, :my_type])) + revision.packages.create!(package.permit([:atom, :comp, :version, :arch, :automatic, :my_type, :slot])) rescue ActiveRecord::RecordInvalid => e flash[:error] = "Errors occurred while saving a package: #{e.record.errors.full_messages.join ', '}" set_up_editing @@ -467,8 +467,8 @@ class GlsaController < ApplicationController protected def set_up_editing # Packages - @rev.vulnerable_packages.build(:comp => "<", :arch => "*") if @rev.vulnerable_packages.length == 0 - @rev.unaffected_packages.build(:comp => ">=", :arch => "*") if @rev.unaffected_packages.length == 0 + @rev.vulnerable_packages.build(:comp => "<", :slot => "*", :arch => "*") if @rev.vulnerable_packages.length == 0 + @rev.unaffected_packages.build(:comp => ">=", :slot => "*", :arch => "*") if @rev.unaffected_packages.length == 0 # References if params.has_key? :glsa and params[:glsa].has_key? :reference diff --git a/app/views/glsa/_glsa.xml.builder b/app/views/glsa/_glsa.xml.builder index 2213f65..0fe529d 100644 --- a/app/views/glsa/_glsa.xml.builder +++ b/app/views/glsa/_glsa.xml.builder @@ -19,10 +19,18 @@ xml.glsa :id => glsa.glsa_id do xml.package({:name => package, :auto => (atoms['unaffected'] || []).select {|a| !a.automatic}.length == 0 ? 'yes' : 'no', :arch => (atoms['vulnerable'].nil? || atoms['vulnerable'].length == 0) ? '*' : atoms['vulnerable'].first.arch}) do (atoms['unaffected'] || []).each do |a| - xml.unaffected({:range => a.xml_comp}, a.version) + if a.slot != '*' + xml.unaffected({:range => a.xml_comp, :slot => a.slot}, a.version) + else + xml.unaffected({:range => a.xml_comp}, a.version) + end end (atoms['vulnerable'] || []).each do |a| - xml.vulnerable({:range => a.xml_comp}, a.version) + if a.slot != '*' + xml.vulnerable({:range => a.xml_comp, :slot => a.slot}, a.version) + else + xml.vulnerable({:range => a.xml_comp}, a.version) + end end end end diff --git a/app/views/glsa/_package.html.erb b/app/views/glsa/_package.html.erb index 73203d9..5e3d115 100644 --- a/app/views/glsa/_package.html.erb +++ b/app/views/glsa/_package.html.erb @@ -4,6 +4,7 @@ <td><%= pf.text_field :atom, :class => :nice, :index => nil %></td> <td class="odd"><%= pf.select :comp, comps, {}, :index => nil %></td> <td class="odd"><%= pf.text_field :version, :class => :nice, :size => 10, :index => nil %></td> + <td class="odd"><%= pf.text_field :slot, :class => :nice, :size => 5, :index => nil %></td> <td><%= pf.text_field :arch, :class => :nice, :size => 7, :index => nil %></td> <td class="odd"><%= pf.select :automatic, [["yes", true], ["no", false]], {}, :index => nil %></td> <td><%= link_to_function( diff --git a/app/views/glsa/_show_package_row.txt.erb b/app/views/glsa/_show_package_row.txt.erb index be33882..31d3186 100644 --- a/app/views/glsa/_show_package_row.txt.erb +++ b/app/views/glsa/_show_package_row.txt.erb @@ -16,7 +16,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) + print_slot = (v.slot != '*' ? true : false) + if print_slot + line = (v ? "#{v.comp} #{v.version}:#{v.slot}" : "").center(20) + else + line = (v ? "#{v.comp} #{v.version}" : "").center(20) + end if v and v.arch != '*' @arches[@packages_count] ||= [] @@ -28,7 +33,12 @@ while vulnerable_versions.size > 0 or unaffected_versions.size > 0 print_vulnerable = false else v = (unaffected_versions.shift if unaffected_versions.size > 0) || nil - line += (v ? "#{v.comp} #{v.version} #{v.automatic ? "" : (@print_noauto = true && "*")}" : "").rjust(22) + print_slot = (v.slot != '*' ? true : false) + if print_slot + line += (v ? "#{v.comp} #{v.version}:#{v.slot} #{v.automatic ? "" : (@print_noauto = true && "*")}" : "").rjust(22) + else + line += (v ? "#{v.comp} #{v.version} #{v.automatic ? "" : (@print_noauto = true && "*")}" : "").rjust(22) + end end versions << line end diff --git a/app/views/glsa/edit.html.erb b/app/views/glsa/edit.html.erb index 882f503..000d1be 100644 --- a/app/views/glsa/edit.html.erb +++ b/app/views/glsa/edit.html.erb @@ -75,6 +75,7 @@ <tr> <th><%= image_tag 'icons/atom.png' %> Atom</th> <th class="odd" colspan="2">Version</th> + <th title="* or slot">Slot</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> @@ -173,4 +174,4 @@ GLSAMaker.editing.templates.observeClick($('impact')); GLSAMaker.editing.templates.observeClick($('workaround')); GLSAMaker.editing.templates.observeClick($('resolution')); -</script>
\ No newline at end of file +</script> diff --git a/app/views/glsa/show.html.erb b/app/views/glsa/show.html.erb index a0965f9..1da1a94 100644 --- a/app/views/glsa/show.html.erb +++ b/app/views/glsa/show.html.erb @@ -90,7 +90,7 @@ <td> <ul> <% @rev.packages.each do |pkg| ; next unless pkg.my_type == "unaffected" %> - <li><%= pkg.comp %><strong><%= pkg.atom %></strong>-<%= pkg.version %> on <%= pkg.arch %> (auto: <%= pkg.automatic %>)</li> + <li><%= pkg.comp %><strong><%= pkg.atom %></strong>-<%= pkg.version %>:<%= pkg.slot %> on <%= pkg.arch %> (auto: <%= pkg.automatic %>)</li> <% end %> </ul> </td> @@ -100,7 +100,7 @@ <td> <ul> <% @rev.packages.each do |pkg| ; next unless pkg.my_type == "vulnerable" %> - <li><%= pkg.comp %><strong><%= pkg.atom %></strong>-<%= pkg.version %> on <%= pkg.arch %> (auto: <%= pkg.automatic %>)</li> + <li><%= pkg.comp %><strong><%= pkg.atom %></strong>-<%= pkg.version %>:<%= pkg.slot %> on <%= pkg.arch %> (auto: <%= pkg.automatic %>)</li> <% end %> </ul> </td> |