Commit 2c33712d authored by Dylan Hardison's avatar Dylan Hardison

Bug 1246528 - Use Makefile.PL and allow Bugzilla use cpanm-compatible local dependencies

r=dkl,a=dylan
parent a8adffb5
/**/.htaccess
/lib/*
/local/*
/template/en/custom
/docs/en/rst/extensions/*
/docs/en/rst/api/extensions/*
......@@ -12,6 +13,10 @@
/localconfig
/cpanfile
/index.html
/Makefile
/MYMETA.*
/pm_to_blib
/blib
/skins/contrib/Dusk/admin.css
/skins/contrib/Dusk/bug.css
......@@ -34,7 +34,6 @@ use Bugzilla::Extension;
use Bugzilla::Field;
use Bugzilla::Flag;
use Bugzilla::Install::Localconfig qw(read_localconfig);
use Bugzilla::Install::Requirements qw(OPTIONAL_MODULES have_vers);
use Bugzilla::Install::Util qw(init_console include_languages i_am_persistent);
use Bugzilla::Memcached;
use Bugzilla::Template;
......@@ -47,6 +46,7 @@ use File::Spec::Functions;
use DateTime::TimeZone;
use Date::Parse;
use Safe;
use List::Util qw(first);
#####################################################################
# Constants
......@@ -245,32 +245,66 @@ sub api_server {
return $cache->{api_server};
}
use constant _CAN_HAS_FEATURE => eval {
require CPAN::Meta;
require Module::Runtime;
require CPAN::Meta::Check;
Module::Runtime->import(qw(require_module));
CPAN::Meta::Check->import(qw(verify_dependencies));
1;
};
sub feature {
my ($class, $feature) = @_;
my ($class, $feature_name) = @_;
return 0 unless _CAN_HAS_FEATURE;
return unless $class->has_feature($feature_name);
my $cache = $class->request_cache;
return $cache->{feature}->{$feature}
if exists $cache->{feature}->{$feature};
my $feature = $cache->{feature_map}{$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->requirements_for('runtime', 'requires')->required_modules;
require_module($_) foreach @modules;
$cache->{feature_loaded}{$feature_name} = 1;
return 1;
}
my $feature_map = $cache->{feature_map};
if (!$feature_map) {
foreach my $package (@{ OPTIONAL_MODULES() }) {
foreach my $f (@{ $package->{feature} }) {
$feature_map->{$f} ||= [];
push(@{ $feature_map->{$f} }, $package);
}
sub has_feature {
my ($class, $feature_name) = @_;
return 0 unless _CAN_HAS_FEATURE;
my $cache = $class->request_cache;
return $cache->{feature}->{$feature_name}
if exists $cache->{feature}->{$feature_name};
my $dir = bz_locations()->{libpath};
my $feature_map = $cache->{feature_map} //= do {
my @meta_json = map { File::Spec->catfile($dir, $_) } qw( MYMETA.json META.json );
my $file = first { -f $_ } @meta_json;
my %map;
if ($file) {
open my $meta_fh, '<', $file or die "unable to open $file: $!";
my $str = do { local $/ = undef; scalar <$meta_fh> };
trick_taint($str);
close $meta_fh;
my $meta = CPAN::Meta->load_json_string($str);
foreach my $feature ($meta->features) {
$map{$feature->identifier} = $feature->prereqs;
}
$cache->{feature_map} = $feature_map;
}
if (!$feature_map->{$feature}) {
ThrowCodeError('invalid_feature', { feature => $feature });
}
\%map;
};
my $success = 1;
foreach my $package (@{ $feature_map->{$feature} }) {
have_vers($package) or $success = 0;
}
$cache->{feature}->{$feature} = $success;
ThrowCodeError('invalid_feature', { feature => $feature_name }) if !$feature_map->{$feature_name};
my $success = !verify_dependencies($feature_map->{$feature_name}, 'runtime', 'requires');
$cache->{feature}{$feature_name} = $success;
return $success;
}
......@@ -1015,8 +1049,12 @@ this Bugzilla installation.
=item C<feature>
Tells you whether or not a specific feature is enabled. For names
of features, see C<OPTIONAL_MODULES> in C<Bugzilla::Install::Requirements>.
Wrapper around C<has_feature()> that also loads all of required modules into the runtime.
=item C<has_feature>
Consults F<MYMETA.yml> for optional Bugzilla features and returns true if all the requirements
are installed.
=item C<api_server>
......
......@@ -20,7 +20,7 @@ use Bugzilla::Hook;
use Bugzilla::Util qw(datetime_from trick_taint);
use File::Basename qw(basename);
use File::Glob qw(:bsd_glob);
use File::Glob qw(:glob);
use List::MoreUtils qw(none uniq);
use MIME::Base64 qw(decode_base64 encode_base64);
use Moo;
......
......@@ -516,41 +516,11 @@ use constant INSTALLATION_MODE_NON_INTERACTIVE => 1;
# Data about what we require for different databases.
use constant DB_MODULE => {
# MySQL 5.0.15 was the first production 5.0.x release.
'mysql' => {db => 'Bugzilla::DB::Mysql', db_version => '5.0.15',
dbd => {
package => 'DBD-mysql',
module => 'DBD::mysql',
# Disallow development versions
blacklist => ['_'],
# For UTF-8 support. 4.001 makes sure that blobs aren't
# marked as UTF-8.
version => '4.001',
},
name => 'MySQL'},
'pg' => {db => 'Bugzilla::DB::Pg', db_version => '9.00.0000',
dbd => {
package => 'DBD-Pg',
module => 'DBD::Pg',
# Pg 9.2 requires 2.19.3 as spclocation no longer exists.
version => '2.19.3',
},
name => 'PostgreSQL'},
'oracle'=> {db => 'Bugzilla::DB::Oracle', db_version => '10.02.0',
dbd => {
package => 'DBD-Oracle',
module => 'DBD::Oracle',
version => '1.19',
},
name => 'Oracle'},
mysql => { db => 'Bugzilla::DB::Mysql', db_version => '5.0.15', name => 'MySQL'},
pg => { db => 'Bugzilla::DB::Pg', db_version => '9.00.0000', name => 'PostgreSQL'},
oracle => { db => 'Bugzilla::DB::Oracle', db_version => '10.02.0', name => 'Oracle'},
# SQLite 3.6.22 fixes a WHERE clause problem that may affect us.
sqlite => {db => 'Bugzilla::DB::Sqlite', db_version => '3.6.22',
dbd => {
package => 'DBD-SQLite',
module => 'DBD::SQLite',
# 1.29 is the version that contains 3.6.22.
version => '1.29',
},
name => 'SQLite'},
sqlite => { db => 'Bugzilla::DB::Sqlite', db_version => '3.6.22', name => 'SQLite'},
};
# True if we're on Win32.
......
......@@ -165,10 +165,6 @@ sub bz_check_requirements {
. bz_locations()->{'localconfig'};
}
# Check the existence and version of the DBD that we need.
my $dbd = $db->{dbd};
_bz_check_dbd($db, $output);
# We don't try to connect to the actual database if $db_check is
# disabled.
unless ($lc->{db_check}) {
......@@ -183,27 +179,6 @@ sub bz_check_requirements {
print "\n" if $output;
}
sub _bz_check_dbd {
my ($db, $output) = @_;
my $dbd = $db->{dbd};
unless (have_vers($dbd, $output)) {
my $sql_server = $db->{name};
my $command = install_command($dbd);
my $root = ROOT_USER;
my $dbd_mod = $dbd->{module};
my $dbd_ver = $dbd->{version};
die <<EOT;
For $sql_server, Bugzilla requires that perl's $dbd_mod $dbd_ver or later be
installed. To install this module, run the following command (as $root):
$command
EOT
}
}
sub bz_check_server_version {
my ($self, $db, $output) = @_;
......
......@@ -161,10 +161,8 @@ sub FILESYSTEM {
'email_in.pl' => { perms => WS_EXECUTE },
'sanitycheck.pl' => { perms => WS_EXECUTE },
'checksetup.pl' => { perms => OWNER_EXECUTE },
'runtests.pl' => { perms => OWNER_EXECUTE },
'jobqueue.pl' => { perms => OWNER_EXECUTE },
'migrate.pl' => { perms => OWNER_EXECUTE },
'install-module.pl' => { perms => OWNER_EXECUTE },
'clean-bug-user-last-visit.pl' => { perms => WS_EXECUTE },
'app.psgi' => { perms => CGI_READ },
......
......@@ -506,9 +506,9 @@ sub _UnescapeSpecialChars {
# are bound together with underscores, the string has the desired form.
sub _has_multiple_underscores {
my $string = shift;
return 0 unless defined($string) && length($string);
return 0 if $string =~ /[\t\s]+/;
return 1 if scalar (split /_/, $string) > 1;
return 0 unless $string;
return 0 if $string =~ /\s/;
return 1 if $string =~ /_/;
return 0;
}
......
{
"abstract" : "Bugzilla Bug Tracking System",
"author" : [
"Bugzilla Developers <developers@bugzilla.org>"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 7.0401, 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"
}
}
}
},
"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"
}
}
}
},
"features" : {
"description" : "Base support for Features",
"prereqs" : {
"runtime" : {
"requires" : {
"CPAN::Meta" : "0",
"CPAN::Meta::Check" : "0",
"Module::Runtime" : "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::Reply" : "0",
"HTML::FormatText::WithLinks" : "0.13"
}
}
}
},
"jobqueue" : {
"description" : "Mail Queueing",
"prereqs" : {
"runtime" : {
"requires" : {
"Daemon::Generic" : "0",
"TheSchwartz" : "1.1"
}
}
}
},
"jsonrpc" : {
"description" : "JSON-RPC Interface",
"prereqs" : {
"runtime" : {
"requires" : {
"JSON::RPC" : "0",
"Test::Taint" : "1.06"
}
}
}
},
"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"
}
}
}
},
"mod_perl" : {
"description" : "mod_perl support under Apache",
"prereqs" : {
"runtime" : {
"requires" : {
"mod_perl2" : "0"
}
}
}
},
"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.001"
}
}
}
},
"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"
}
}
}
},
"psgi" : {
"description" : "Plack/PSGI support",
"prereqs" : {
"runtime" : {
"requires" : {
"CGI::Compile" : "0",
"CGI::Emulate::PSGI" : "0",
"Plack" : "1.0031"
}
}
}
},
"rest" : {
"description" : "REST Interface",
"prereqs" : {
"runtime" : {
"requires" : {
"HTTP::Request" : "0",
"HTTP::Response" : "0",
"Module::Runtime" : "0",
"Moo" : "2",
"Test::Taint" : "1.06"
}
}
}
},
"smtp_auth" : {
"description" : "SMTP Authentication",
"prereqs" : {
"runtime" : {
"requires" : {
"Authen::SASL" : "0"
}
}
}
},
"smtp_ssl" : {
"description" : "SSL Support for SMTP",
"prereqs" : {
"runtime" : {
"requires" : {
"Net::SMTP::SSL" : "1.01"
}
}
}
},
"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" : "0"
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.55"
}
},
"runtime" : {
"requires" : {
"CGI" : "3.51",
"DBI" : "1.614",
"Date::Format" : "2.23",
"DateTime" : "0.75",
"DateTime::TimeZone" : "1.64",
"Digest::SHA" : "0",
"Email::MIME" : "1.904",
"Email::Sender" : "1.300011",
"File::Slurp" : "9999.13",
"JSON::XS" : "2.01",
"List::MoreUtils" : "0.32",
"Math::Random::ISAAC" : "v1.0.1",
"Template" : "2.24",
"URI" : "1.55",
"perl" : "5.010001"
}
},
"test" : {
"requires" : {
"Pod::Coverage" : "0",
"Test::More" : "0",
"Test::Perl::Critic" : "0"
}
}
},
"release_status" : "stable",
"version" : "5.1",
"x_serialization_backend" : "JSON::PP version 2.27300"
}
---
abstract: 'Bugzilla Bug Tracking System'
author:
- 'Bugzilla Developers <developers@bugzilla.org>'
build_requires:
ExtUtils::MakeMaker: '0'
Pod::Coverage: '0'
Test::More: '0'
Test::Perl::Critic: '0'
configure_requires:
ExtUtils::MakeMaker: '6.55'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.0401, 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'
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'
features:
description: 'Base support for Features'
requires:
CPAN::Meta: '0'
CPAN::Meta::Check: '0'
Module::Runtime: '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::Reply: '0'
HTML::FormatText::WithLinks: '0.13'
jobqueue:
description: 'Mail Queueing'
requires:
Daemon::Generic: '0'
TheSchwartz: '1.1'
jsonrpc:
description: 'JSON-RPC Interface'
requires:
JSON::RPC: '0'
Test::Taint: '1.06'
markdown:
description: 'Markdown syntax support for comments'
requires:
Text::MultiMarkdown: '1.000034'
memcached:
description: 'Memcached Support'
requires:
Cache::Memcached::Fast: '0.17'
mod_perl:
description: 'mod_perl support under Apache'
requires:
mod_perl2: '0'
moving:
description: 'Move Bugs Between Installations'
requires:
MIME::Parser: '5.406'
XML::Twig: '0'
mysql:
description: 'MySQL database support'
requires:
DBD::mysql: '4.001'
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
psgi:
description: 'Plack/PSGI support'
requires:
CGI::Compile: '0'
CGI::Emulate::PSGI: '0'
Plack: '1.0031'
rest:
description: 'REST Interface'
requires:
HTTP::Request: '0'
HTTP::Response: '0'
Module::Runtime: '0'
Moo: '2'
Test::Taint: '1.06'
smtp_auth:
description: 'SMTP Authentication'
requires:
Authen::SASL: '0'
smtp_ssl:
description: 'SSL Support for SMTP'
requires:
Net::SMTP::SSL: '1.01'
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'
requires:
CGI: '3.51'
DBI: '1.614'
Date::Format: '2.23'
DateTime: '0.75'
DateTime::TimeZone: '1.64'
Digest::SHA: '0'
Email::MIME: '1.904'
Email::Sender: '1.300011'
File::Slurp: '9999.13'
JSON::XS: '2.01'
List::MoreUtils: '0.32'
Math::Random::ISAAC: v1.0.1
Template: '2.24'
URI: '1.55'
perl: '5.010001'
version: '5.1'
x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
#!/usr/bin/perl
# 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.
# This file has detailed POD docs, do "perldoc checksetup.pl" to see them.
######################################################################
# Initialization
######################################################################
use 5.10.1;
use strict;
use warnings;
use lib qw(. lib local/lib/perl5);
use ExtUtils::MakeMaker 6.55;
use Bugzilla::Constants qw(BUGZILLA_VERSION);
use File::Basename;
use File::Spec;
# 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");
}
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.51',
'DBI' => '1.614',
'Date::Format' => '2.23',
'DateTime' => '0.75',
'DateTime::TimeZone' => '1.64',
'Digest::SHA' => 0,
'Email::MIME' => '1.904',
'Email::Sender' => '1.300011',
'File::Slurp' => '9999.13',
'JSON::XS' => '2.01',
'List::MoreUtils' => '0.32',
'Math::Random::ISAAC' => '1.0.1',
'Template' => '2.24',
'URI' => '1.55',
);
my %optional_features = (
features => {
prereqs => { runtime => { requires => { 'CPAN::Meta::Check' => 0, 'Module::Runtime' => 0, 'CPAN::Meta' => 0, }, }, },
description => "Base support for Features"
},
smtp_auth => {
prereqs => { runtime => { requires => { 'Authen::SASL' => 0 } } },
description => 'SMTP Authentication'
},
detect_charset => {
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' } } }
},
html_desc => {
description => 'More HTML in Product/Group Descriptions',
prereqs => { runtime => { requires => { 'HTML::Parser' => '3.67', 'HTML::Scrubber' => 0 } } }
},
markdown => {
description => 'Markdown syntax support for comments',
prereqs => { runtime => { requires => { 'Text::MultiMarkdown' => '1.000034' } } }
},
pg => {
prereqs => { runtime => { requires => { 'DBD::Pg' => 'v2.19.3' } } },
description => 'Postgres database support'
},
memcached => {
description => 'Memcached Support',
prereqs => { runtime => { requires => { 'Cache::Memcached::Fast' => '0.17' } } }
},
auth_delegation => {
description => 'Auth Delegation',
prereqs => { runtime => { requires => { 'LWP::UserAgent' => 0 } } }
},
updates => {
description => 'Automatic Update Notifications',
prereqs => { runtime => { requires => { 'LWP::UserAgent' => 0, 'XML::Twig' => 0 } } }
},
auth_radius => {
description => 'RADIUS Authentication',
prereqs => { runtime => { requires => { 'Authen::Radius' => 0 } } }
},
documentation => {
prereqs => { runtime => { requires => { 'File::Which' => 0, 'File::Copy::Recursive' => 0 } } },
description => 'Documentation',
},
xmlrpc => {
description => 'XML-RPC Interfaze',
prereqs => {
runtime =>
{ requires => { 'XMLRPC::Lite' => '0.712', 'SOAP::Lite' => '0.712', 'Test::Taint' => '1.06' } }
}
},
auth_ldap => {
prereqs => { runtime => { requires => { 'Net::LDAP' => 0 } } },
description => 'LDAP Authentication'
},
old_charts => {
prereqs => { runtime => { requires => { GD => '1.20', 'Chart::Lines' => 'v2.4.10' } } },
description => 'Old Charts'
},
moving => {
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' } } }
},
typesniffer => {
prereqs => { runtime => { 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'
},
smtp_ssl => {
prereqs => { runtime => { requires => { 'Net::SMTP::SSL' => '1.01' } } },
description => 'SSL Support for SMTP'
},
mysql => {
description => 'MySQL database support',
prereqs => { runtime => { requires => { 'DBD::mysql' => '4.001' } } }
},
jsonrpc => {
description => 'JSON-RPC Interface',
prereqs => { runtime => { requires => { 'JSON::RPC' => 0, 'Test::Taint' => '1.06' } } }
},
graphical_reports => {
description => 'Graphical Reports',
prereqs => {
runtime => {
requires => {
'GD::Text' => 0,
'Template::Plugin::GD::Image' => 0,
'GD::Graph' => 0,
GD => '1.20',
}
}
}
},
mod_perl => {
description => 'mod_perl support under Apache',
prereqs => { runtime => { requires => { 'mod_perl2' => '0' } } }
},
inbound_email => {
prereqs => { runtime => { requires => { 'Email::Reply' => 0, 'HTML::FormatText::WithLinks' => '0.13' } } },
description => 'Inbound Email'
},
patch_viewer => {
description => 'Patch Viewer',
prereqs => { runtime => { requires => { PatchReader => 'v0.9.6' } } }
},
rest => {
description => 'REST Interface',
prereqs => {
runtime => {
requires => {
'Test::Taint' => '1.06',
'HTTP::Request' => 0,
'HTTP::Response' => 0,
Moo => 2,
'Module::Runtime' => 0
}
}
}
},
jobqueue => {
description => 'Mail Queueing',
prereqs => { runtime => { requires => { TheSchwartz => '1.1', 'Daemon::Generic' => 0 } } }
},
psgi => {
description => 'Plack/PSGI support',
prereqs => {
runtime => { requires => { Plack => '1.0031', 'CGI::Compile' => 0, 'CGI::Emulate::PSGI' => 0 } }
}
},
);
for my $file (glob("extensions/*/Config.pm")) {
my $dir = dirname($file);
my $name = basename($dir);
next if -f File::Spec->catfile($dir, "disabled");
require $file;
my $class = "Bugzilla::Extension::$name";
if ($class->can("REQUIRED_MODULES")) {
foreach my $required_module (@{ $class->REQUIRED_MODULES() }) {
$requires{$required_module->{module}} = $required_module->{version};
}
}
if ($class->can('OPTIONAL_MODULES')) {
my $default_feature = 'extension_' . lc($name) . '_optional';
foreach my $mod (@{ $class->OPTIONAL_MODULES }) {
my @features = $mod->{feature} ? @{$mod->{feature}} : ($default_feature);
foreach my $feature (@features) {
$optional_features{$feature}{prereqs}{runtime}{requires}{$mod->{module}} = $mod->{version} // 0;
}
}
}
}
WriteMakefile(
NAME => 'Bugzilla',
AUTHOR => q{Bugzilla Developers <developers@bugzilla.org>},
VERSION => BUGZILLA_VERSION,
ABSTRACT => 'Bugzilla Bug Tracking System',
LICENSE => 'Mozilla_2_0',
MIN_PERL_VERSION => '5.10.1',
CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => '6.55' },
PREREQ_PM => \%requires,
TEST_REQUIRES => { 'Test::More' => 0, 'Pod::Coverage' => 0, 'Test::Perl::Critic' => 0, },
META_MERGE => {
"meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => "2" },
dynamic_config => 1,
dog => 1,
optional_features => \%optional_features,
},
);
sub MY::postamble {
return <<MAKE;
GEN_CPANFILE_ARGS = -A -U mod_perl -U oracle
cpanfile: MYMETA.json
\t\$(PERLRUN) gen-cpanfile.pl \$(GEN_CPANFILE_ARGS)
MAKE
}
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -11,9 +11,14 @@ use strict;
use warnings;
use File::Basename;
use lib dirname(__FILE__);
use File::Spec;
BEGIN {
require lib;
my $dir = dirname(__FILE__);
lib->import($dir, File::Spec->catdir($dir, "lib"), File::Spec->catdir($dir, qw(local lib perl5)));
}
use Bugzilla::Constants ();
use lib Bugzilla::Constants::bz_locations()->{ext_libpath};
use Plack;
use Plack::Builder;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::BugMail;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -31,7 +31,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -18,7 +18,7 @@ use warnings;
use File::Basename;
BEGIN { chdir dirname($0); }
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Getopt::Long qw(:config bundling);
use Pod::Usage;
......@@ -41,7 +41,7 @@ Bugzilla::Install::Util::no_checksetup_from_cgi() if $ENV{'SERVER_SOFTWARE'};
init_console();
my %switch;
GetOptions(\%switch, 'help|h|?', 'check-modules', 'cpanfile',
GetOptions(\%switch, 'help|h|?',
'no-templates|t', 'verbose|v|no-silent',
'make-admin=s', 'reset-password=s', 'version|V',
'no-permissions|p');
......@@ -49,12 +49,6 @@ GetOptions(\%switch, 'help|h|?', 'check-modules', 'cpanfile',
# Print the help message if that switch was selected.
pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};
# Export cpanfile and exit
if ($switch{cpanfile}) {
export_cpanfile();
exit;
}
# Read in the "answers" file if it exists, for running in
# non-interactive mode.
my $answers_file = $ARGV[0];
......@@ -64,11 +58,7 @@ print(install_string('header', get_version_and_os()) . "\n") unless $silent;
exit 0 if $switch{'version'};
# Check required --MODULES--
my $module_results = check_requirements(!$silent);
Bugzilla::Install::Requirements::print_module_instructions(
$module_results, !$silent);
exit 1 if !$module_results->{pass};
# Break out if checking the modules is all we have been asked to do.
exit 0 if $switch{'check-modules'};
###########################################################################
# Load Bugzilla Modules
......@@ -245,7 +235,7 @@ checksetup.pl - A do-it-all upgrade and installation script for Bugzilla.
=head1 SYNOPSIS
./checksetup.pl [--help|--check-modules|--version]
./checksetup.pl [--help|--version]
./checksetup.pl [SCRIPT [--verbose]] [--no-templates|-t]
[--make-admin=user@domain.com]
[--reset-password=user@domain.com]
......@@ -266,16 +256,6 @@ the L</"RUNNING CHECKSETUP NON-INTERACTIVELY"> section.
Display this help text
=item B<--cpanfile>
Outputs a cpanfile in the document root listing the current and optional
modules with their respective versions. This file can be used by <cpanm>
and other utilities used to install Perl dependencies.
=item B<--check-modules>
Only check for correct module dependencies and quit afterward.
=item B<--make-admin>=username@domain.com
Makes the specified user into a Bugzilla administrator. This is
......
......@@ -22,7 +22,7 @@ It takes no arguments and produces no output except in the case of errors.
use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Getopt::Long qw(:config bundling);
use Pod::Usage;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::DB;
......
......@@ -10,7 +10,7 @@ use warnings;
use File::Basename;
BEGIN { chdir dirname($0) . "/.."; }
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Config qw(:admin);
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Install::Filesystem qw(fix_all_file_permissions);
......
......@@ -31,7 +31,7 @@ merge-users.pl - Merge two user accounts.
=cut
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......@@ -88,17 +88,18 @@ if (exists $switch{'charset'}) {
}
if ($switch{'guess'}) {
if (!eval { require Encode::Detect::Detector }) {
if (!Bugzilla->has_feature('detect_charset')) {
my $root = ROOT_USER;
print STDERR <<EOT;
Using --guess requires that Encode::Detect be installed. To install
Encode::Detect, run the following command:
$^X install-module.pl Encode::Detect
cpanm --installdeps --with-feature=detect_charset -l local .
EOT
exit;
}
require Encode::Detect;
}
my %overrides;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Util;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Net::LDAP;
use Bugzilla;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Error;
......
......@@ -11,7 +11,6 @@ cd $BUGZILLA_ROOT
# Install Perl dependencies
CPANM="cpanm --quiet --notest --skip-satisfied"
perl checksetup.pl --cpanfile
$CPANM --installdeps --with-recommends --with-all-features \
--without-feature oracle --without-feature sqlite --without-feature pg .
......
......@@ -149,27 +149,18 @@ times, Bugzilla may require a version of a Perl module newer than the one
your distribution packages, in which case you will need to install a
Bugzilla-only copy of the newer version.
At this point you probably need to become ``root``, e.g. by using
:command:`su`. You should remain as root until the end of the install. This
can be avoided in some circumstances if you are a member of your webserver's
group, but being root is easier and will always work.
To make sure you have all the core requirements to run Bugzilla, you should run the following command:
To check whether you have all the required modules, run:
:command:`perl Makefile.PL`
:command:`./checksetup.pl --check-modules`
Should this command warn about missing prerequisites -- or prerequisites that are too old,
you may use cpanm to install these.
You can run this command as many times as necessary.
:command:`curl -L http://cpanmin.us | perl - --installdeps -l local .`
If you have not already installed the necessary modules, and want to do it
system-wide, invoke your package manager appropriately at this point.
Alternatively, you can install all missing modules locally (i.e. just for
Bugzilla) like this:
If you want a more full-featured Bugzilla, use the following command:
:command:`./install-module.pl --all`
Or, you can pass an individual module name:
:command:`./install-module.pl <modulename>`
:command:`curl -L http://cpanmin.us | perl - --installdeps -l local --with-all-features --without-feature mod_perl --without-feature oracle --without-feature mysql --without-feature pg .`
.. _linux-config-webserver:
......
......@@ -71,22 +71,16 @@ will need to agree to this.
Perl Modules
============
Bugzilla requires a number of Perl modules. On Mac OS X, the easiest thing to
do is to install local copies (rather than system-wide copies) of any ones
that you don't already have. However, if you do want to install them
system-wide, run the below commands as root with the :command:`--global`
option.
Bugzilla requires a number of Perl modules. Generally, the best way to install
these is with the cpanm command.
To check whether you have all the required modules and what is still missing,
run:
Generally, the best way to install these is with cpanm:
:command:`perl checksetup.pl --check-modules`
:command:`curl -L http://cpanmin.us | perl - --installdeps -l local .`
You can run this command as many times as necessary.
If you want a more full-featured Bugzilla:
Install all missing modules locally like this:
:command:`perl install-module.pl --all`
:command:`curl -L http://cpanmin.us | perl - --installdeps -l local --with-all-features --without-feature oracle --without-feature mysql --without-feature pg`
.. _macosx-config-webserver:
......
......@@ -30,7 +30,7 @@ use warnings;
use File::Basename;
BEGIN { chdir dirname($0); }
use lib qw(.. ../lib lib);
use lib qw(.. ../lib lib ../local/lib/perl5);
use Cwd;
use File::Copy::Recursive qw(rcopy);
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -11,7 +11,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Util;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -14,7 +14,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -20,7 +20,7 @@ BEGIN {
chdir dirname($a);
}
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Data::Dumper;
use Email::Address;
......
......@@ -20,7 +20,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -13,7 +13,7 @@ use warnings;
use File::Basename;
BEGIN { chdir dirname($0); }
use lib qw(.. ../lib);
use lib qw(.. ../lib ../local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
#!/usr/bin/perl
# 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.
# This file has detailed POD docs, do "perldoc checksetup.pl" to see them.
######################################################################
# Initialization
######################################################################
use 5.10.1;
use strict;
use warnings;
use lib qw(lib local/lib/perl5);
use Getopt::Long qw(:config gnu_getopt);
if (-f "MYMETA.json") {
eval {
require CPAN::Meta;
require Module::CPANfile;
my (@with_feature, @without_feature);
my $with_all_features = 0;
GetOptions(
'with-all-features|A!' => \$with_all_features,
'with-feature|D=s@' => \@with_feature,
'without-feature|U=s@' => \@without_feature
);
my $meta = CPAN::Meta->load_file("MYMETA.json");
my @phases = qw(configure build test develop runtime);
my @types = qw(requires recommends suggests conflicts);
my %features;
if ($with_all_features) {
$features{$_->identifier} = 1 foreach ($meta->features);
}
$features{$_} = 1 foreach @with_feature;
$features{$_} = 0 foreach @without_feature;
my @features = grep { $features{$_} } keys %features;
my $prereqs = $meta->effective_prereqs(\@features)->as_string_hash;
my $filtered = {};
while (my($phase, $types) = each %$prereqs) {
while (my($type, $reqs) = each %$types) {
$filtered->{$phase}{$type} = $reqs;
}
}
my $cpanfile = Module::CPANfile->from_prereqs($filtered);
open my $cpanfile_fh, '>', 'cpanfile' or die "cannot write to cpanfile: $!";
print $cpanfile_fh $cpanfile->to_string();
close $cpanfile_fh;
};
die "Unable generate cpanfile: $@\n" if $@;
}
else {
die "MYMETA.yml is missing, cannot generate cpanfile\n";
}
......@@ -46,7 +46,7 @@ BEGIN {
chdir(File::Basename::dirname($dir));
}
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
# Data dumber is used for debugging, I got tired of copying it back in
# and then removing it.
#use Data::Dumper;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
#!/usr/bin/perl
# 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.
use 5.10.1;
use strict;
use warnings;
# Have to abs_path('.') or calls to Bugzilla modules won't work once
# CPAN has chdir'ed around. We do all of this in this funny order to
# make sure that we use the lib/ modules instead of the base Perl modules,
# in case the lib/ modules are newer.
use Cwd qw(abs_path cwd);
use lib abs_path('.');
use Bugzilla::Constants;
use lib abs_path(bz_locations()->{ext_libpath});
use Bugzilla::Install::CPAN;
use Bugzilla::Constants;
use Bugzilla::Install::Requirements;
use Bugzilla::Install::Util qw(bin_loc init_console);
use Data::Dumper;
use Getopt::Long;
use Pod::Usage;
init_console();
my @original_args = @ARGV;
my $original_dir = cwd();
our %switch;
GetOptions(\%switch, 'all|a', 'upgrade-all|u', 'show-config|s', 'global|g',
'shell', 'help|h');
pod2usage({ -verbose => 1 }) if $switch{'help'};
if (ON_ACTIVESTATE) {
print <<END;
You cannot run this script when using ActiveState Perl. Please follow
the instructions given by checksetup.pl to install missing Perl modules.
END
exit;
}
pod2usage({ -verbose => 0 }) if (!%switch && !@ARGV);
set_cpan_config($switch{'global'});
if ($switch{'show-config'}) {
print Dumper($CPAN::Config);
exit;
}
check_cpan_requirements($original_dir, \@original_args);
if ($switch{'shell'}) {
CPAN::shell();
exit;
}
if ($switch{'all'} || $switch{'upgrade-all'}) {
my @modules;
if ($switch{'upgrade-all'}) {
@modules = (@{REQUIRED_MODULES()}, @{OPTIONAL_MODULES()});
push(@modules, DB_MODULE->{$_}->{dbd}) foreach (keys %{DB_MODULE()});
}
else {
# This is the only time we need a Bugzilla-related module, so
# we require them down here. Otherwise this script can be run from
# any directory, even outside of Bugzilla itself.
my $reqs = check_requirements(0);
@modules = (@{$reqs->{missing}}, @{$reqs->{optional}});
my $dbs = DB_MODULE;
foreach my $db (keys %$dbs) {
push(@modules, $dbs->{$db}->{dbd})
if !have_vers($dbs->{$db}->{dbd}, 0);
}
}
foreach my $module (@modules) {
my $cpan_name = $module->{module};
# --all shouldn't include mod_perl2, because it can have some complex
# configuration, and really should be installed on its own.
next if $cpan_name eq 'mod_perl2';
next if $cpan_name eq 'DBD::Oracle' and !$ENV{ORACLE_HOME};
next if $cpan_name eq 'DBD::Pg' and !bin_loc('pg_config');
install_module($cpan_name);
}
}
foreach my $module (@ARGV) {
install_module($module);
}
__END__
=head1 NAME
install-module.pl - Installs or upgrades modules from CPAN.
This script does not run on Windows.
=head1 SYNOPSIS
./install-module.pl Module::Name [--global]
./install-module.pl --all [--global]
./install-module.pl --upgrade-all [--global]
./install-module.pl --show-config
./install-module.pl --shell
Do "./install-module.pl --help" for more information.
=head1 OPTIONS
=over
=item B<Module::Name>
The name of a module that you want to install from CPAN. This is the
same thing that you'd give to the C<install> command in the CPAN shell.
You can specify multiple module names separated by a space to install
multiple modules.
=item B<--global>
This makes install-module install modules globally for all applications,
instead of just for Bugzilla.
On most systems, you have to be root for C<--global> to work.
=item B<--all>
This will make install-module do its best to install every required
and optional module that is not installed that Bugzilla can use.
Some modules may fail to install. You can run checksetup.pl to see
which installed properly.
=item B<--upgrade-all>
This is like C<--all>, except it forcibly installs the very latest
version of every Bugzilla prerequisite, whether or not you already
have them installed.
=item B<--show-config>
Prints out the CPAN configuration in raw Perl format. Useful for debugging.
=item B<--shell>
Starts a CPAN shell using the configuration of F<install-module.pl>.
=item B<--help>
Shows this help.
=back
......@@ -18,7 +18,7 @@ BEGIN {
chdir dirname($a);
}
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::JobQueue::Runner;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -12,7 +12,7 @@ use warnings;
use File::Basename;
BEGIN { chdir dirname($0); }
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Migrate;
......
......@@ -15,9 +15,14 @@ use warnings;
# This sets up our libpath without having to specify it in the mod_perl
# configuration.
use File::Basename;
use lib dirname(__FILE__);
use File::Spec;
BEGIN {
require lib;
my $dir = dirname(__FILE__);
lib->import($dir, File::Spec->catdir($dir, "lib"), File::Spec->catdir($dir, qw(local lib perl5)));
}
use Bugzilla::Constants ();
use lib Bugzilla::Constants::bz_locations()->{'ext_libpath'};
# If you have an Apache2::Status handler in your Apache configuration,
# you need to load Apache2::Status *here*, so that any later-loaded modules
......
......@@ -17,7 +17,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Error;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Attachment;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Bug;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Mailer;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Util;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
#!/usr/bin/perl
# 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.
use 5.10.1;
use diagnostics;
use strict;
use warnings;
use lib qw(lib);
use Test::Harness qw(&runtests $verbose);
$verbose = 0;
my $onlytest = "";
foreach (@ARGV) {
if (/^(?:-v|--verbose)$/) {
$verbose = 1;
}
else {
$onlytest = sprintf("%0.3d",$_);
}
}
runtests(glob("t/$onlytest*.t"));
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Bug;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Error;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Error;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Constants;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use File::Temp;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
use Bugzilla::Error;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Bugzilla;
......
......@@ -10,7 +10,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib);
use lib qw(. lib local/lib/perl5);
use Date::Parse; # strptime
......
......@@ -14,7 +14,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib t);
use lib qw(. lib local/lib/perl5 t);
use Config;
use Support::Files;
use Test::More tests => scalar(@Support::Files::testitems)
......@@ -86,8 +86,7 @@ foreach my $file (@testitems) {
and $file ne "Bugzilla/DB/Schema.pm")
{
my $module = lc($1);
my $dbd = DB_MODULE->{$module}->{dbd}->{module};
eval("use $dbd; 1") or skip "$file: $dbd not installed", 1;
Bugzilla->feature($module) or skip "$file: Driver for $module not installed", 1;
}
compile_file($file);
......
......@@ -14,7 +14,7 @@ use 5.10.1;
use strict;
use warnings;
use lib 't';
use lib qw(. lib local/lib/perl5 t);
use Support::Files;
......
......@@ -13,7 +13,7 @@ use 5.10.1;
use strict;
use warnings;
use lib 't';
use lib qw(. lib local/lib/perl5 t);
use Support::Templates;
......
......@@ -13,7 +13,7 @@ use 5.10.1;
use strict;
use warnings;
use lib 't';
use lib qw(. lib local/lib/perl5 t);
use Support::Files;
use Support::Templates;
......
......@@ -14,7 +14,7 @@ use 5.10.1;
use strict;
use warnings;
use lib 't';
use lib qw(. lib local/lib/perl5 t);
use Support::Files;
# -1 because 006spellcheck.t must not be checked.
......
......@@ -13,7 +13,7 @@ use 5.10.1;
use strict;
use warnings;
use lib 't';
use lib qw(. lib local/lib/perl5 t);
use Support::Files;
use Test::More tests => 17;
use DateTime;
......
......@@ -19,7 +19,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib t);
use lib qw(. lib local/lib/perl5 t);
use Bugzilla::Constants;
use Support::Templates;
......
......@@ -19,7 +19,7 @@ use 5.10.1;
use strict;
use warnings;
use lib 't';
use lib qw(. lib local/lib/perl5 t);
use Support::Files;
use Support::Templates;
......
......@@ -14,7 +14,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib t);
use lib qw(. lib local/lib/perl5 t);
use Support::Files;
use Test::More qw(no_plan);
......
......@@ -14,7 +14,7 @@ use 5.10.1;
use strict;
use warnings;
use lib 't';
use lib qw(. lib local/lib/perl5 t);
use Support::Files;
use Pod::Checker;
......
......@@ -15,7 +15,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. lib t);
use lib qw(. lib local/lib/perl5 t);
use Bugzilla::Constants;
use Bugzilla::WebService::Constants;
......
......@@ -16,7 +16,7 @@ use 5.10.1;
use strict;
use warnings;
use lib qw(. t lib);
use lib qw(. lib local/lib/perl5 t);
use Bugzilla;
use Bugzilla::DB::Schema;
......
......@@ -18,7 +18,7 @@ our @additional_files = ();
our @files = glob('*');
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, qw(Bugzilla docs));
push(@files, 'extensions/create.pl', 'docs/makedocs.pl');
push(@files, 'extensions/create.pl', 'docs/makedocs.pl', 'cpanfile');
our @extensions =
grep { $_ ne 'extensions/create.pl' && ! -e "$_/disabled" }
......
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