aboutsummaryrefslogtreecommitdiffstats
path: root/mkadvisories
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-12 21:47:06 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-12 21:47:06 +0000
commit52b02218d8804e66d83db517fcaadd45d9d857a7 (patch)
treee4f3b4b4605259221bcaecd9963b0aef26b41f87 /mkadvisories
parent91a88f15bee9a3f3f415fe183b1cb5817a5d33ba (diff)
downloadmgaadvisories-52b02218d8804e66d83db517fcaadd45d9d857a7.tar
mgaadvisories-52b02218d8804e66d83db517fcaadd45d9d857a7.tar.gz
mgaadvisories-52b02218d8804e66d83db517fcaadd45d9d857a7.tar.bz2
mgaadvisories-52b02218d8804e66d83db517fcaadd45d9d857a7.tar.xz
mgaadvisories-52b02218d8804e66d83db517fcaadd45d9d857a7.zip
mkadvisories: sort advisories
Sort advisories by CVE, distro, media, source package
Diffstat (limited to 'mkadvisories')
-rwxr-xr-xmkadvisories23
1 files changed, 23 insertions, 0 deletions
diff --git a/mkadvisories b/mkadvisories
index 3b207ca..1e5cea1 100755
--- a/mkadvisories
+++ b/mkadvisories
@@ -52,6 +52,28 @@ sub get_advisories {
return \%advisories;
}
+sub sort_advisories {
+ my ($advdb) = @_;
+ foreach my $adv (keys $advdb->{advisories}) {
+ push @{$advdb->{by_type}{$advdb->{advisories}{$adv}{type}}}, $adv;
+ foreach my $cve (@{$advdb->{advisories}{$adv}{CVE}}) {
+ push @{$advdb->{by_cve}{$cve}}, $adv;
+ }
+ foreach my $rel (keys %{$advdb->{advisories}{$adv}{src}}) {
+ push @{$advdb->{by_rel}{$rel}}, $adv;
+ foreach my $media (keys %{$advdb->{advisories}{$adv}{src}{$rel}}) {
+ push @{$advdb->{by_media}{$media}}, $adv;
+ my %pkgs;
+ foreach my $srpm (@{$advdb->{advisories}{$adv}{src}{$rel}{$media}}) {
+ $srpm =~ m/(.+)-[^-]+-[^-]+/;
+ push @{$advdb->{by_src}{$1}}, $adv
+ unless grep { $_ eq $adv } @{$advdb->{by_src}{$1}};
+ }
+ }
+ }
+ }
+}
+
sub process_template {
my ($template, $src, $vars, $dest, $ext) = @_;
foreach my $extension ($ext ? $ext : @{$config->{output_format}}) {
@@ -147,6 +169,7 @@ sub dumpdb {
my %advdb;
$advdb{advisories} = get_advisories();
+sort_advisories(\%advdb);
output_pages(\%advdb);
dumpdb(\%advdb);
send_adv_mail(\%advdb);