From 24aae489c51512f98564d8a44b08051560b7c08e Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Mon, 17 Jun 2013 14:31:27 +0000 Subject: Add 'nextid' and 'publish' commands --- mgaadv | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'mgaadv') diff --git a/mgaadv b/mgaadv index 05308a3..3e6bdc1 100755 --- a/mgaadv +++ b/mgaadv @@ -43,6 +43,24 @@ $0 new [type] [bugnum] Create a new advisory file. [type] should be security or bugfix and [bugnum] is the bugzilla bug number. +END + }, + nextid => { + run => \&nextid, + descr => 'Print next available ID', + usage => < { + run => \&publish, + descr => 'Assign an ID to an advisory file', + usage => < { @@ -111,6 +129,23 @@ sub newadv { } } +sub nextid { + usageexit('usage', $_[0]) unless @_ == 2; + my $type = $_[1]; + if (!$MGA::Advisories::config->{advisory_types}{$type}) { + print STDERR "Unknown type $type\n"; + exit 1; + } + print MGA::Advisories::next_id( + $MGA::Advisories::config->{advisory_types}{$type}{prefix}, + keys %{MGA::Advisories::get_advisories()}), "\n"; +} + +sub publish { + usageexit('usage', $_[0]) unless @_ == 2; + MGA::Advisories::assign_id($_[1]); +} + sub listadv { usageexit('usage', $_[0]) unless @_ == 1; my %advdb; -- cgit v1.2.1