From 62e6180b53eff8075f9c2dd8b359e972e190bc91 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Mon, 24 Nov 2014 19:36:52 +0000 Subject: Add a 'publishall' option to attempt to publish all pending advisories. --- lib/MGA/Advisories.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib') diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index 63b6953..3c9e147 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -144,6 +144,7 @@ sub get_advisories_from_dir { my $adv = LoadFile($advfile); if (!$adv->{ID}) { next unless $config->{mode} eq 'qa'; + $adv->{ref} = basename($advfile, ".adv"); $adv->{ID} = next_id('TODO', keys %advisories); $adv->{no_save_status} = 1; } @@ -357,6 +358,29 @@ sub assign_id { } } +sub assign_ids { + # Ensure users local repo is up to date + my $exitstatus = system("svn up"); + if ( 0 != $exitstatus ) { + print STDERR "Subversion update appears to have failed.\n"; + return; + } + + my %advdb; + $advdb{advisories} = get_advisories_from_dir(); + sort_advisories(\%advdb); + output_pages(); + + # We will have exited by now in the event of e.g. a Yaml or processing error + + foreach my $advfile (glob "$config->{advisories_dir}/*.adv") { + my $adv = LoadFile($advfile); + next if ($adv->{ID}); + assign_id(basename($advfile, ".adv")); + print "\n"; + } +} + sub advdb_dumpfile { $config->{advdb_dumpfile} || $ENV{HOME} . '/.mga-advisories/advisories.yaml'; } -- cgit v1.2.1