summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-03-27 15:56:14 +0200
committerDylan William Hardison <dylan@hardison.net>2017-03-27 17:18:19 +0200
commit15daaf123635c1e734dfe6e3aed60f52df0364ce (patch)
treec4823e177859f5b69a68017635bbd29491ceec90
parent08c0187b591bb1bb4248382a8106a450c9b359e3 (diff)
downloadbugzilla-15daaf123635c1e734dfe6e3aed60f52df0364ce.tar.gz
bugzilla-15daaf123635c1e734dfe6e3aed60f52df0364ce.tar.xz
Bug 1350466 - Uplift bug 1342832 to bmo for performance and other reasons
-rw-r--r--Bugzilla.pm37
-rw-r--r--Bugzilla/CPAN.pm142
-rw-r--r--Bugzilla/Constants.pm13
-rw-r--r--Bugzilla/Install/Requirements.pm27
-rw-r--r--Bugzilla/Install/Util.pm2
-rw-r--r--META.json500
-rw-r--r--META.yml270
-rw-r--r--Makefile.PL31
-rwxr-xr-xchecksetup.pl29
-rw-r--r--template/en/default/global/code-error.html.tmpl2
10 files changed, 173 insertions, 880 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index bd410364e..1f8d9d800 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -33,12 +33,12 @@ use Bugzilla::Flag;
use Bugzilla::Hook;
use Bugzilla::Install::Localconfig qw(read_localconfig);
use Bugzilla::Install::Util qw(init_console include_languages);
-use Bugzilla::Install::Requirements qw(load_cpan_meta check_cpan_feature);
use Bugzilla::Memcached;
use Bugzilla::Template;
use Bugzilla::Token;
use Bugzilla::User;
use Bugzilla::Util;
+use Bugzilla::CPAN;
use Bugzilla::Metrics::Collector;
use Bugzilla::Metrics::Template;
@@ -52,6 +52,8 @@ use File::Spec::Functions;
use Safe;
use Sys::Syslog qw(:DEFAULT);
+use parent qw(Bugzilla::CPAN);
+
#####################################################################
# Constants
#####################################################################
@@ -252,39 +254,6 @@ sub extensions {
return $cache->{extensions};
}
-sub feature {
- my ($class, $feature_name) = @_;
- return 0 unless CAN_HAS_FEATURE;
- return 0 unless $class->has_feature($feature_name);
-
- my $cache = $class->process_cache;
- my $feature = $cache->{cpan_meta}->feature($feature_name);
- # Bugzilla expects this will also load all the modules.. so we have to do that.
- # Later we should put a deprecation warning here, and favor calling has_feature().
-
- return 1 if $cache->{feature_loaded}{$feature_name};
- my @modules = $feature->prereqs->merged_requirements->required_modules;
- Module::Runtime::require_module($_) foreach @modules;
- $cache->{feature_loaded}{$feature_name} = 1;
- return 1;
-}
-
-sub has_feature {
- my ($class, $feature_name) = @_;
-
- return 0 unless CAN_HAS_FEATURE;
-
- my $cache = $class->process_cache;
- return $cache->{feature}->{$feature_name}
- if exists $cache->{feature}->{$feature_name};
-
- my $meta = $cache->{cpan_meta} //= load_cpan_meta();
- my $feature = eval { $meta->feature($feature_name) }
- or ThrowCodeError('invalid_feature', { feature => $feature_name });
-
- return $cache->{feature}{$feature_name} = check_cpan_feature($feature)->{ok};
-}
-
sub cgi {
return $_[0]->request_cache->{cgi} ||= new Bugzilla::CGI();
}
diff --git a/Bugzilla/CPAN.pm b/Bugzilla/CPAN.pm
new file mode 100644
index 000000000..f044e45bc
--- /dev/null
+++ b/Bugzilla/CPAN.pm
@@ -0,0 +1,142 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::CPAN;
+
+use 5.10.1;
+use strict;
+use warnings;
+
+use Bugzilla::Constants qw(bz_locations);
+use Bugzilla::Install::Requirements qw(check_cpan_feature);
+
+BEGIN {
+ my $json_xs_ok = eval {
+ require JSON::XS;
+ require JSON;
+ JSON->VERSION("2.5");
+ 1;
+ };
+ if ($json_xs_ok) {
+ $ENV{PERL_JSON_BACKEND} = 'JSON::XS';
+ }
+}
+
+use constant _CAN_HAS_FEATURE => eval {
+ require CPAN::Meta::Prereqs;
+ require CPAN::Meta::Requirements;
+ require Module::Metadata;
+ require Module::Runtime;
+ CPAN::Meta::Prereqs->VERSION('2.132830');
+ CPAN::Meta::Requirements->VERSION('2.121');
+ Module::Metadata->VERSION('1.000019');
+ 1;
+};
+
+my (%FEATURE, %FEATURE_LOADED);
+
+sub cpan_meta {
+ my ($class) = @_;
+ my $dir = bz_locations()->{libpath};
+ my $file = File::Spec->catfile($dir, 'MYMETA.json');
+ state $CPAN_META;
+
+ return $CPAN_META if $CPAN_META;
+
+ if (-f $file) {
+ open my $meta_fh, '<', $file or die "unable to open $file: $!";
+ my $str = do { local $/ = undef; scalar <$meta_fh> };
+ # detaint
+ $str =~ /^(.+)$/s; $str = $1;
+ close $meta_fh;
+
+ return $CPAN_META = CPAN::Meta->load_json_string($str);
+ }
+ else {
+ require Bugzilla::Error;
+ Bugzilla::Error::ThrowCodeError('cpan_meta_missing');
+ }
+}
+
+sub cpan_requirements {
+ my ($class, $prereqs) = @_;
+ if ($prereqs->can('merged_requirements')) {
+ return $prereqs->merged_requirements( [ 'configure', 'runtime' ], ['requires'] );
+ }
+ else {
+ my $req = CPAN::Meta::Requirements->new;
+ $req->add_requirements( $prereqs->requirements_for('configure', 'requires') );
+ $req->add_requirements( $prereqs->requirements_for('runtime', 'requires') );
+ return $req;
+ }
+}
+
+sub has_feature {
+ my ($class, $feature_name) = @_;
+
+ return 0 unless _CAN_HAS_FEATURE;
+ return $FEATURE{$feature_name} if exists $FEATURE{ $feature_name };
+
+ my $meta = $class->cpan_meta;
+ my $feature = eval { $meta->feature($feature_name) }
+ or ThrowCodeError('invalid_feature', { feature => $feature_name });
+
+ return $FEATURE{$feature_name} = check_cpan_feature($feature)->{ok};
+}
+
+
+# Bugzilla expects this will also load all the modules.. so we have to do that.
+# Later we should put a deprecation warning here, and favor calling has_feature().
+sub feature {
+ my ($class, $feature_name) = @_;
+ return 0 unless _CAN_HAS_FEATURE;
+ return 1 if $FEATURE_LOADED{$feature_name};
+ return 0 unless $class->has_feature($feature_name);
+
+ my $meta = $class->cpan_meta;
+ my $feature = $meta->feature($feature_name);
+ my @modules = $feature->prereqs->merged_requirements->required_modules;
+ Module::Runtime::require_module($_) foreach @modules;
+ return $FEATURE_LOADED{$feature_name} = 1;
+}
+
+1;
+
+__END__
+
+
+=head1 NAME
+
+Bugzilla::CPAN - Methods relating to Bugzilla's CPAN metadata (including features)
+
+=head1 SYNOPSIS
+
+ use Bugzilla;
+ Bugzilla->cpan_meta;
+ Bugzilla->feature('psgi');
+ Bugzilla->has_feature('psgi');
+
+=head1 DESCRIPTION
+
+You most likely never need to use this module directly, as the Bugzilla factory class inherits all of these class methods.
+It exists so that cpan metadata can be read in before the rest of Bugzilla.pm is loaded in checksetup.pl
+
+=head1 CLASS METHODS
+
+=head2 C<feature>
+
+Wrapper around C<has_feature()> that also loads all of required modules into the runtime.
+
+=head2 C<has_feature>
+
+Consults F<MYMETA.yml> for optional Bugzilla features and returns true if all the requirements
+are installed.
+
+=head2 C<cpan_meta>
+
+Returns a L<CPAN::Meta> from the contents of MYMETA.json in the bugzilla directory.
+
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 94d60999b..852c9c362 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -26,8 +26,6 @@ use Memoize;
bz_locations
- CAN_HAS_FEATURE
-
CONCATENATE_ASSETS
IS_NULL
@@ -221,17 +219,6 @@ use constant REST_DOC => "http://www.bugzilla.org/docs/tip/en/html/api/";
use constant REMOTE_FILE => 'http://updates.bugzilla.org/bugzilla-update.xml';
use constant LOCAL_FILE => 'bugzilla-update.xml'; # Relative to datadir.
-use constant CAN_HAS_FEATURE => eval {
- require CPAN::Meta::Prereqs;
- require CPAN::Meta::Requirements;
- require Module::Metadata;
- require Module::Runtime;
- CPAN::Meta::Prereqs->VERSION('2.132830');
- CPAN::Meta::Requirements->VERSION('2.121');
- Module::Metadata->VERSION('1.000019');
- 1;
-};
-
# When true CSS and JavaScript assets will be concatanted and minified at
# run-time, to reduce the number of requests required to render a page.
# Setting this to a false value can help debugging.
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index da06ab70c..54a45fd18 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -33,7 +33,6 @@ use autodie;
our @EXPORT = qw(
FEATURE_FILES
- load_cpan_meta
check_cpan_requirements
check_cpan_feature
check_all_cpan_features
@@ -104,25 +103,6 @@ use constant FEATURE_FILES => (
s3 => ['Bugzilla/S3.pm', 'Bugzilla/S3/Bucket.pm', 'Bugzilla/Attachment/S3.pm']
);
-sub load_cpan_meta {
- my $dir = bz_locations()->{libpath};
- my @meta_json = map { File::Spec->catfile($dir, $_) } qw( MYMETA.json META.json );
- my ($file) = grep { -f $_ } @meta_json;
-
- if ($file) {
- open my $meta_fh, '<', $file or die "unable to open $file: $!";
- my $str = do { local $/ = undef; scalar <$meta_fh> };
- # detaint
- $str =~ /^(.+)$/s; $str = $1;
- close $meta_fh;
-
- return CPAN::Meta->load_json_string($str);
- }
- else {
- ThrowCodeError('cpan_meta_missing');
- }
-}
-
sub check_all_cpan_features {
my ($meta, $dirs, $output) = @_;
my %report;
@@ -163,7 +143,7 @@ sub check_cpan_requirements {
sub _check_prereqs {
my ($prereqs, $dirs, $output) = @_;
$dirs //= \@INC;
- my $reqs = $prereqs->merged_requirements(['configure', 'runtime'], ['requires']);
+ my $reqs = Bugzilla::CPAN->cpan_requirements($prereqs);
my @found;
my @missing;
@@ -484,11 +464,6 @@ Returns: C<1> if the check was successful, C<0> otherwise.
Returns a hashref where file names are the keys and the value is the feature
that must be enabled in order to compile that file.
-=item C<load_cpan_meta>
-
-Load MYMETA.json or META.json from the bugzilla directory, and a return a L<CPAN::Meta> object.
-
=back
=back
-
diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm
index c65c0e061..33b3d43d3 100644
--- a/Bugzilla/Install/Util.pm
+++ b/Bugzilla/Install/Util.pm
@@ -268,7 +268,7 @@ sub indicate_progress {
sub feature_description {
my ($feature_name) = @_;
eval {
- my $meta = _cache()->{cpan_meta} //= Bugzilla::Install::Requirements::load_cpan_meta();
+ my $meta = Bugzilla::CPAN->cpan_meta;
return $meta->feature($feature_name)->description
} or warn $@;
diff --git a/META.json b/META.json
deleted file mode 100644
index ba537767c..000000000
--- a/META.json
+++ /dev/null
@@ -1,500 +0,0 @@
-{
- "abstract" : "Bugzilla Bug Tracking System",
- "author" : [
- "Bugzilla Developers <developers@bugzilla.org>"
- ],
- "dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.22, CPAN::Meta::Converter version 2.150005",
- "license" : [
- "unknown"
- ],
- "meta-spec" : {
- "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
- },
- "name" : "Bugzilla",
- "no_index" : {
- "directory" : [
- "t",
- "inc"
- ]
- },
- "optional_features" : {
- "auth_delegation" : {
- "description" : "Auth Delegation",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "LWP::UserAgent" : "0"
- }
- }
- }
- },
- "auth_ldap" : {
- "description" : "LDAP Authentication",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Net::LDAP" : "0"
- }
- }
- }
- },
- "auth_radius" : {
- "description" : "RADIUS Authentication",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Authen::Radius" : "0"
- }
- }
- }
- },
- "bmo" : {
- "description" : "features that bmo needs",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Auth::GoogleAuth" : "1.01",
- "Cache::Memcached::Fast" : "0.17",
- "Chart::Lines" : "v2.4.10",
- "Class::Accessor::Fast" : "0",
- "DBD::mysql" : "4.037",
- "Daemon::Generic" : "0",
- "Email::MIME::Attachment::Stripper" : "0",
- "Email::Reply" : "0",
- "Encode" : "2.21",
- "Encode::Detect" : "0",
- "File::Copy::Recursive" : "0",
- "File::MimeInfo::Magic" : "0",
- "File::Which" : "0",
- "GD" : "1.20",
- "GD::Barcode::QRcode" : "0",
- "GD::Graph" : "0",
- "GD::Text" : "0",
- "HTML::Parser" : "3.67",
- "HTML::Scrubber" : "0",
- "IO::Async" : "0",
- "IO::Scalar" : "0",
- "JSON::RPC" : "== 1.01",
- "LWP::UserAgent" : "0",
- "MIME::Parser" : "5.406",
- "MooX::StrictConstructor" : "0.008",
- "Mozilla::CA" : "0",
- "Net::SFTP" : "0",
- "PatchReader" : "v0.9.6",
- "Role::Tiny" : "0",
- "SOAP::Lite" : "0.712",
- "Search::Elasticsearch" : "0",
- "Template::Plugin::GD::Image" : "0",
- "Test::Taint" : "1.06",
- "Text::MultiMarkdown" : "1.000034",
- "TheSchwartz" : "1.10",
- "Type::Tiny" : "1",
- "URI::Escape" : "0",
- "XML::Simple" : "0",
- "XML::Twig" : "0",
- "XMLRPC::Lite" : "0.712"
- }
- }
- }
- },
- "csp" : {
- "description" : "Content-Security-Policy support",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "MooX::StrictConstructor" : "0.008",
- "Type::Tiny" : "1"
- }
- }
- }
- },
- "detect_charset" : {
- "description" : "Automatic charset detection for text attachments",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Encode" : "2.21",
- "Encode::Detect" : "0"
- }
- }
- }
- },
- "documentation" : {
- "description" : "Documentation",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "File::Copy::Recursive" : "0",
- "File::Which" : "0"
- }
- }
- }
- },
- "elasticsearch" : {
- "description" : "Elasticsearch-powered searches",
- "prereqs" : {
- "runtime" : {
- "recommends" : {
- "Term::ProgressBar" : "0"
- },
- "requires" : {
- "IO::Async" : "0",
- "Role::Tiny" : "0",
- "Search::Elasticsearch" : "0"
- }
- }
- }
- },
- "extension_bitly_optional" : {
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Mozilla::CA" : "0"
- }
- }
- }
- },
- "extension_push_optional" : {
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Net::SFTP" : "0",
- "XML::Simple" : "0"
- }
- }
- }
- },
- "graphical_reports" : {
- "description" : "Graphical Reports",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "GD" : "1.20",
- "GD::Graph" : "0",
- "GD::Text" : "0",
- "Template::Plugin::GD::Image" : "0"
- }
- }
- }
- },
- "html_desc" : {
- "description" : "More HTML in Product/Group Descriptions",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "HTML::Parser" : "3.67",
- "HTML::Scrubber" : "0"
- }
- }
- }
- },
- "inbound_email" : {
- "description" : "Inbound Email",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Email::MIME::Attachment::Stripper" : "0",
- "Email::Reply" : "0"
- }
- }
- }
- },
- "jobqueue" : {
- "description" : "Mail Queueing",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Daemon::Generic" : "0",
- "TheSchwartz" : "1.10"
- }
- }
- }
- },
- "jsonrpc" : {
- "description" : "JSON-RPC Interface",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "JSON::RPC" : "== 1.01",
- "Test::Taint" : "1.06"
- }
- }
- }
- },
- "linux_pid" : {
- "description" : "Linux::PID for MozReview",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Linux::Pid" : "0"
- }
- }
- }
- },
- "markdown" : {
- "description" : "Markdown syntax support for comments",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Text::MultiMarkdown" : "1.000034"
- }
- }
- }
- },
- "memcached" : {
- "description" : "Memcached Support",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Cache::Memcached::Fast" : "0.17"
- }
- }
- }
- },
- "mfa" : {
- "description" : "Multi-Factor Authentication",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Auth::GoogleAuth" : "1.01",
- "GD::Barcode::QRcode" : "0"
- }
- }
- }
- },
- "mod_perl" : {
- "description" : "mod_perl support under Apache",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Apache2::SizeLimit" : "0.96",
- "mod_perl2" : "1.999022"
- }
- }
- }
- },
- "moving" : {
- "description" : "Move Bugs Between Installations",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "MIME::Parser" : "5.406",
- "XML::Twig" : "0"
- }
- }
- }
- },
- "mysql" : {
- "description" : "MySQL database support",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "DBD::mysql" : "4.037"
- }
- }
- }
- },
- "new_charts" : {
- "description" : "New Charts",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Chart::Lines" : "v2.4.10",
- "GD" : "1.20"
- }
- }
- }
- },
- "old_charts" : {
- "description" : "Old Charts",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Chart::Lines" : "v2.4.10",
- "GD" : "1.20"
- }
- }
- }
- },
- "oracle" : {
- "description" : "Oracle database support",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "DBD::Oracle" : "1.19"
- }
- }
- }
- },
- "patch_viewer" : {
- "description" : "Patch Viewer",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "PatchReader" : "v0.9.6"
- }
- }
- }
- },
- "pg" : {
- "description" : "Postgres database support",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "DBD::Pg" : "v2.19.3"
- }
- }
- }
- },
- "rest" : {
- "description" : "REST Interface",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "JSON::RPC" : "== 1.01",
- "Test::Taint" : "1.06"
- }
- }
- }
- },
- "s3" : {
- "description" : "Amazon S3 Attachment Storage",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Class::Accessor::Fast" : "0",
- "URI::Escape" : "0",
- "XML::Simple" : "0"
- }
- }
- }
- },
- "smtp_auth" : {
- "description" : "SMTP Authentication",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "Authen::SASL" : "0"
- }
- }
- }
- },
- "sqlite" : {
- "description" : "SQLite database support",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "DBD::SQLite" : "1.29"
- }
- }
- }
- },
- "typesniffer" : {
- "description" : "Sniff MIME type of attachments",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "File::MimeInfo::Magic" : "0",
- "IO::Scalar" : "0"
- }
- }
- }
- },
- "updates" : {
- "description" : "Automatic Update Notifications",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "LWP::UserAgent" : "0",
- "XML::Twig" : "0"
- }
- }
- }
- },
- "xmlrpc" : {
- "description" : "XML-RPC Interface",
- "prereqs" : {
- "runtime" : {
- "requires" : {
- "SOAP::Lite" : "0.712",
- "Test::Taint" : "1.06",
- "XMLRPC::Lite" : "0.712"
- }
- }
- }
- }
- },
- "prereqs" : {
- "build" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "6.57_07"
- }
- },
- "configure" : {
- "requires" : {
- "ExtUtils::MakeMaker" : "6.57_07"
- }
- },
- "runtime" : {
- "recommends" : {
- "Safe" : "2.30"
- },
- "requires" : {
- "CGI" : "<= 3.63",
- "CPAN::Meta::Prereqs" : "2.132830",
- "CPAN::Meta::Requirements" : "2.121",
- "Crypt::CBC" : "0",
- "Crypt::DES" : "0",
- "Crypt::DES_EDE3" : "0",
- "Crypt::OpenPGP" : "1.02",
- "Crypt::SMIME" : "0",
- "DBI" : "1.614",
- "Daemon::Generic" : "0",
- "Date::Format" : "2.23",
- "DateTime" : "0.75",
- "DateTime::TimeZone" : "1.64",
- "Digest::SHA" : "0",
- "Email::Address" : "0",
- "Email::MIME" : "1.904",
- "Email::Send" : "1.911",
- "File::MimeInfo::Magic" : "0",
- "File::Slurp" : "9999.13",
- "HTML::Tree" : "0",
- "IO::Compress::Gzip" : "0",
- "IO::Scalar" : "0",
- "JSON" : "0",
- "JSON::XS" : "2.0",
- "LWP" : "5.835",
- "LWP::UserAgent" : "0",
- "List::MoreUtils" : "0.22",
- "Math::Random::ISAAC" : "v1.0.1",
- "Module::Metadata" : "1.000033",
- "Module::Runtime" : "0",
- "Moo" : "2",
- "Parse::CPAN::Meta" : "1.44",
- "Regexp::Common" : "0",
- "Sys::Syslog" : "0",
- "Template" : "2.24",
- "Text::CSV_XS" : "0",
- "Text::Diff" : "0",
- "Throwable" : "0",
- "Tie::IxHash" : "0",
- "URI" : "1.55",
- "perl" : "5.010001",
- "version" : "0.87"
- }
- },
- "test" : {
- "requires" : {
- "Pod::Coverage" : "0",
- "Test::More" : "0",
- "Test::WWW::Selenium" : "0"
- }
- }
- },
- "release_status" : "stable",
- "version" : "42",
- "x_serialization_backend" : "JSON::PP version 2.27300"
-}
diff --git a/META.yml b/META.yml
deleted file mode 100644
index 7edf6b932..000000000
--- a/META.yml
+++ /dev/null
@@ -1,270 +0,0 @@
----
-abstract: 'Bugzilla Bug Tracking System'
-author:
- - 'Bugzilla Developers <developers@bugzilla.org>'
-build_requires:
- ExtUtils::MakeMaker: 6.57_07
- Pod::Coverage: '0'
- Test::More: '0'
- Test::WWW::Selenium: '0'
-configure_requires:
- ExtUtils::MakeMaker: 6.57_07
-dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.22, CPAN::Meta::Converter version 2.150005'
-license: unknown
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: '1.4'
-name: Bugzilla
-no_index:
- directory:
- - t
- - inc
-optional_features:
- auth_delegation:
- description: 'Auth Delegation'
- requires:
- LWP::UserAgent: '0'
- auth_ldap:
- description: 'LDAP Authentication'
- requires:
- Net::LDAP: '0'
- auth_radius:
- description: 'RADIUS Authentication'
- requires:
- Authen::Radius: '0'
- bmo:
- description: 'features that bmo needs'
- requires:
- Auth::GoogleAuth: '1.01'
- Cache::Memcached::Fast: '0.17'
- Chart::Lines: v2.4.10
- Class::Accessor::Fast: '0'
- DBD::mysql: '4.037'
- Daemon::Generic: '0'
- Email::MIME::Attachment::Stripper: '0'
- Email::Reply: '0'
- Encode: '2.21'
- Encode::Detect: '0'
- File::Copy::Recursive: '0'
- File::MimeInfo::Magic: '0'
- File::Which: '0'
- GD: '1.20'
- GD::Barcode::QRcode: '0'
- GD::Graph: '0'
- GD::Text: '0'
- HTML::Parser: '3.67'
- HTML::Scrubber: '0'
- IO::Async: '0'
- IO::Scalar: '0'
- JSON::RPC: '== 1.01'
- LWP::UserAgent: '0'
- MIME::Parser: '5.406'
- MooX::StrictConstructor: '0.008'
- Mozilla::CA: '0'
- Net::SFTP: '0'
- PatchReader: v0.9.6
- Role::Tiny: '0'
- SOAP::Lite: '0.712'
- Search::Elasticsearch: '0'
- Template::Plugin::GD::Image: '0'
- Test::Taint: '1.06'
- Text::MultiMarkdown: '1.000034'
- TheSchwartz: '1.10'
- Type::Tiny: '1'
- URI::Escape: '0'
- XML::Simple: '0'
- XML::Twig: '0'
- XMLRPC::Lite: '0.712'
- csp:
- description: 'Content-Security-Policy support'
- requires:
- MooX::StrictConstructor: '0.008'
- Type::Tiny: '1'
- detect_charset:
- description: 'Automatic charset detection for text attachments'
- requires:
- Encode: '2.21'
- Encode::Detect: '0'
- documentation:
- description: Documentation
- requires:
- File::Copy::Recursive: '0'
- File::Which: '0'
- elasticsearch:
- description: 'Elasticsearch-powered searches'
- recommends:
- Term::ProgressBar: '0'
- requires:
- IO::Async: '0'
- Role::Tiny: '0'
- Search::Elasticsearch: '0'
- extension_bitly_optional:
- requires:
- Mozilla::CA: '0'
- extension_push_optional:
- requires:
- Net::SFTP: '0'
- XML::Simple: '0'
- graphical_reports:
- description: 'Graphical Reports'
- requires:
- GD: '1.20'
- GD::Graph: '0'
- GD::Text: '0'
- Template::Plugin::GD::Image: '0'
- html_desc:
- description: 'More HTML in Product/Group Descriptions'
- requires:
- HTML::Parser: '3.67'
- HTML::Scrubber: '0'
- inbound_email:
- description: 'Inbound Email'
- requires:
- Email::MIME::Attachment::Stripper: '0'
- Email::Reply: '0'
- jobqueue:
- description: 'Mail Queueing'
- requires:
- Daemon::Generic: '0'
- TheSchwartz: '1.10'
- jsonrpc:
- description: 'JSON-RPC Interface'
- requires:
- JSON::RPC: '== 1.01'
- Test::Taint: '1.06'
- linux_pid:
- description: 'Linux::PID for MozReview'
- requires:
- Linux::Pid: '0'
- markdown:
- description: 'Markdown syntax support for comments'
- requires:
- Text::MultiMarkdown: '1.000034'
- memcached:
- description: 'Memcached Support'
- requires:
- Cache::Memcached::Fast: '0.17'
- mfa:
- description: 'Multi-Factor Authentication'
- requires:
- Auth::GoogleAuth: '1.01'
- GD::Barcode::QRcode: '0'
- mod_perl:
- description: 'mod_perl support under Apache'
- requires:
- Apache2::SizeLimit: '0.96'
- mod_perl2: '1.999022'
- moving:
- description: 'Move Bugs Between Installations'
- requires:
- MIME::Parser: '5.406'
- XML::Twig: '0'
- mysql:
- description: 'MySQL database support'
- requires:
- DBD::mysql: '4.037'
- new_charts:
- description: 'New Charts'
- requires:
- Chart::Lines: v2.4.10
- GD: '1.20'
- old_charts:
- description: 'Old Charts'
- requires:
- Chart::Lines: v2.4.10
- GD: '1.20'
- oracle:
- description: 'Oracle database support'
- requires:
- DBD::Oracle: '1.19'
- patch_viewer:
- description: 'Patch Viewer'
- requires:
- PatchReader: v0.9.6
- pg:
- description: 'Postgres database support'
- requires:
- DBD::Pg: v2.19.3
- rest:
- description: 'REST Interface'
- requires:
- JSON::RPC: '== 1.01'
- Test::Taint: '1.06'
- s3:
- description: 'Amazon S3 Attachment Storage'
- requires:
- Class::Accessor::Fast: '0'
- URI::Escape: '0'
- XML::Simple: '0'
- smtp_auth:
- description: 'SMTP Authentication'
- requires:
- Authen::SASL: '0'
- sqlite:
- description: 'SQLite database support'
- requires:
- DBD::SQLite: '1.29'
- typesniffer:
- description: 'Sniff MIME type of attachments'
- requires:
- File::MimeInfo::Magic: '0'
- IO::Scalar: '0'
- updates:
- description: 'Automatic Update Notifications'
- requires:
- LWP::UserAgent: '0'
- XML::Twig: '0'
- xmlrpc:
- description: 'XML-RPC Interface'
- requires:
- SOAP::Lite: '0.712'
- Test::Taint: '1.06'
- XMLRPC::Lite: '0.712'
-recommends:
- Safe: '2.30'
-requires:
- CGI: '<= 3.63'
- CPAN::Meta::Prereqs: '2.132830'
- CPAN::Meta::Requirements: '2.121'
- Crypt::CBC: '0'
- Crypt::DES: '0'
- Crypt::DES_EDE3: '0'
- Crypt::OpenPGP: '1.02'
- Crypt::SMIME: '0'
- DBI: '1.614'
- Daemon::Generic: '0'
- Date::Format: '2.23'
- DateTime: '0.75'
- DateTime::TimeZone: '1.64'
- Digest::SHA: '0'
- Email::Address: '0'
- Email::MIME: '1.904'
- Email::Send: '1.911'
- File::MimeInfo::Magic: '0'
- File::Slurp: '9999.13'
- HTML::Tree: '0'
- IO::Compress::Gzip: '0'
- IO::Scalar: '0'
- JSON: '0'
- JSON::XS: '2.0'
- LWP: '5.835'
- LWP::UserAgent: '0'
- List::MoreUtils: '0.22'
- Math::Random::ISAAC: v1.0.1
- Module::Metadata: '1.000033'
- Module::Runtime: '0'
- Moo: '2'
- Parse::CPAN::Meta: '1.44'
- Regexp::Common: '0'
- Sys::Syslog: '0'
- Template: '2.24'
- Text::CSV_XS: '0'
- Text::Diff: '0'
- Throwable: '0'
- Tie::IxHash: '0'
- URI: '1.55'
- perl: '5.010001'
- version: '0.87'
-version: '42'
-x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/Makefile.PL b/Makefile.PL
index f9054cc21..59ed8f2cd 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -15,7 +15,14 @@
use 5.10.1;
use strict;
use warnings;
-use lib qw(. lib local/lib/perl5);
+
+use File::Basename;
+use File::Spec;
+BEGIN {
+ require lib;
+ my $dir = File::Spec->rel2abs(dirname(__FILE__));
+ lib->import($dir, File::Spec->catdir($dir, "lib"), File::Spec->catdir($dir, qw(local lib perl5)));
+}
use ExtUtils::MakeMaker 6.55;
use constant BUGZILLA_VERSION => $ENV{BUGZILLA_VERSION} // 42;
@@ -29,28 +36,6 @@ BEGIN {
}
}
-# META.json and META.yml exist only for the benefit of older
-# installs where cpanm can't get the optional features out of Makefile.PL
-# Unfortunately having META.json and META.yml commited to the repo is weird
-# and MakeMaker always prefers their content to the internal data (unless CPAN::META
-# is not installed).
-# Since we (Bugzilla) require this cludge, we hide the files from MakeMaker.
-BEGIN {
- warn "Hiding META.{json,yml} from MakeMaker...\n";
- rename( 'META.json', 'META.json.hide' ) || unlink("META.json");
- rename( 'META.yml', 'META.yml.hide' ) || unlink("META.yml");
-
- if (!eval { ExtUtils::MakeMaker->VERSION('6.57_07') }) {
- warn "WARNING: ExtUtils::MakeMaker should be at least 6.57_07 in order to support updating META.json files\n";
- }
-}
-
-END {
- warn "Unhiding META.{json,yml}...\n";
- rename( 'META.json.hide', 'META.json' );
- rename( 'META.yml.hide', 'META.yml' );
-}
-
# PREREQ_PM
my %requires = (
'CGI' => '<= 3.63',
diff --git a/checksetup.pl b/checksetup.pl
index 327de3c56..598432c93 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -17,11 +17,13 @@ use strict;
use warnings;
use File::Basename;
-BEGIN { chdir dirname($0); }
-use lib qw(. lib local/lib/perl5 .checksetup_lib/lib/perl5);
-
-# the @INC which checksetup needs to operate against.
-our @BUGZILLA_INC = grep { !/checksetup_lib/ } @INC;
+use File::Spec;
+BEGIN {
+ require lib;
+ my $dir = File::Spec->rel2abs(dirname(__FILE__));
+ lib->import($dir, File::Spec->catdir($dir, "lib"), File::Spec->catdir($dir, qw(local lib perl5)));
+ chdir($dir);
+}
use Getopt::Long qw(:config bundling);
use Pod::Usage;
@@ -92,18 +94,21 @@ $ENV{PERL_MM_USE_DEFAULT} = 1;
$ENV{BZ_SILENT_MAKEFILE} = 1;
system($^X, "Makefile.PL");
-my $meta = load_cpan_meta();
+if (! -f "MYMETA.json") {
+ die "Makefile.PL failed to generate a MYMETA.json file.",
+ "Try upgrading ExtUtils::MakeMaker";
+}
+require Bugzilla::CPAN;
+
+my $meta = Bugzilla::CPAN->cpan_meta;
if (keys %{$meta->{optional_features}} < 1) {
- warn "Your version of ExtUtils::MakeMaker is probably too old\n";
- warn "Falling back to static (and wrong) META.json\n";
- unlink('MYMETA.json');
- $meta = load_cpan_meta();
+ die "Your version of ExtUtils::MakeMaker is too old or broken\n";
}
-my $requirements = check_cpan_requirements($meta, \@BUGZILLA_INC, !$silent);
+my $requirements = check_cpan_requirements($meta, [@INC], !$silent);
exit 1 unless $requirements->{ok};
-check_all_cpan_features($meta, \@BUGZILLA_INC, !$silent);
+check_all_cpan_features($meta, [@INC], !$silent);
exit 0 if $switch{'check-modules'};
###########################################################################
diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl
index 18650de7d..384647322 100644
--- a/template/en/default/global/code-error.html.tmpl
+++ b/template/en/default/global/code-error.html.tmpl
@@ -134,7 +134,7 @@
[% ELSIF error == "cookies_need_value" %]
Every cookie must have a value.
[% ELSIF error == "cpan_meta_missing" %]
- META.json/MYMETA.json file is missing.
+ MYMETA.json file is missing.
[% ELSIF error == "env_no_email" %]
[% terms.Bugzilla %] did not receive an email address from the
environment.