aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-11-24 19:36:52 +0000
committerColin Guthrie <colin@mageia.org>2014-11-25 10:30:51 +0000
commit62e6180b53eff8075f9c2dd8b359e972e190bc91 (patch)
treeb0e7e9396d6a219b272b8496b155dc3c361e8a5c
parent2592347f89b5303dfdc8a448d5a705b913b4043c (diff)
downloadmgaadvisories-62e6180b53eff8075f9c2dd8b359e972e190bc91.tar
mgaadvisories-62e6180b53eff8075f9c2dd8b359e972e190bc91.tar.gz
mgaadvisories-62e6180b53eff8075f9c2dd8b359e972e190bc91.tar.bz2
mgaadvisories-62e6180b53eff8075f9c2dd8b359e972e190bc91.tar.xz
mgaadvisories-62e6180b53eff8075f9c2dd8b359e972e190bc91.zip
Add a 'publishall' option to attempt to publish all pending advisories.
-rw-r--r--NEWS1
-rw-r--r--lib/MGA/Advisories.pm24
-rwxr-xr-xmgaadv14
3 files changed, 39 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 303066a..3bd5e7e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- add publishall option to process all pending advisories
- fix bugnum regexp for '12345.mga4' type advisory names
- add check to highlight that the first reference must be the MGA advisory bug
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';
}
diff --git a/mgaadv b/mgaadv
index 0a4df25..1840c2d 100755
--- a/mgaadv
+++ b/mgaadv
@@ -93,6 +93,15 @@ $0 publish [bugnum]
Assign a new ID to an advisory file.
END
},
+ 'publish-all' => {
+ run => \&publishall,
+ descr => 'Publish all pending advisories',
+ usage => <<END
+$0 publish-all
+
+Assign a new ID to all pending, validated advisories (subject to cross checks).
+END
+ },
show => {
run => \&showadv,
descr => 'Show an advisory',
@@ -189,6 +198,11 @@ sub publish {
MGA::Advisories::assign_id($_[1]);
}
+sub publishall {
+ usageexit('usage', $_[0]) unless @_ == 1;
+ MGA::Advisories::assign_ids();
+}
+
sub listadv {
shift;
my %advdb;