aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@gmail.com>2015-03-15 18:13:05 +0000
committerPascal Terjan <pterjan@gmail.com>2015-03-15 18:13:05 +0000
commit78920e937bd7a7a73551d924bcaaed09e7923b76 (patch)
tree2ef7d000516bd4862084a4d1ec05737563de1040 /lib
parent7015d490254f40a3903826aa97a3d479b0413b89 (diff)
downloadmgaadvisories-78920e937bd7a7a73551d924bcaaed09e7923b76.tar
mgaadvisories-78920e937bd7a7a73551d924bcaaed09e7923b76.tar.gz
mgaadvisories-78920e937bd7a7a73551d924bcaaed09e7923b76.tar.bz2
mgaadvisories-78920e937bd7a7a73551d924bcaaed09e7923b76.tar.xz
mgaadvisories-78920e937bd7a7a73551d924bcaaed09e7923b76.zip
Add functions useful to generate update descriptions
Diffstat (limited to 'lib')
-rw-r--r--lib/MGA/Advisories.pm27
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}}) {