From 25d8b26294aaaa1ae6a6a6039243bc60ac10f9ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 30 Nov 2014 12:44:31 +0100 Subject: Add [name] argument to mgaadv to prefill the template --- NEWS | 4 +++- lib/MGA/Advisories.pm | 3 ++- mgaadv | 12 ++++++------ tmpl/newadvisory.adv | 6 +++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index f1055d3..a6f6ceb 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +- add a [name] argument to mgaadv new to prefill package name +- prefill subject in new advisories + Version 0.20 - print out bug link when assigning IDs @@ -102,4 +105,3 @@ Version 0.2 Version 0.1 - first version - diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index cd56b56..d03a632 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -728,7 +728,7 @@ sub dumpdb { } sub newadv { - my ($type, $bugnum) = @_; + my ($type, $bugnum, $name) = @_; my $file = $config->{advisories_dir} . '/' . $bugnum . '.adv'; if (-f $file) { print STDERR "File $file already exists\n"; @@ -742,6 +742,7 @@ sub newadv { my $vars = { type => $type, bugnum => $bugnum, + name => $name, }; process_template($template, 'newadvisory', $vars, $bugnum, 'adv'); return $file; diff --git a/mgaadv b/mgaadv index 1840c2d..ca519b0 100755 --- a/mgaadv +++ b/mgaadv @@ -69,10 +69,10 @@ END run => \&newadv, descr => 'Create a new advisory file', usage => < { @@ -173,9 +173,9 @@ sub process { sub editor { $ENV{EDITOR} || $ENV{VISUAL} || '/usr/bin/editor' } sub newadv { - usageexit('usage', $_[0]) unless @_ == 3; - my ($new, $type, $bugnum) = @_; - my $file = MGA::Advisories::newadv($type, $bugnum); + usageexit('usage', $_[0]) unless @_ == 4; + my ($new, $type, $bugnum, $name) = @_; + my $file = MGA::Advisories::newadv($type, $bugnum, $name); if ($file) { system(editor, $file); } diff --git a/tmpl/newadvisory.adv b/tmpl/newadvisory.adv index 4f30636..6efc125 100644 --- a/tmpl/newadvisory.adv +++ b/tmpl/newadvisory.adv @@ -1,15 +1,15 @@ type: [% type %] [% IF type == 'security' -%] -subject: Updated [package] package fixes security vulnerability +subject: Updated [% name %] package fixes security vulnerability CVE: - CVE-2014-XXXX [% ELSE -%] -subject: Updated [package] package fixes [something] +subject: Updated [% name %] package fixes [something] [% END -%] src: 4: core: - - something-1.0-1.mga4 + - [% name %]-1.0-1.mga4 description: | Advisory text to describe the update. Wrap lines at ~75 chars. -- cgit v1.2.1