diff options
author | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 15:21:44 +0000 |
---|---|---|
committer | Nicolas Vigier <boklm@mageia.org> | 2013-06-13 15:21:44 +0000 |
commit | b84016d16a0d80b05177e2fbb233a0cc9ddcfcd3 (patch) | |
tree | d0333f0c7d36deb75c512e4d2edf505933725578 /lib/MGA/Advisories.pm | |
parent | c5083c05ff06811b88121a82916524bafab42418 (diff) | |
download | mgaadvisories-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/MGA/Advisories.pm')
-rw-r--r-- | lib/MGA/Advisories.pm | 12 |
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}}) { |