aboutsummaryrefslogtreecommitdiff
blob: 8afb97c58dc044fbe83e625da64e8a1c7c00ac8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
xml.instruct!
xml.declare! :DOCTYPE, :glsa, :SYSTEM, "http://www.gentoo.org/dtd/glsa.dtd"

xml.glsa :id => glsa.glsa_id do
  xml.title rev.title
  xml.synopsis rev.synopsis
  xml.product({:type => "ebuild"}, rev.product)
  xml.announced glsa.release_date.strftime '%Y-%m-%d'
  xml.revised({:count => "#{rev.release_revision || 'draft'}"}, glsa.revised_date.strftime('%Y-%m-%d'))

  rev.bugs.each do |bug|
    xml.bug bug.bug_id
  end

  xml.access rev.release_access
  logger.debug rev.packages_by_atom.inspect
  xml.affected do
    rev.packages_by_atom.each_pair do |package, atoms|
      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)
        end
        (atoms['vulnerable'] || []).each do |a|
          xml.vulnerable({:range => a.xml_comp}, a.version)
        end
      end
    end
  end

  xml.background do
    xml << xml_format(rev.background || "")
  end

  xml.description do
    xml << xml_format(rev.description || "")
  end

  xml.impact({:type => rev.severity}) do
    xml << xml_format(rev.impact || "")
  end

  xml.workaround do
    xml << xml_format(rev.workaround || "")
  end

  xml.resolution do
    xml << xml_format(rev.resolution || "")
  end

  xml.references do
    rev.references.each do |ref|
      xml.uri({:link => ref.url}, ref.title)
    end
  end

  xml.metadata({:tag => 'requester', :timestamp => glsa.created_at.iso8601}, glsa.requester.login)

  if glsa.submitter
    xml.metadata({:tag => 'submitter', :timestamp => rev.created_at.iso8601}, glsa.submitter.login)
  end

  if glsa.bugreadymaker
    xml.metadata({:tag => 'bugReady', :timestamp => Time.now.iso8601}, glsa.bugreadymaker.login)
  end
end