diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MGA/Advisories.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index d03a632..3a446e5 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -516,6 +516,33 @@ sub move_packages { } } +sub generate_description { + my ($adv, $rpm) = @_; + my $desc = "%package $rpm\n"; + $desc .= "Importance: " . %$adv{type} ."\n"; + $desc .= "ID: " . %$adv{ID} . "\n"; + $desc .= "%pre\n"; + $desc .= %$adv{description} . "\n"; + $desc .= "References:\n"; + for my $ref (@{%$adv{references}}) { + $desc .= "- $ref\n"; + } + $desc; +} + +sub get_srpm_to_advisory_map { + my ($advdb, $rel, $media) = @_; + my %srpm2advisory; + foreach my $adv (keys %{$advdb->{advisories}}) { + next unless exists $advdb->{advisories}{$adv}{src}{$rel}; + next unless exists $advdb->{advisories}{$adv}{src}{$rel}{$media}; + foreach my $src (@{$advdb->{advisories}{$adv}{src}{$rel}{$media}}) { + $srpm2advisory{$src} = $adv; + } + } + return \%srpm2advisory; +} + sub publish_advisories { my ($advdb) = @_; foreach my $adv (sort keys %{$advdb->{advisories}}) { |