aboutsummaryrefslogtreecommitdiffstats
path: root/mgaadv
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-17 14:31:27 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-17 14:31:27 +0000
commit24aae489c51512f98564d8a44b08051560b7c08e (patch)
tree74c0c12ad87223e50d01002861c46b4d708b7e80 /mgaadv
parent78db7e3299de05eb6b720bf594035c7d52f93fbe (diff)
downloadmgaadvisories-24aae489c51512f98564d8a44b08051560b7c08e.tar
mgaadvisories-24aae489c51512f98564d8a44b08051560b7c08e.tar.gz
mgaadvisories-24aae489c51512f98564d8a44b08051560b7c08e.tar.bz2
mgaadvisories-24aae489c51512f98564d8a44b08051560b7c08e.tar.xz
mgaadvisories-24aae489c51512f98564d8a44b08051560b7c08e.zip
Add 'nextid' and 'publish' commands
Diffstat (limited to 'mgaadv')
-rwxr-xr-xmgaadv35
1 files changed, 35 insertions, 0 deletions
diff --git a/mgaadv b/mgaadv
index 05308a3..3e6bdc1 100755
--- a/mgaadv
+++ b/mgaadv
@@ -45,6 +45,24 @@ 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 => <<END,
+$0 nextid [type]
+
+Print the next unused advisory ID for [type].
+END
+ },
+ publish => {
+ run => \&publish,
+ descr => 'Assign an ID to an advisory file',
+ usage => <<END
+$0 publish [bugnum]
+
+Assign a new ID to an advisory file.
+END
+ },
show => {
run => \&showadv,
descr => 'Show an advisory',
@@ -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;