aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MGA
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-17 20:48:45 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-17 20:48:45 +0000
commit472cd881bd9d799ef3680ed0c65a40ca2007ac2b (patch)
tree60e0bac5f90f920b8fedc7aae2205cb0f49e65de /lib/MGA
parent7c4c1d3a5c991114d9d951cb550756fa314689f5 (diff)
downloadmgaadvisories-472cd881bd9d799ef3680ed0c65a40ca2007ac2b.tar
mgaadvisories-472cd881bd9d799ef3680ed0c65a40ca2007ac2b.tar.gz
mgaadvisories-472cd881bd9d799ef3680ed0c65a40ca2007ac2b.tar.bz2
mgaadvisories-472cd881bd9d799ef3680ed0c65a40ca2007ac2b.tar.xz
mgaadvisories-472cd881bd9d799ef3680ed0c65a40ca2007ac2b.zip
Add support for filters on list command
Possible filters are : - advisory type - distribution release - package name - CVE - media
Diffstat (limited to 'lib/MGA')
-rw-r--r--lib/MGA/Advisories.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index 0115438..9ebe35e 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -328,9 +328,18 @@ sub newadv {
}
sub listadv {
- my ($advdb) = @_;
- print map { "$_ . $advdb->{advisories}{$_}{subject}\n" }
- adv_sort($advdb, keys %{$advdb->{advisories}});
+ my ($advdb, @filter) = @_;
+ my @advlist = keys %{$advdb->{advisories}};
+ foreach my $f (@filter) {
+ my $l = $advdb->{by_type}{$f} || $advdb->{by_cve}{$f}
+ || $advdb->{by_rel}{$f} || $advdb->{by_media}{$f}
+ || $advdb->{by_src}{$f} || [];
+ my %z;
+ @z{@$l} = (1) x @$l;
+ @advlist = grep { $z{$_} } @advlist;
+ }
+ print map { "$_ . $advdb->{advisories}{$_}{subject}\n" }
+ adv_sort($advdb, @advlist);
}
sub showadv {