Commit c5a676ad authored by David Lawrence's avatar David Lawrence

Bug 1261114 - Release notes cannot be displayed due to missing REQUIRED_MODULES…

Bug 1261114 - Release notes cannot be displayed due to missing REQUIRED_MODULES and OPTIONAL_MODULES r=dylan
parent 2db8904f
...@@ -1153,18 +1153,32 @@ sub create { ...@@ -1153,18 +1153,32 @@ sub create {
# These don't work as normal constants. # These don't work as normal constants.
DB_MODULE => \&Bugzilla::Constants::DB_MODULE, DB_MODULE => \&Bugzilla::Constants::DB_MODULE,
REQUIRED_MODULES => REQUIRED_MODULES => sub {
\&Bugzilla::Install::Requirements::REQUIRED_MODULES, my %required_modules;
my $cache = Bugzilla->request_cache;
my $meta = $cache->{cpan_meta} ||= Bugzilla::Install::Requirements::load_cpan_meta();
my $reqs = $meta->effective_prereqs->merged_requirements(['configure', 'runtime'], ['requires']);
foreach my $module (sort $reqs->required_modules) {
next if $module eq 'perl';
$required_modules{$module} = { version => $reqs->requirements_for_module($module) };
}
return \%required_modules;
},
OPTIONAL_MODULES => sub { OPTIONAL_MODULES => sub {
my @optional = @{OPTIONAL_MODULES()}; my %optional_modules;
foreach my $item (@optional) { my $cache = Bugzilla->request_cache;
my @features; my $meta = $cache->{cpan_meta} ||= Bugzilla::Install::Requirements::load_cpan_meta();
foreach my $feat_id (@{ $item->{feature} }) { foreach my $feature ($meta->features) {
push(@features, install_string("feature_$feat_id")); my $reqs = $feature->prereqs->merged_requirements(['configure', 'runtime'], ['requires']);
foreach my $module ($reqs->required_modules) {
my $version = $reqs->requirements_for_module($module);
$optional_modules{$module} ||= {};
$optional_modules{$module}{version} = $version;
$optional_modules{$module}{features} ||= [];
push(@{$optional_modules{$module}{features}}, $feature->description);
} }
$item->{feature} = \@features;
} }
return \@optional; return \%optional_modules;
}, },
'default_authorizer' => sub { return Bugzilla::Auth->new() }, 'default_authorizer' => sub { return Bugzilla::Auth->new() },
......
...@@ -161,22 +161,26 @@ ...@@ -161,22 +161,26 @@
<h3 id="req_perl">Perl</h3> <h3 id="req_perl">Perl</h3>
<p>Perl <span class="req_new">v5.10.1</span></p> <p>Perl <span class="req_new">v5.14.1</span></p>
[% INCLUDE db_req db='mysql' %] [% INCLUDE db_req db = 'mysql'
module = 'DBD::mysql' %]
[% INCLUDE db_req db='pg' %] [% INCLUDE db_req db = 'pg'
module = 'DBD::Pg' %]
[% INCLUDE db_req db='oracle' %] [% INCLUDE db_req db ='oracle'
module = 'DBD::Oracle' %]
[% INCLUDE db_req db='sqlite' %] [% INCLUDE db_req db = 'sqlite'
module = 'DBD::SQLite' %]
<h3 id="req_modules">Required Perl Modules</h3> <h3 id="req_modules">Required Perl Modules</h3>
[% INCLUDE req_table reqs = REQUIRED_MODULES [% INCLUDE req_table reqs = REQUIRED_MODULES
new = ['File-Slurp','JSON-XS', 'Email-Sender'] new = ['File::Slurp','JSON::XS', 'Email::Sender']
updated = ['DateTime', 'DateTime-TimeZone', updated = ['DateTime', 'DateTime::TimeZone',
'Template-Toolkit', 'URI'] %] 'Template', 'URI'] %]
<h3 id="req_optional_mod">Optional Perl Modules</h3> <h3 id="req_optional_mod">Optional Perl Modules</h3>
...@@ -184,8 +188,8 @@ ...@@ -184,8 +188,8 @@
features of Bugzilla:</p> features of Bugzilla:</p>
[% INCLUDE req_table reqs = OPTIONAL_MODULES [% INCLUDE req_table reqs = OPTIONAL_MODULES
new = ['Cache-Memcached','File-Copy-Recursive'] new = ['Cache::Memcached::Fast','File::Copy::Recursive']
updated = ['Chart', 'Test-Taint'] updated = ['Chart::Lines', 'Test::Taint']
include_feature = 1 %] include_feature = 1 %]
<h3 id="req_apache">Optional Apache Modules</h3> <h3 id="req_apache">Optional Apache Modules</h3>
...@@ -454,7 +458,7 @@ ...@@ -454,7 +458,7 @@
</li> </li>
<li><strong>perl module:</strong> <li><strong>perl module:</strong>
[%+ m.dbd.module FILTER html %] [%+ m.dbd.module FILTER html %]
[%+ '<span class="req_new">' IF dbd_new %]v[% m.dbd.version FILTER html %] [%+ '<span class="req_new">' IF dbd_new %]v[% OPTIONAL_MODULES.$module.version FILTER html %]
[% '</span>' IF dbd_new %]</li> [% '</span>' IF dbd_new %]</li>
</ul> </ul>
[% END %] [% END %]
...@@ -468,20 +472,22 @@ ...@@ -468,20 +472,22 @@
<th>Enables Feature</th> <th>Enables Feature</th>
[% END %] [% END %]
</tr> </tr>
[% FOREACH req = reqs %] [% FOREACH module = reqs.keys.sort %]
[% NEXT IF module.match('^DBD') %]
[% version = reqs.$module.version %]
<tr> <tr>
<td [% ' class="req_new"' IF new.contains(req.package) %]> <td [% ' class="req_new"' IF new.contains(module) %]>
[%- req.module FILTER html %]</td> [%- module FILTER html %]</td>
<td [% ' class="req_new"' IF updated.contains(req.package) <td [% ' class="req_new"' IF updated.contains(module)
OR new.contains(req.package) %]> OR new.contains(module) %]>
[%- IF req.version == 0 %] [%- IF version == 0 %]
(Any) (Any)
[% ELSE %] [% ELSE %]
[%- req.version FILTER html %] [%- version FILTER html %]
[% END %] [% END %]
</td> </td>
[% IF include_feature %] [% IF include_feature %]
<td>[% req.feature.join(', ') FILTER html %]</td> <td>[% reqs.$module.features.join(', ') FILTER html %]</td>
[% END %] [% END %]
</tr> </tr>
[% END %] [% END %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment