summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/CGI.pm37
-rwxr-xr-xMakefile.PL221
2 files changed, 116 insertions, 142 deletions
diff --git a/Bugzilla/CGI.pm b/Bugzilla/CGI.pm
index 3906156c4..3737b97e2 100644
--- a/Bugzilla/CGI.pm
+++ b/Bugzilla/CGI.pm
@@ -14,6 +14,7 @@ use warnings;
use CGI;
use base qw(CGI);
+use Bugzilla::CGI::ContentSecurityPolicy;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
@@ -188,36 +189,28 @@ sub target_uri {
sub content_security_policy {
my ($self, %add_params) = @_;
- if (Bugzilla->has_feature('csp')) {
- require Bugzilla::CGI::ContentSecurityPolicy;
- if (%add_params || !$self->{Bugzilla_csp}) {
- my %params = DEFAULT_CSP;
- delete $params{report_only} if %add_params && !$add_params{report_only};
- foreach my $key (keys %add_params) {
- if (defined $add_params{$key}) {
- $params{$key} = $add_params{$key};
- }
- else {
- delete $params{$key};
- }
+ if (%add_params || !$self->{Bugzilla_csp}) {
+ my %params = DEFAULT_CSP;
+ delete $params{report_only} if %add_params && !$add_params{report_only};
+ foreach my $key (keys %add_params) {
+ if (defined $add_params{$key}) {
+ $params{$key} = $add_params{$key};
+ }
+ else {
+ delete $params{$key};
}
- $self->{Bugzilla_csp} = Bugzilla::CGI::ContentSecurityPolicy->new(%params);
}
-
- return $self->{Bugzilla_csp};
+ $self->{Bugzilla_csp} = Bugzilla::CGI::ContentSecurityPolicy->new(%params);
}
- return undef;
+
+ return $self->{Bugzilla_csp};
}
sub csp_nonce {
my ($self) = @_;
- if (Bugzilla->has_feature('csp')) {
- my $csp = $self->content_security_policy;
- return $csp->nonce if $csp->has_nonce;
- }
-
- return '';
+ my $csp = $self->content_security_policy;
+ return $csp->has_nonce ? $csp->nonce : '';
}
# We want this sorted plus the ability to exclude certain params
diff --git a/Makefile.PL b/Makefile.PL
index 9c1f05e6f..34e4e2487 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,22 +6,17 @@
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
-# This file has detailed POD docs, do "perldoc checksetup.pl" to see them.
-
-######################################################################
-# Initialization
-######################################################################
-
use 5.10.1;
use strict;
use warnings;
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)));
+ 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 7.22;
@@ -29,55 +24,59 @@ use File::Basename;
use File::Spec;
BEGIN {
- if ($ENV{BZ_SILENT_MAKEFILE}) {
- open STDOUT, '>>', File::Spec->devnull;
- open STDERR, '>>', File::Spec->devnull;
+ if ( $ENV{BZ_SILENT_MAKEFILE} ) {
+ open STDOUT, '>>', File::Spec->devnull or die "redirecting STDOUT to /dev/null failed: $!";
+ open STDERR, '>>', File::Spec->devnull or die "redirecting STDERR to /dev/null failed: $!";
}
}
# PREREQ_PM
my %requires = (
- 'Algorithm::BloomFilter' => 0,
- 'CGI' => '<= 3.63',
+ 'Algorithm::BloomFilter' => '0.02',
+ 'CGI' => '3.51',
'CPAN::Meta::Prereqs' => '2.132830',
'CPAN::Meta::Requirements' => '2.121',
+ 'Class::XSAccessor' => '1.18',
'DBI' => '1.614',
'Data::Password::passwdqc' => '0.08',
'Date::Format' => '2.23',
'DateTime' => '0.75',
'DateTime::TimeZone' => '2.11',
- 'Digest::SHA' => 0,
+ 'Devel::NYTProf' => '6.04',
+ 'Digest::SHA' => '5.47',
'Email::MIME' => '1.904',
'Email::Send' => '1.911',
'File::Slurp' => '9999.13',
+ 'Future' => '0.34',
+ 'HTML::Escape' => '1.10',
+ 'IO::Async' => '0.71',
+ 'JSON::MaybeXS' => '1.003008',
'JSON::XS' => '2.01',
'LWP::Protocol::https' => '6.07',
'LWP::UserAgent' => '6.26',
'List::MoreUtils' => '0.418',
+ 'Log::Dispatch' => '2.67',
+ 'Log::Log4perl' => '1.49',
'Math::Random::ISAAC' => '1.0.1',
'Module::Metadata' => '1.000033',
- 'Module::Runtime' => 0,
- 'Moo' => 2,
- 'Mozilla::CA' => 0,
+ 'Module::Runtime' => '0.014',
+ 'Moo' => '2.002004',
+ 'MooX::StrictConstructor' => '0.008',
+ 'Mozilla::CA' => '20160104',
'Parse::CPAN::Meta' => '1.44',
+ 'Role::Tiny' => '2.000003',
+ 'Sereal' => '4.004',
+ 'Taint::Util' => '0.08',
'Template' => '2.24',
- 'Text::CSV_XS' => 0,
- 'Throwable' => 0,
+ 'Text::CSV_XS' => '1.26',
+ 'Throwable' => '0.200013',
+ 'Type::Tiny' => '1.000005',
'URI' => '1.55',
- 'version' => '0.87',
- 'Taint::Util' => 0,
- 'Devel::NYTProf' => 0,
- 'Class::XSAccessor' => '1.18',
- 'HTML::Escape' => '1.10',
'URI::Escape::XS' => '0.14',
- 'Sereal' => '4.004',
- 'Log::Dispatch' => '2.67',
- 'Log::Log4perl' => '1.49',
- 'JSON::MaybeXS' => '1.003008',
-);
-my %build_requires = (
- 'ExtUtils::MakeMaker' => '7.22',
+ 'version' => '0.87',
);
+
+my %build_requires = ( 'ExtUtils::MakeMaker' => '7.22', );
my %test_requires = (
'Test::More' => 0,
'Pod::Coverage' => 0,
@@ -96,7 +95,7 @@ if ( $^O eq 'MSWin32' ) {
}
# for some reason, we need these on ubuntu.
-if ($^O eq 'linux' && -f '/etc/debian_version') {
+if ( $^O eq 'linux' && -f '/etc/debian_version' ) {
my @extra = qw(
Linux::Pid
Test::Pod::Coverage
@@ -109,29 +108,26 @@ if ($^O eq 'linux' && -f '/etc/debian_version') {
my %optional_features = (
smtp_auth => {
- prereqs => { runtime => { requires => { 'Authen::SASL' => 0 } } },
- description => 'SMTP Authentication'
+ description => 'SMTP Authentication',
+ prereqs => { runtime => { requires => { 'Authen::SASL' => 0 } } },
},
detect_charset => {
- prereqs => {
- runtime =>
- { requires => { 'Encode::Detect' => 0, Encode => '2.21' } }
+ description => 'Automatic charset detection for text attachments',
+ prereqs => {
+ runtime => { requires => { 'Encode::Detect' => 0, Encode => '2.21' } }
},
- description => 'Automatic charset detection for text attachments'
},
new_charts => {
description => 'New Charts',
prereqs => {
- runtime =>
- { requires => { 'Chart::Lines' => 'v2.4.10', GD => '1.20' } }
+ runtime => { requires => { 'Chart::Lines' => 'v2.4.10', GD => '1.20' } }
}
},
html_desc => {
description => 'More HTML in Product/Group Descriptions',
prereqs => {
runtime => {
- requires =>
- { 'HTML::Parser' => '3.67', 'HTML::Scrubber' => 0 }
+ requires => { 'HTML::Parser' => '3.67', 'HTML::Scrubber' => 0 }
}
}
},
@@ -142,8 +138,8 @@ my %optional_features = (
}
},
pg => {
- prereqs => { runtime => { requires => { 'DBD::Pg' => 'v2.19.3' } } },
- description => 'Postgres database support'
+ description => 'Postgres database support',
+ prereqs => { runtime => { requires => { 'DBD::Pg' => 'v2.19.3' } } },
},
memcached => {
description => 'Memcached Support',
@@ -154,22 +150,23 @@ my %optional_features = (
updates => {
description => 'Automatic Update Notifications',
prereqs => {
- runtime =>
- { requires => { 'XML::Twig' => 0 } }
+ runtime => { requires => { 'XML::Twig' => 0 } }
}
},
auth_radius => {
description => 'RADIUS Authentication',
- prereqs => { runtime => { requires => { 'Authen::Radius' => 0 } } }
+ prereqs => { runtime => { requires => { 'Authen::Radius' => 0 } } }
},
documentation => {
- prereqs => {
+ description => 'Documentation',
+ prereqs => {
runtime => {
- requires =>
- { 'File::Which' => 0, 'File::Copy::Recursive' => 0 }
+ requires => {
+ 'File::Which' => 0,
+ 'File::Copy::Recursive' => 0,
+ }
}
},
- description => 'Documentation',
},
xmlrpc => {
description => 'XML-RPC Interface',
@@ -184,62 +181,64 @@ my %optional_features = (
}
},
auth_ldap => {
- prereqs => { runtime => { requires => { 'Net::LDAP' => 0 } } },
- description => 'LDAP Authentication'
+ description => 'LDAP Authentication',
+ prereqs => { runtime => { requires => { 'Net::LDAP' => 0 } } },
},
old_charts => {
- prereqs => {
- runtime =>
- { requires => { GD => '1.20', 'Chart::Lines' => 'v2.4.10' } }
+ description => 'Old Charts',
+ prereqs => {
+ runtime => {
+ requires => { GD => '1.20', 'Chart::Lines' => 'v2.4.10' }
+ },
},
- description => 'Old Charts'
},
moving => {
- prereqs => {
+ description => 'Move Bugs Between Installations',
+ prereqs => {
runtime => {
requires => { 'MIME::Parser' => '5.406', 'XML::Twig' => 0 }
}
},
- description => 'Move Bugs Between Installations'
},
oracle => {
description => 'Oracle database support',
- prereqs => { runtime => { requires => { 'DBD::Oracle' => '1.19' } } }
+ prereqs => { runtime => { requires => { 'DBD::Oracle' => '1.19' } } }
},
s3 => {
description => 'Amazon S3 Attachment Storage',
- prereqs => {
+ prereqs => {
runtime => {
requires => {
'Class::Accessor::Fast' => 0,
- 'XML::Simple' => 0,
- 'URI::Escape' => 0,
+ 'XML::Simple' => 0,
+ 'URI::Escape' => 0,
}
}
}
},
typesniffer => {
- prereqs => {
+ description => 'Sniff MIME type of attachments',
+ prereqs => {
runtime => {
- requires =>
- { 'IO::Scalar' => 0, 'File::MimeInfo::Magic' => 0 }
- }
+ requires => {
+ 'IO::Scalar' => 0,
+ 'File::MimeInfo::Magic' => 0,
+ },
+ },
},
- description => 'Sniff MIME type of attachments'
},
sqlite => {
- prereqs => { runtime => { requires => { 'DBD::SQLite' => '1.29' } } },
- description => 'SQLite database support'
+ description => 'SQLite database support',
+ prereqs => { runtime => { requires => { 'DBD::SQLite' => '1.29' } } },
},
mysql => {
description => 'MySQL database support',
- prereqs => { runtime => { requires => { 'DBD::mysql' => '4.037' } } }
+ prereqs => { runtime => { requires => { 'DBD::mysql' => '4.037' } } }
},
jsonrpc => {
description => 'JSON-RPC Interface',
prereqs => {
- runtime =>
- { requires => { 'JSON::RPC' => '== 1.01', 'Test::Taint' => '1.06' } }
+ runtime => { requires => { 'JSON::RPC' => '== 1.01', 'Test::Taint' => '1.06' } }
}
},
graphical_reports => {
@@ -278,19 +277,19 @@ my %optional_features = (
}
},
inbound_email => {
- prereqs => {
+ description => 'Inbound Email',
+ prereqs => {
runtime => {
requires => {
'Email::MIME::Attachment::Stripper' => 0,
- 'Email::Reply' => 0,
+ 'Email::Reply' => 0,
}
}
},
- description => 'Inbound Email'
},
patch_viewer => {
description => 'Patch Viewer',
- prereqs => { runtime => { requires => { PatchReader => '0.9.6' } } }
+ prereqs => { runtime => { requires => { PatchReader => '0.9.6' } } }
},
rest => {
description => 'REST Interface',
@@ -298,14 +297,14 @@ my %optional_features = (
runtime => {
requires => {
'Test::Taint' => '1.06',
- 'JSON::RPC' => '==1.01',
+ 'JSON::RPC' => '==1.01',
}
}
}
},
linux_pid => {
description => 'Linux::PID for MozReview',
- prereqs => {
+ prereqs => {
runtime => {
requires => { 'Linux::Pid' => 0 },
},
@@ -319,42 +318,26 @@ my %optional_features = (
}
}
},
- csp => {
- description => 'Content-Security-Policy support',
- prereqs => {
- runtime => {
- requires => {
- 'Type::Tiny' => 1,
- 'MooX::StrictConstructor' => 0.008,
- }
- }
- }
- },
elasticsearch => {
description => 'Elasticsearch-powered searches',
- prereqs => {
+ prereqs => {
runtime => {
- recommends => {
- 'Term::ProgressBar' => 0,
- },
- requires => {
- 'Search::Elasticsearch' => 0,
- 'IO::Async' => 0,
- 'Role::Tiny' => 0,
- },
- }
+ recommends => { 'Term::ProgressBar' => 0 },
+ requires => { 'Search::Elasticsearch' => 0 },
+
+ },
},
},
);
-for my $file ( glob("extensions/*/Config.pm") ) {
+for my $file ( glob 'extensions/*/Config.pm' ) {
my $dir = dirname($file);
my $name = basename($dir);
- next if -f File::Spec->catfile( $dir, "disabled" );
+ next if -f File::Spec->catfile( $dir, 'disabled' );
require $file;
my $class = "Bugzilla::Extension::$name";
- if ( $class->can("REQUIRED_MODULES") ) {
+ if ( $class->can('REQUIRED_MODULES') ) {
foreach my $required_module ( @{ $class->REQUIRED_MODULES() } ) {
$requires{ $required_module->{module} }
= $required_module->{version};
@@ -367,8 +350,7 @@ for my $file ( glob("extensions/*/Config.pm") ) {
my @features
= $mod->{feature} ? @{ $mod->{feature} } : ($default_feature);
foreach my $feature (@features) {
- $optional_features{$feature}{prereqs}{runtime}{requires}
- { $mod->{module} } = $mod->{version} // 0;
+ $optional_features{$feature}{prereqs}{runtime}{requires}{ $mod->{module} } = $mod->{version} // 0;
}
}
}
@@ -393,30 +375,28 @@ my @bmo_features = grep {
$optional_features{bmo} = {
description => 'features that bmo needs',
- prereqs => {
+ prereqs => {
runtime => {
- requires => {
- map { %{$optional_features{$_}{prereqs}{runtime}{requires}} } @bmo_features
- },
+ requires => { map { %{ $optional_features{$_}{prereqs}{runtime}{requires} } } @bmo_features },
},
},
};
WriteMakefile(
- NAME => 'Bugzilla',
- AUTHOR => q{Bugzilla Developers <developers@bugzilla.org>},
- VERSION_FROM => 'Bugzilla.pm',
- ABSTRACT => 'Bugzilla Bug Tracking System',
- LICENSE => 'Mozilla_2_0',
- MIN_PERL_VERSION => '5.10.1',
+ NAME => 'Bugzilla',
+ AUTHOR => q{Bugzilla Developers <developers@bugzilla.org>},
+ VERSION_FROM => 'Bugzilla.pm',
+ ABSTRACT => 'Bugzilla Bug Tracking System',
+ LICENSE => 'Mozilla_2_0',
+ MIN_PERL_VERSION => '5.10.1',
CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => $build_requires{'ExtUtils::MakeMaker'} },
PREREQ_PM => { %requires },
BUILD_REQUIRES => { %build_requires },
TEST_REQUIRES => { %test_requires },
- META_MERGE => {
- "meta-spec" => {
- url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- version => "2"
+ META_MERGE => {
+ 'meta-spec' => {
+ url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
+ version => '2'
},
dynamic_config => 1,
prereqs => {
@@ -429,7 +409,7 @@ WriteMakefile(
);
sub MY::postamble {
- return <<MAKE;
+ return <<"MAKE";
GEN_CPANFILE_ARGS = -D bmo
cpanfile: MYMETA.json
\t\$(PERLRUN) gen-cpanfile.pl \$(GEN_CPANFILE_ARGS)
@@ -441,3 +421,4 @@ META.yml: Makefile.PL
\tmake distmeta 2>&1 /dev/null; mv */META.yml .
MAKE
}
+