aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-13 15:21:44 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-13 15:21:44 +0000
commitb84016d16a0d80b05177e2fbb233a0cc9ddcfcd3 (patch)
treed0333f0c7d36deb75c512e4d2edf505933725578 /lib
parentc5083c05ff06811b88121a82916524bafab42418 (diff)
downloadmgaadvisories-b84016d16a0d80b05177e2fbb233a0cc9ddcfcd3.tar
mgaadvisories-b84016d16a0d80b05177e2fbb233a0cc9ddcfcd3.tar.gz
mgaadvisories-b84016d16a0d80b05177e2fbb233a0cc9ddcfcd3.tar.bz2
mgaadvisories-b84016d16a0d80b05177e2fbb233a0cc9ddcfcd3.tar.xz
mgaadvisories-b84016d16a0d80b05177e2fbb233a0cc9ddcfcd3.zip
Add option to load advisories db from a file dump
Diffstat (limited to 'lib')
-rw-r--r--lib/MGA/Advisories.pm12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index cda9528..ec91efa 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -52,7 +52,7 @@ sub save_status {
DumpFile($statusfile, $advdb->{advisories}{$adv}{status});
}
-sub get_advisories {
+sub get_advisories_from_dir {
my %advisories;
foreach my $advfile (glob "$config->{advisories_dir}/*.adv") {
my $adv = LoadFile($advfile);
@@ -65,6 +65,16 @@ sub get_advisories {
return \%advisories;
}
+sub get_advisories_from_dump {
+ return LoadFile($_[0] || $config->{advdv_dumpfile}
+ || $ENV{HOME} . '/.mga-advisories/advisories.yaml');
+}
+
+sub get_advisories {
+ return $config->{mode} eq 'dump' ? get_advisories_from_dump
+ : get_advisories_from_dir;
+}
+
sub publish_advisories {
my ($advdb) = @_;
foreach my $adv (keys %{$advdb->{advisories}}) {