diff options
author | Colin Guthrie <colin@mageia.org> | 2014-08-06 00:47:47 +0100 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2014-08-06 00:59:14 +0100 |
commit | 1a3496d8090a5bd0a8880c70743396738518a228 (patch) | |
tree | edd9239aba638970ac0c647092d65df16996d369 | |
parent | d0ae7c7cf28ff1243e5db7b46210206cad331c88 (diff) | |
download | mgaadvisories-1a3496d8090a5bd0a8880c70743396738518a228.tar mgaadvisories-1a3496d8090a5bd0a8880c70743396738518a228.tar.gz mgaadvisories-1a3496d8090a5bd0a8880c70743396738518a228.tar.bz2 mgaadvisories-1a3496d8090a5bd0a8880c70743396738518a228.tar.xz mgaadvisories-1a3496d8090a5bd0a8880c70743396738518a228.zip |
When assigning an advisory ID, make sure the first reference is to advisory bug.
-rw-r--r-- | lib/MGA/Advisories.pm | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index e56770d..62f9bee 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -183,9 +183,18 @@ sub assign_id { } else { # Advisories are not always just [0-9]+.adv, but are # sometimes [0-9]+.mga3.adv etc. so extract the real bug number - # Perhaps this should actually be the first bug from the advisory references? - my $bugnum = $advname; - $bugnum =~ s/[^0-9]//g; + my $advbugnum = $advname; + $advbugnum =~ s/[^0-9]//g; + + if (scalar($adv->{references}) < 1) { + print STDERR "No reference links found in advisory\n"; + return; + } + (my $bugnum) = $adv->{references}[0] =~ m/$config->{bugzilla_url}.*=([0-9]+)$/g; + if ($advbugnum ne $bugnum) { + print STDERR "First reference is not the corresponding Mageia advisory bug\n"; + return; + } if (my $result = call_bz('Bug.get', {ids => [$bugnum]})) { my $failed = 0; |