aboutsummaryrefslogtreecommitdiffstats
path: root/mkadvisories
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2013-06-12 21:47:13 +0000
committerNicolas Vigier <boklm@mageia.org>2013-06-12 21:47:13 +0000
commitc9a20a66af94911ad1fe5bae9f9a15e0c4936a6b (patch)
treed4ef622155c055f935be9d35b98be4e8d80aabb8 /mkadvisories
parentd69e518feba786a8ef25b19d8898eb853c51d94e (diff)
downloadmgaadvisories-c9a20a66af94911ad1fe5bae9f9a15e0c4936a6b.tar
mgaadvisories-c9a20a66af94911ad1fe5bae9f9a15e0c4936a6b.tar.gz
mgaadvisories-c9a20a66af94911ad1fe5bae9f9a15e0c4936a6b.tar.bz2
mgaadvisories-c9a20a66af94911ad1fe5bae9f9a15e0c4936a6b.tar.xz
mgaadvisories-c9a20a66af94911ad1fe5bae9f9a15e0c4936a6b.zip
mkadvisories: add pkgname function
Diffstat (limited to 'mkadvisories')
-rwxr-xr-xmkadvisories13
1 files changed, 10 insertions, 3 deletions
diff --git a/mkadvisories b/mkadvisories
index 8e11f82..110a791 100755
--- a/mkadvisories
+++ b/mkadvisories
@@ -25,6 +25,10 @@ my %basename = (
pkg => sub { 'pkg_' . $_[0] },
);
+my %tools = (
+ pkgname => sub { $_[0] =~ m/(.+)-[^-]+-[^-]+/; $1; },
+);
+
my @report_logs;
sub report_log {
push @report_logs, @_;
@@ -72,9 +76,9 @@ sub sort_advisories {
push @{$advdb->{by_media}{$media}}, $adv;
my %pkgs;
foreach my $srpm (@{$advdb->{advisories}{$adv}{src}{$rel}{$media}}) {
- $srpm =~ m/(.+)-[^-]+-[^-]+/;
- push @{$advdb->{by_src}{$1}}, $adv
- unless grep { $_ eq $adv } @{$advdb->{by_src}{$1}};
+ my $pkgname = $tools{pkgname}->($srpm);
+ push @{$advdb->{by_src}{$pkgname}}, $adv
+ unless grep { $_ eq $adv } @{$advdb->{by_src}{$pkgname}};
}
}
}
@@ -102,6 +106,7 @@ sub output_pages {
advisory => $adv,
advdb => $advdb,
basename => \%basename,
+ tools => \%tools,
};
process_template($template, 'advisory', $vars, $basename{ID}->($adv));
}
@@ -109,6 +114,7 @@ sub output_pages {
config => $config,
advdb => $advdb,
basename => \%basename,
+ tools => \%tools,
};
process_template($template, 'index', $vars, 'index');
}
@@ -127,6 +133,7 @@ sub send_adv_mail {
advisory => $adv,
advdb => $advdb,
basename => \%basename,
+ tools => \%tools,
};
process_template($template, 'advisory', $vars, \$mailcontent, 'txt');
my $email = Email::Simple->create(