]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1246528 - Use Makefile.PL and allow Bugzilla use cpanm-compatible local dependencies
authorDylan Hardison <dylan@mozilla.com>
Tue, 23 Feb 2016 21:23:20 +0000 (16:23 -0500)
committerDylan Hardison <dylan@mozilla.com>
Tue, 23 Feb 2016 21:23:20 +0000 (16:23 -0500)
r=dkl,a=dylan

110 files changed:
.gitignore
Bugzilla.pm
Bugzilla/API/1_0/Server.pm
Bugzilla/Constants.pm
Bugzilla/DB.pm
Bugzilla/Install/CPAN.pm [deleted file]
Bugzilla/Install/Filesystem.pm
Bugzilla/Install/Requirements.pm
Bugzilla/Markdown.pm
META.json [new file with mode: 0644]
META.yml [new file with mode: 0644]
Makefile.PL [new file with mode: 0644]
admin.cgi
app.psgi
attachment.cgi
auth.cgi
buglist.cgi
chart.cgi
checksetup.pl
clean-bug-user-last-visit.pl
colchange.cgi
collectstats.pl
config.cgi
contrib/bzdbcopy.pl
contrib/console.pl
contrib/convert-workflow.pl
contrib/extension-convert.pl
contrib/fixperms.pl
contrib/merge-users.pl
contrib/recode.pl
contrib/sendbugmail.pl
contrib/sendunsentbugmail.pl
contrib/syncLDAP.pl
createaccount.cgi
describecomponents.cgi
describekeywords.cgi
docker_files/install_deps.sh
docs/en/rst/installing/linux.rst
docs/en/rst/installing/mac-os-x.rst
docs/makedocs.pl
duplicates.cgi
editclassifications.cgi
editcomponents.cgi
editfields.cgi
editflagtypes.cgi
editgroups.cgi
editkeywords.cgi
editmilestones.cgi
editparams.cgi
editproducts.cgi
editsettings.cgi
editusers.cgi
editvalues.cgi
editversions.cgi
editwhines.cgi
editworkflow.cgi
email_in.pl
enter_bug.cgi
extensions/create.pl
gen-cpanfile.pl [new file with mode: 0644]
importxml.pl
index.cgi
install-module.pl [deleted file]
jobqueue.pl
jsonrpc.cgi
migrate.pl
mod_perl.pl
page.cgi
post_bug.cgi
process_bug.cgi
query.cgi
quips.cgi
relogin.cgi
report.cgi
reports.cgi
request.cgi
rest.cgi
runtests.pl [deleted file]
sanitycheck.cgi
sanitycheck.pl
search_plugin.cgi
show_activity.cgi
show_bug.cgi
showdependencygraph.cgi
showdependencytree.cgi
shutdown.cgi
summarize_time.cgi
t/001compile.t
t/002goodperl.t
t/004template.t
t/005whitespace.t
t/006spellcheck.t
t/007util.t
t/008filter.t
t/009bugwords.t
t/010dependencies.t
t/011pod.t
t/012throwables.t
t/013dbschema.t
t/Support/Files.pm
template/en/default/setup/strings.txt.pl
testserver.pl
token.cgi
userprefs.cgi
view_job_queue.cgi
votes.cgi
whine.pl
whineatnews.pl
xmlrpc.cgi
xt/search.t

index 778474510928cec37628f6e7b94d417eb860771a..08632b852bc92b3e6720e8be392fa73968ba419f 100644 (file)
@@ -1,5 +1,6 @@
 /**/.htaccess
 /lib/*
+/local/*
 /template/en/custom
 /docs/en/rst/extensions/*
 /docs/en/rst/api/extensions/*
 /localconfig
 /cpanfile
 /index.html
+/Makefile
+/MYMETA.*
+/pm_to_blib
+/blib
 
 /skins/contrib/Dusk/admin.css
 /skins/contrib/Dusk/bug.css
index 221a64f764e4c2af3161fcb1952fe61d8a056f70..2761c9fc72d92bb7fc7e15311cf540acae5ff8c4 100644 (file)
@@ -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;
+    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;
+}
+
+sub has_feature {
+    my ($class, $feature_name) = @_;
+
+    return 0 unless _CAN_HAS_FEATURE;
+
     my $cache = $class->request_cache;
-    return $cache->{feature}->{$feature}
-        if exists $cache->{feature}->{$feature};
-
-    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);
+    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>
 
index 627da1e585865d1285aa70dc75aa1a15a427ac64..af66a4f6645353467aa2ea3e3e8655fdd477cc2e 100644 (file)
@@ -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;
index b269a80bf0551842acc86b2363e4ca60577f87ff..6a469b37605d848a19be168b23f40e1a2c148953 100644 (file)
@@ -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'},
-     # 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'},
+    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',    name => 'SQLite'},
 };
 
 # True if we're on Win32.
index 999b6ae103677f13278cba1babb503ee05a2059c..96a68af03b47e20ab609e4eadee3671eff8ff37f 100644 (file)
@@ -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) = @_;
 
diff --git a/Bugzilla/Install/CPAN.pm b/Bugzilla/Install/CPAN.pm
deleted file mode 100644 (file)
index 094784e..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-# 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::Install::CPAN;
-
-use 5.10.1;
-use strict;
-use warnings;
-
-use parent qw(Exporter);
-our @EXPORT = qw(
-    BZ_LIB
-
-    check_cpan_requirements 
-    set_cpan_config
-    install_module 
-);
-
-use Bugzilla::Constants;
-use Bugzilla::Install::Requirements qw(have_vers);
-use Bugzilla::Install::Util qw(bin_loc install_string);
-
-use Config;
-use CPAN;
-use Cwd qw(abs_path);
-use File::Path qw(rmtree);
-
-# These are required for install-module.pl to be able to install
-# all modules properly.
-use constant REQUIREMENTS => (
-    {
-        module  => 'CPAN',
-        package => 'CPAN',
-        version => '1.81',
-    },
-    {
-        # When Module::Build isn't installed, the YAML module allows
-        # CPAN to read META.yml to determine that Module::Build first
-        # needs to be installed to compile a module.
-        module  => 'YAML',
-        package => 'YAML',
-        version => 0,
-    },
-    {
-        # Many modules on CPAN are now built with Dist::Zilla, which
-        # unfortunately means they require this version of EU::MM to install.
-        module  => 'ExtUtils::MakeMaker',
-        package => 'ExtUtils-MakeMaker',
-        version => '6.31',
-    },
-);
-
-# We need the absolute path of ext_libpath, because CPAN chdirs around
-# and so we can't use a relative directory.
-#
-# We need it often enough (and at compile time, in install-module.pl) so 
-# we make it a constant.
-use constant BZ_LIB => abs_path(bz_locations()->{ext_libpath});
-
-# CPAN requires nearly all of its parameters to be set, or it will start
-# asking questions to the user. We want to avoid that, so we have
-# defaults here for most of the required parameters we know about, in case
-# any of them aren't set. The rest are handled by set_cpan_defaults().
-use constant CPAN_DEFAULTS => {
-    auto_commit => 0,
-    # We always force builds, so there's no reason to cache them.
-    build_cache => 0,
-    build_requires_install_policy => 'yes',
-    cache_metadata => 1,
-    colorize_output => 1,
-    colorize_print => 'bold',
-    index_expire => 1,
-    scan_cache => 'atstart',
-
-    inhibit_startup_message => 1,
-
-    bzip2 => bin_loc('bzip2'),
-    curl => bin_loc('curl'),
-    gzip => bin_loc('gzip'),
-    links => bin_loc('links'),
-    lynx => bin_loc('lynx'),
-    make => bin_loc('make'),
-    pager => bin_loc('less'),
-    tar => bin_loc('tar'),
-    unzip => bin_loc('unzip'),
-    wget => bin_loc('wget'),
-
-    urllist => ['http://www.cpan.org/'],
-};
-
-sub check_cpan_requirements {
-    my ($original_dir, $original_args) = @_;
-
-    _require_compiler();
-
-    my @install;
-    foreach my $module (REQUIREMENTS) {
-        my $installed = have_vers($module, 1);
-        push(@install, $module) if !$installed;
-    }
-
-    return if !@install;
-
-    my $restart_required;
-    foreach my $module (@install) {
-        $restart_required = 1 if $module->{module} eq 'CPAN';
-        install_module($module->{module}, 1);
-    }
-
-    if ($restart_required) {
-        chdir $original_dir;
-        exec($^X, $0, @$original_args);
-    }
-}
-
-sub _require_compiler {
-    my @errors;
-
-    my $cc_name = $Config{cc};
-    my $cc_exists = bin_loc($cc_name);
-
-    if (!$cc_exists) {
-        push(@errors, install_string('install_no_compiler'));
-    }
-
-    my $make_name = $CPAN::Config->{make};
-    my $make_exists = bin_loc($make_name);
-
-    if (!$make_exists) {
-        push(@errors, install_string('install_no_make'));
-    }
-
-    die @errors if @errors;
-}
-
-sub install_module {
-    my ($name, $test) = @_;
-    my $bzlib = BZ_LIB;
-
-    # Make Module::AutoInstall install all dependencies and never prompt.
-    local $ENV{PERL_AUTOINSTALL} = '--alldeps';
-    # This makes Net::SSLeay not prompt the user, if it gets installed.
-    # It also makes any other MakeMaker prompts accept their defaults.
-    local $ENV{PERL_MM_USE_DEFAULT} = 1;
-
-    # Certain modules require special stuff in order to not prompt us.
-    my $original_makepl = $CPAN::Config->{makepl_arg};
-    # This one's a regex in case we're doing Template::Plugin::GD and it
-    # pulls in Template-Toolkit as a dependency.
-    if ($name =~ /^Template/) {
-        $CPAN::Config->{makepl_arg} .= " TT_ACCEPT=y TT_EXTRAS=n";
-    }
-    elsif ($name eq 'XML::Twig') {
-        $CPAN::Config->{makepl_arg} = "-n $original_makepl";
-    }
-    elsif ($name eq 'SOAP::Lite') {
-        $CPAN::Config->{makepl_arg} .= " --noprompt";
-    }
-
-    my $module = CPAN::Shell->expand('Module', $name);
-    if (!$module) {
-        die install_string('no_such_module', { module => $name }) . "\n";
-    }
-
-    print install_string('install_module', 
-              { module => $name, version => $module->cpan_version }) . "\n";
-
-    if ($test) {
-        CPAN::Shell->force('install', $name);
-    }
-    else {
-        CPAN::Shell->notest('install', $name);
-    }
-
-    # If it installed any binaries in the Bugzilla directory, delete them.
-    if (-d "$bzlib/bin") {
-        File::Path::rmtree("$bzlib/bin");
-    }
-
-    $CPAN::Config->{makepl_arg} = $original_makepl;
-}
-
-sub set_cpan_config {
-    my $do_global = shift;
-    my $bzlib = BZ_LIB;
-
-    # We set defaults before we do anything, otherwise CPAN will
-    # start asking us questions as soon as we load its configuration.
-    eval { require CPAN::Config; };
-    _set_cpan_defaults();
-
-    # Calling a senseless autoload that does nothing makes us
-    # automatically load any existing configuration.
-    # We want to avoid the "invalid command" message.
-    open(my $saveout, ">&", "STDOUT");
-    open(STDOUT, '>', '/dev/null');
-    eval { CPAN->ignore_this_error_message_from_bugzilla; };
-    undef $@;
-    close(STDOUT);
-    open(STDOUT, '>&', $saveout);
-
-    my $dir = $CPAN::Config->{cpan_home};
-    if (!defined $dir || !-w $dir) {
-        # If we can't use the standard CPAN build dir, we try to make one.
-        $dir = "$ENV{HOME}/.cpan";
-        mkdir $dir;
-
-        # If we can't make one, we finally try to use the Bugzilla directory.
-        if (!-w $dir) {
-            print STDERR install_string('cpan_bugzilla_home'), "\n";
-            $dir = "$bzlib/.cpan";
-        }
-    }
-    $CPAN::Config->{cpan_home} = $dir;
-    $CPAN::Config->{build_dir} = "$dir/build";
-    # We always force builds, so there's no reason to cache them.
-    $CPAN::Config->{keep_source_where} = "$dir/source";
-    # This is set both here and in defaults so that it's always true.
-    $CPAN::Config->{inhibit_startup_message} = 1;
-    # Automatically install dependencies.
-    $CPAN::Config->{prerequisites_policy} = 'follow';
-    
-    # Unless specified, we install the modules into the Bugzilla directory.
-    if (!$do_global) {
-        require Config;
-
-        $CPAN::Config->{makepl_arg} .= " LIB=\"$bzlib\""
-            . " INSTALLMAN1DIR=\"$bzlib/man/man1\""
-            . " INSTALLMAN3DIR=\"$bzlib/man/man3\""
-            # The bindirs are here because otherwise we'll try to write to
-            # the system binary dirs, and that will cause CPAN to die.
-            . " INSTALLBIN=\"$bzlib/bin\""
-            . " INSTALLSCRIPT=\"$bzlib/bin\""
-            # INSTALLDIRS=perl is set because that makes sure that MakeMaker
-            # always uses the directories we've specified here.
-            . " INSTALLDIRS=perl";
-        $CPAN::Config->{mbuild_arg} = " --install_base \"$bzlib\""
-            . " --install_path lib=\"$bzlib\""
-            . " --install_path arch=\"$bzlib/$Config::Config{archname}\"";
-        $CPAN::Config->{mbuild_install_arg} = $CPAN::Config->{mbuild_arg};
-
-        # When we're not root, sometimes newer versions of CPAN will
-        # try to read/modify things that belong to root, unless we set
-        # certain config variables.
-        $CPAN::Config->{histfile} = "$dir/histfile";
-        $CPAN::Config->{use_sqlite} = 0;
-        $CPAN::Config->{prefs_dir} = "$dir/prefs";
-
-        # Unless we actually set PERL5LIB, some modules can't install
-        # themselves, like DBD::mysql, DBD::Pg, and XML::Twig.
-        my $current_lib = $ENV{PERL5LIB} ? $ENV{PERL5LIB} . ':' : '';
-        $ENV{PERL5LIB} = $current_lib . $bzlib;
-    }
-}
-
-sub _set_cpan_defaults {
-    # If CPAN hasn't been configured, we try to use some reasonable defaults.
-    foreach my $key (keys %{CPAN_DEFAULTS()}) {
-        $CPAN::Config->{$key} = CPAN_DEFAULTS->{$key}
-            if !defined $CPAN::Config->{$key};
-    }
-
-    my @missing;
-    # In newer CPANs, this is in HandleConfig. In older CPANs, it's in
-    # Config.
-    if (eval { require CPAN::HandleConfig }) {
-        @missing = CPAN::HandleConfig->missing_config_data;
-    }
-    else {
-        @missing = CPAN::Config->missing_config_data;
-    }
-
-    foreach my $key (@missing) {
-        $CPAN::Config->{$key} = '';
-    }
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Bugzilla::Install::CPAN - Routines to install Perl modules from CPAN.
-
-=head1 SYNOPSIS
-
- use Bugzilla::Install::CPAN;
-
- set_cpan_config();
- install_module('Module::Name');
-
-=head1 DESCRIPTION
-
-This is primarily used by L<install-module> to do the "hard work" of
-installing CPAN modules.
-
-=head1 SUBROUTINES
-
-=over
-
-=item C<set_cpan_config>
-
-Sets up the configuration of CPAN for this session. Must be called
-before L</install_module>. Takes one boolean parameter. If true,
-L</install_module> will install modules globally instead of to the
-local F<lib/> directory. On most systems, you have to be root to do that.
-
-=item C<install_module>
-
-Installs a module from CPAN. Takes two arguments:
-
-=over
-
-=item C<$name> - The name of the module, just like you'd pass to the
-C<install> command in the CPAN shell.
-
-=item C<$test> - If true, we run tests on this module before installing,
-but we still force the install if the tests fail. This is only used
-when we internally install a newer CPAN module.
-
-=back
-
-Note that calling this function prints a B<lot> of information to
-STDOUT and STDERR.
-
-=back
-
-=head1 B<Methods in need of POD>
-
-=over
-
-=item check_cpan_requirements
-
-=back
index e17285b2fa0468e7efbc4e79e369101503215089..af7de928dd8d418a2d768340563f490e5720110e 100644 (file)
@@ -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 },
index ccd3a649a9858cf042d77548efa3449ab5325425..924686f0a7411b9c16acd5819da20b1b2cf88480 100644 (file)
@@ -27,16 +27,11 @@ use parent qw(Exporter);
 use autodie;
 
 our @EXPORT = qw(
-    REQUIRED_MODULES
-    OPTIONAL_MODULES
     FEATURE_FILES
 
     check_requirements
     check_webdotbase
     check_font_file
-    export_cpanfile
-    have_vers
-    install_command
     map_files_to_features
 );
 
@@ -74,425 +69,13 @@ use constant APACHE_PATH => [qw(
     /usr/local/libexec
 )];
 
-# The below two constants are subroutines so that they can implement
-# a hook. Other than that they are actually constants.
-
-# "package" is the perl package we're checking for. "module" is the name
-# of the actual module we load with "require" to see if the package is
-# installed or not. "version" is the version we need, or 0 if we'll accept
-# any version.
-#
-# "blacklist" is an arrayref of regular expressions that describe versions that
-# are 'blacklisted'--that is, even if the version is high enough, Bugzilla
-# will refuse to say that it's OK to run with that version.
-sub REQUIRED_MODULES {
-    my @modules = (
-    {
-        package => 'CGI.pm',
-        module  => 'CGI',
-        # 3.51 fixes a security problem that affects Bugzilla.
-        # (bug 591165)
-        version => '3.51',
-    },
-    {
-        package => 'Digest-SHA',
-        module  => 'Digest::SHA',
-        version => 0
-    },
-    # 0.23 fixes incorrect handling of 1/2 & 3/4 timezones.
-    {
-        package => 'TimeDate',
-        module  => 'Date::Format',
-        version => '2.23'
-    },
-    # 0.75 fixes a warning thrown with Perl 5.17 and newer.
-    {
-        package => 'DateTime',
-        module  => 'DateTime',
-        version => '0.75'
-    },
-    # 1.64 fixes a taint issue preventing the local timezone from
-    # being determined on some systems.
-    {
-        package => 'DateTime-TimeZone',
-        module  => 'DateTime::TimeZone',
-        version => '1.64'
-    },
-    # 1.54 is required for Perl 5.10+. It also makes DBD::Oracle happy.
-    {
-        package => 'DBI',
-        module  => 'DBI',
-        version => ($^V >= v5.13.3) ? '1.614' : '1.54'
-    },
-    # 2.24 contains several useful text virtual methods.
-    {
-        package => 'Template-Toolkit',
-        module  => 'Template',
-        version => '2.24'
-    },
-    # 1.300011 has a debug mode for SMTP and automatically pass -i to sendmail.
-    {
-        package => 'Email-Sender',
-        module  => 'Email::Sender',
-        version => '1.300011',
-    },
-    {
-        package => 'Email-MIME',
-        module  => 'Email::MIME',
-        # This fixes a memory leak in walk_parts that affected jobqueue.pl.
-        version => '1.904'
-    },
-    {
-        package => 'URI',
-        module  => 'URI',
-        # Follows RFC 3986 to escape characters in URI::Escape.
-        version => '1.55',
-    },
-    # 0.32 fixes several memory leaks in the XS version of some functions.
-    {
-        package => 'List-MoreUtils',
-        module  => 'List::MoreUtils',
-        version => 0.32,
-    },
-    {
-        package => 'Math-Random-ISAAC',
-        module  => 'Math::Random::ISAAC',
-        version => '1.0.1',
-    },
-    {
-        package => 'File-Slurp',
-        module  => 'File::Slurp',
-        version => '9999.13',
-    },
-    {
-        package => 'JSON-XS',
-        module  => 'JSON::XS',
-        # 2.0 is the first version that will work with JSON::RPC.
-        version => '2.01',
-    },
-    );
-
-    if (ON_WINDOWS) {
-        push(@modules,
-        {
-            package => 'Win32',
-            module  => 'Win32',
-            # 0.35 fixes a memory leak in GetOSVersion, which we use.
-            version => 0.35,
-        }, 
-        {
-            package => 'Win32-API',
-            module  => 'Win32::API',
-            # 0.55 fixes a bug with char* that might affect Bugzilla::RNG.
-            version => '0.55',
-        },
-        {
-            package => 'DateTime-TimeZone-Local-Win32',
-            module  => 'DateTime::TimeZone::Local::Win32',
-            # We require DateTime::TimeZone 1.64, so this version must match.
-            version => '1.64',
-        }
-        );
-    }
-
-    my $extra_modules = _get_extension_requirements('REQUIRED_MODULES');
-    push(@modules, @$extra_modules);
-    return \@modules;
-};
-
-sub OPTIONAL_MODULES {
-    my @modules = (
-    {
-        package => 'GD',
-        module  => 'GD',
-        version => '1.20',
-        feature => [qw(graphical_reports new_charts old_charts)],
-    },
-    {
-        package => 'Chart',
-        module  => 'Chart::Lines',
-        # Versions below 2.4.10 throw deprecation warnings, and will crash in
-        # Perl 2.21 and above.
-        version => '2.4.10',
-        feature => [qw(new_charts old_charts)],
-    },
-    {
-        package => 'Template-GD',
-        # This module tells us whether or not Template-GD is installed
-        # on Template-Toolkits after 2.14, and still works with 2.14 and lower.
-        module  => 'Template::Plugin::GD::Image',
-        version => 0,
-        feature => ['graphical_reports'],
-    },
-    {
-        package => 'GDTextUtil',
-        module  => 'GD::Text',
-        version => 0,
-        feature => ['graphical_reports'],
-    },
-    {
-        package => 'GDGraph',
-        module  => 'GD::Graph',
-        version => 0,
-        feature => ['graphical_reports'],
-    },
-    {
-        package => 'MIME-tools',
-        # MIME::Parser is packaged as MIME::Tools on ActiveState Perl
-        module  => ON_WINDOWS ? 'MIME::Tools' : 'MIME::Parser',
-        version => '5.406',
-        feature => ['moving'],
-    },
-    {
-        package => 'libwww-perl',
-        module  => 'LWP::UserAgent',
-        version => 0,
-        feature => ['updates'],
-    },
-    {
-        package => 'XML-Twig',
-        module  => 'XML::Twig',
-        version => 0,
-        feature => ['moving', 'updates'],
-    },
-    {
-        package => 'PatchReader',
-        module  => 'PatchReader',
-        # 0.9.6 fixes two notable bugs and significantly improves the UX.
-        version => '0.9.6',
-        feature => ['patch_viewer'],
-    },
-    {
-        package => 'perl-ldap',
-        module  => 'Net::LDAP',
-        version => 0,
-        feature => ['auth_ldap'],
-    },
-    {
-        package => 'Authen-SASL',
-        module  => 'Authen::SASL',
-        version => 0,
-        feature => ['smtp_auth'],
-    },
-    {
-        package => 'Net-SMTP-SSL',
-        module  => 'Net::SMTP::SSL',
-        version => 1.01,
-        feature => ['smtp_ssl'],
-    },
-    {
-        package => 'RadiusPerl',
-        module  => 'Authen::Radius',
-        version => 0,
-        feature => ['auth_radius'],
-    },
-    # XXX - Once we require XMLRPC::Lite 0.717 or higher, we can
-    # remove SOAP::Lite from the list.
-    {
-        package => 'SOAP-Lite',
-        module  => 'SOAP::Lite',
-        # Fixes various bugs, including 542931 and 552353 + stops
-        # throwing warnings with Perl 5.12.
-        version => '0.712',
-        # SOAP::Transport::HTTP 1.12 is bogus.
-        blacklist => ['^1\.12$'],
-        feature => ['xmlrpc'],
-    },
-    # Since SOAP::Lite 1.0, XMLRPC::Lite is no longer included
-    # and so it must be checked separately.
-    {
-        package => 'XMLRPC-Lite',
-        module  => 'XMLRPC::Lite',
-        version => '0.712',
-        feature => ['xmlrpc'],
-    },
-    {
-        package => 'JSON-RPC',
-        module  => 'JSON::RPC',
-        version => 0,
-        feature => ['jsonrpc'],
-    },
-    {
-        package => 'Plack',
-        module  => 'Plack',
-        # 1.0031 contains a security fix which would affect us.
-        # It also fixes warnings thrown in Perl 5.20 and newer.
-        version => 1.0031,
-        feature => ['psgi'],
-    },
-    {
-        package => 'CGI-Compile',
-        module  => 'CGI::Compile',
-        version => 0,
-        feature => ['psgi'],
-    },
-    {
-        package => 'CGI-Emulate-PSGI',
-        module  => 'CGI::Emulate::PSGI',
-        version => 0,
-        feature => ['psgi'],
-    },
-    {
-        package => 'Test-Taint',
-        module  => 'Test::Taint',
-        # 1.06 no longer throws warnings with Perl 5.10+.
-        version => 1.06,
-        feature => ['jsonrpc', 'xmlrpc', 'rest'],
-    },
-    {
-        package => 'Moo',
-        module  => 'Moo',
-        version => 2,
-        feature => ['rest']
-    },
-    {
-        package => 'Module-Runtime',
-        module  => 'Module::Runtime',
-        version => 0,
-        feature => ['rest']
-    },
-    {
-        package => 'HTTP-Request',
-        module  => 'HTTP::Request',
-        version => 0,
-        feature => ['rest']
-    },
-    {
-        package => 'HTTP-Response',
-        module  => 'HTTP::Response',
-        version => 0,
-        feature => ['rest']
-    },
-    {
-        # We need the 'utf8_mode' method of HTML::Parser, for HTML::Scrubber.
-        package => 'HTML-Parser',
-        module  => 'HTML::Parser',
-        version => ($^V >= v5.13.3) ? '3.67' : '3.40',
-        feature => ['html_desc'],
-    },
-    {
-        package => 'HTML-Scrubber',
-        module  => 'HTML::Scrubber',
-        version => 0,
-        feature => ['html_desc'],
-    },
-    {
-        # we need version 2.21 of Encode for mime_name
-        package => 'Encode',
-        module  => 'Encode',
-        version => 2.21,
-        feature => ['detect_charset'],
-    },
-    {
-        package => 'Encode-Detect',
-        module  => 'Encode::Detect',
-        version => 0,
-        feature => ['detect_charset'],
-    },
-
-    # Inbound Email
-    {
-        package => 'Email-Reply',
-        module  => 'Email::Reply',
-        version => 0,
-        feature => ['inbound_email'],
-    },
-    {
-        package => 'HTML-FormatText-WithLinks',
-        module  => 'HTML::FormatText::WithLinks',
-        # We need 0.13 to set the "bold" marker to "*".
-        version => '0.13',
-        feature => ['inbound_email'],
-    },
-
-    # Mail Queueing
-    {
-        package => 'TheSchwartz',
-        module  => 'TheSchwartz',
-        # 1.10 supports declining of jobs.
-        version => 1.10,
-        feature => ['jobqueue'],
-    },
-    {
-        package => 'Daemon-Generic',
-        module  => 'Daemon::Generic',
-        version => 0,
-        feature => ['jobqueue'],
-    },
-
-    # mod_perl
-    {
-        package => 'mod_perl',
-        module  => 'mod_perl2',
-        version => '1.999022',
-        feature => ['mod_perl'],
-    },
-    {
-        package => 'Apache-SizeLimit',
-        module  => 'Apache2::SizeLimit',
-        # 0.96 properly determines process size on Linux.
-        version => '0.96',
-        feature => ['mod_perl'],
-    },
-
-    # typesniffer
-    {
-        package => 'File-MimeInfo',
-        module  => 'File::MimeInfo::Magic',
-        version => '0',
-        feature => ['typesniffer'],
-    },
-    {
-        package => 'IO-stringy',
-        module  => 'IO::Scalar',
-        version => '0',
-        feature => ['typesniffer'],
-    },
-
-    # memcached
-    {
-        package => 'Cache-Memcached-Fast',
-        module  => 'Cache::Memcached::Fast',
-        version => '0.17',
-        feature => ['memcached'],
-    },
-
-    # Markdown
-    {
-        package => 'Text-MultiMarkdown',
-        module  => 'Text::MultiMarkdown',
-        # 1.0.34 supports definition lists.
-        version => '1.000034',
-        feature => ['markdown'],
-    },
-
-    # Documentation
-    {
-        package => 'File-Copy-Recursive',
-        module  => 'File::Copy::Recursive',
-        version => 0,
-        feature => ['documentation'],
-    },
-    {
-        package => 'File-Which',
-        module  => 'File::Which',
-        version => 0,
-        feature => ['documentation'],
-    },
-    );
-
-    my $extra_modules = _get_extension_requirements('OPTIONAL_MODULES');
-    push(@modules, @$extra_modules);
-    return \@modules;
-};
-
 # This maps features to the files that require that feature in order
 # to compile. It is used by t/001compile.t and mod_perl.pl.
 use constant FEATURE_FILES => (
     jsonrpc       => ['Bugzilla/WebService/Server/JSONRPC.pm', 'jsonrpc.cgi'],
     xmlrpc        => ['Bugzilla/WebService/Server/XMLRPC.pm', 'xmlrpc.cgi',
                       'Bugzilla/WebService.pm', 'Bugzilla/WebService/*.pm'],
-    rest          => ['Bugzilla/API/Server.pm', 'rest.cgi',
+    rest          => ['Bugzilla/API/Server.pm', 'rest.cgi', 'Bugzilla/API/*/*.pm',
                       'Bugzilla/API/*/Server.pm', 'Bugzilla/API/*/Resource/*.pm'],
     psgi          => ['app.psgi'],
     moving        => ['importxml.pl'],
@@ -506,71 +89,19 @@ use constant FEATURE_FILES => (
     updates       => ['Bugzilla/Update.pm'],
     markdown      => ['Bugzilla/Markdown.pm'],
     memcached     => ['Bugzilla/Memcache.pm'],
+    auth_delegation => ['auth.cgi'],
 );
 
-# This implements the REQUIRED_MODULES and OPTIONAL_MODULES stuff
-# described in in Bugzilla::Extension.
-sub _get_extension_requirements {
-    my ($function) = @_;
-
-    my $packages = extension_requirement_packages();
-    my @modules;
-    foreach my $package (@$packages) {
-        if ($package->can($function)) {
-            my $extra_modules = $package->$function;
-            push(@modules, @$extra_modules);
-        }
-    }
-    return \@modules;
-};
-
 sub check_requirements {
     my ($output) = @_;
 
-    print "\n", install_string('checking_modules'), "\n" if $output;
-    my $root = ROOT_USER;
-    my $missing = _check_missing(REQUIRED_MODULES, $output);
-
-    print "\n", install_string('checking_dbd'), "\n" if $output;
-    my $have_one_dbd = 0;
-    my $db_modules = DB_MODULE;
-    foreach my $db (keys %$db_modules) {
-        my $dbd = $db_modules->{$db}->{dbd};
-        $have_one_dbd = 1 if have_vers($dbd, $output);
-    }
-
-    print "\n", install_string('checking_optional'), "\n" if $output;
-    my $missing_optional = _check_missing(OPTIONAL_MODULES, $output);
-
     my $missing_apache = _missing_apache_modules(APACHE_MODULES, $output);
 
     # If we're running on Windows, reset the input line terminator so that
     # console input works properly - loading CGI tends to mess it up
     $/ = "\015\012" if ON_WINDOWS;
 
-    my $pass = !scalar(@$missing) && $have_one_dbd;
-    return {
-        pass     => $pass,
-        one_dbd  => $have_one_dbd,
-        missing  => $missing,
-        optional => $missing_optional,
-        apache   => $missing_apache,
-        any_missing => !$pass || scalar(@$missing_optional),
-    };
-}
-
-# A helper for check_requirements
-sub _check_missing {
-    my ($modules, $output) = @_;
-
-    my @missing;
-    foreach my $module (@$modules) {
-        unless (have_vers($module, $output)) {
-            push(@missing, $module);
-        }
-    }
-
-    return \@missing;
+    return { apache  => $missing_apache };
 }
 
 sub _missing_apache_modules {
@@ -621,109 +152,6 @@ sub _check_apache_module {
     return $ok;
 }
 
-sub print_module_instructions {
-    my ($check_results, $output) = @_;
-
-    # First we print the long explanatory messages.
-
-    if (scalar @{$check_results->{missing}}) {
-        print install_string('modules_message_required');
-    }
-
-    if (!$check_results->{one_dbd}) {
-        print install_string('modules_message_db');
-    }
-
-    if (my @missing = @{$check_results->{optional}} and $output) {
-        print install_string('modules_message_optional');
-        # Now we have to determine how large the table cols will be.
-        my $longest_name = max(map(length($_->{package}), @missing));
-
-        # The first column header is at least 11 characters long.
-        $longest_name = 11 if $longest_name < 11;
-
-        # The table is TABLE_WIDTH characters long. There are seven mandatory
-        # characters (* and space) in the string. So, we have a total
-        # of TABLE_WIDTH - 7 characters to work with.
-        my $remaining_space = (TABLE_WIDTH - 7) - $longest_name;
-        print '*' x TABLE_WIDTH . "\n";
-        printf "* \%${longest_name}s * %-${remaining_space}s *\n",
-               'MODULE NAME', 'ENABLES FEATURE(S)';
-        print '*' x TABLE_WIDTH . "\n";
-        foreach my $package (@missing) {
-            printf "* \%${longest_name}s * %-${remaining_space}s *\n",
-                   $package->{package}, 
-                   _translate_feature($package->{feature});
-        }
-    }
-
-    if (my @missing = @{ $check_results->{apache} }) {
-        print install_string('modules_message_apache');
-        my $missing_string = join(', ', @missing);
-        my $size = TABLE_WIDTH - 7;
-        printf "*    \%-${size}s *\n", $missing_string;
-        my $spaces = TABLE_WIDTH - 2;
-        print "*", (' ' x $spaces), "*\n";
-    }
-
-    my $need_module_instructions =  
-        ( (!$output and @{$check_results->{missing}})
-          or ($output and $check_results->{any_missing}) ) ? 1 : 0;
-
-    if ($need_module_instructions or @{ $check_results->{apache} }) {
-        # If any output was required, we want to close the "table"
-        print "*" x TABLE_WIDTH . "\n";
-    }
-
-    # And now we print the actual installation commands.
-
-    if (my @missing = @{$check_results->{optional}} and $output) {
-        print install_string('commands_optional') . "\n\n";
-        foreach my $module (@missing) {
-            my $command = install_command($module);
-            printf "%15s: $command\n", $module->{package};
-        }
-        print "\n";
-    }
-
-    if (!$check_results->{one_dbd}) {
-        print install_string('commands_dbd') . "\n";
-        my %db_modules = %{DB_MODULE()};
-        foreach my $db (keys %db_modules) {
-            my $command = install_command($db_modules{$db}->{dbd});
-            printf "%10s: \%s\n", $db_modules{$db}->{name}, $command;
-        }
-        print "\n";
-    }
-
-    if (my @missing = @{$check_results->{missing}}) {
-        print colored(install_string('commands_required'), COLOR_ERROR), "\n";
-        foreach my $package (@missing) {
-            my $command = install_command($package);
-            print "    $command\n";
-        }
-    }
-
-    if ($output && $check_results->{any_missing} && !ON_ACTIVESTATE
-        && !$check_results->{hide_all}) 
-    {
-        print install_string('install_all', { perl => $^X });
-    }
-    if (!$check_results->{pass}) {
-        print colored(install_string('installation_failed'), COLOR_ERROR),
-              "\n\n";
-    }
-}
-
-sub _translate_feature {
-    my $features = shift;
-    my @strings;
-    foreach my $feature (@$features) {
-        push(@strings, install_string("feature_$feature"));
-    }
-    return join(', ', @strings);
-}
-
 sub check_webdotbase {
     my ($output) = @_;
 
@@ -781,59 +209,6 @@ sub check_font_file {
     return $readable && $ttf;
 }
 
-# This was originally clipped from the libnet Makefile.PL, adapted here for
-# accurate version checking.
-sub have_vers {
-    my ($params, $output) = @_;
-    my $module  = $params->{module};
-    my $package = $params->{package};
-    if (!$package) {
-        $package = $module;
-        $package =~ s/::/-/g;
-    }
-    my $wanted  = $params->{version};
-
-    eval "require $module;";
-    # Don't let loading a module change the output-encoding of STDOUT
-    # or STDERR. (CGI.pm tries to set "binmode" on these file handles when
-    # it's loaded, and other modules may do the same in the future.)
-    Bugzilla::Install::Util::set_output_encoding();
-
-    # VERSION is provided by UNIVERSAL::, and can be called even if
-    # the module isn't loaded. We eval'uate ->VERSION because it can die
-    # when the version is not valid (yes, this happens from time to time).
-    # In that case, we use an uglier method to get the version.
-    my $vnum = eval { $module->VERSION };
-    if ($@) {
-        no strict 'refs';
-        $vnum = ${"${module}::VERSION"};
-
-        # If we come here, then the version is not a valid one.
-        # We try to sanitize it.
-        if ($vnum =~ /^((\d+)(\.\d+)*)/) {
-            $vnum = $1;
-        }
-    }
-    $vnum ||= -1;
-
-    # Must do a string comparison as $vnum may be of the form 5.10.1.
-    my $vok = ($vnum ne '-1' && version->new($vnum) >= version->new($wanted)) ? 1 : 0;
-    my $blacklisted;
-    if ($vok && $params->{blacklist}) {
-        $blacklisted = grep($vnum =~ /$_/, @{$params->{blacklist}});
-        $vok = 0 if $blacklisted;
-    }
-
-    if ($output) {
-        _checking_for({ 
-            package => $package, ok => $vok, wanted => $wanted,
-            found   => $vnum, blacklisted => $blacklisted
-        });
-    }
-    
-    return $vok ? 1 : 0;
-}
-
 sub _checking_for {
     my ($params) = @_;
     my ($package, $ok, $wanted, $blacklisted, $found) = 
@@ -872,23 +247,6 @@ sub _checking_for {
     print $ok ? $str : colored($str, COLOR_ERROR);
 }
 
-sub install_command {
-    my $module = shift;
-    my ($command, $package);
-
-    if (ON_ACTIVESTATE) {
-        $command = 'ppm install %s';
-        $package = $module->{package};
-    }
-    else {
-        $command = "$^X install-module.pl \%s";
-        # Non-Windows installations need to use module names, because
-        # CPAN doesn't understand package names.
-        $package = $module->{module};
-    }
-    return sprintf $command, $package;
-}
-
 # This does a reverse mapping for FEATURE_FILES.
 sub map_files_to_features {
     my %features = FEATURE_FILES;
@@ -904,68 +262,6 @@ sub map_files_to_features {
     return \%files;
 }
 
-sub export_cpanfile {
-    my $cpanfile;
-    # Required modules
-    foreach my $module (@{ REQUIRED_MODULES() }) {
-        my $requires = "requires '" . $module->{module} . "'";
-        $requires .= ", '" . $module->{version} . "'" if $module->{version};
-        $requires .= ";\n";
-        $cpanfile .= $requires;
-    }
-    # Recommended modules
-    $cpanfile .= "\n# Optional\n";
-    my %features;
-    foreach my $module (@{ OPTIONAL_MODULES() }) {
-        next if $module->{package} eq 'mod_perl'; # Skip mod_perl since this would be installed by distro
-        if (exists $module->{feature}) {
-            foreach my $feature (@{ $module->{feature} }) {
-                # cpanm requires that each feature only be defined in the cpanfile
-                # once, so we use an intermediate hash to consolidate/de-dupe the
-                # modules associated with each feature.
-                $features{$feature}{$module->{module}} = $module->{version};
-            }
-        }
-        else {
-            my $recommends = "";
-            $recommends .= "recommends '" . $module->{module} . "'";
-            $recommends .= ", '" . $module->{version} . "'" if $module->{version};
-            $recommends .= ";\n";
-            $cpanfile .= $recommends;
-        }
-    }
-    foreach my $feature (sort keys %features) {
-        my $recommends = "";
-        $recommends .= "feature '" . $feature . "' => sub {\n";
-        foreach my $module (sort keys %{ $features{$feature} }) {
-            my $version = $features{$feature}{$module};
-            $recommends .= "  recommends '" . $module . "'";
-            $recommends .= ", '$version'" if $version;
-            $recommends .= ";\n";
-        }
-        $recommends .= "};\n";
-        $cpanfile .= $recommends;
-    }
-    # Database modules
-    $cpanfile .= "\n# Database support\n";
-    foreach my $db (keys %{ DB_MODULE() }) {
-        next if !exists DB_MODULE->{$db}->{dbd};
-        my $dbd = DB_MODULE->{$db}->{dbd};
-        my $recommends .= "feature '$db' => sub {\n";
-        $recommends .= "  recommends '" . $dbd->{module} . "'";
-        $recommends .= ", '" . $dbd->{version} . "'" if $dbd->{version};
-        $recommends .= ";\n};\n";
-        $cpanfile .= $recommends;
-    }
-
-    # Write out the cpanfile to the document root
-    my $file = bz_locations()->{'libpath'} . '/cpanfile';
-    open(my $fh, '>', $file);
-    print $fh $cpanfile;
-    close $fh;
-    success(install_string('cpanfile_created', { file => $file }));
-}
-
 1;
 
 __END__
@@ -985,31 +281,6 @@ perl modules it requires.)
 
 =over
 
-=item C<REQUIRED_MODULES>
-
-An arrayref of hashrefs that describes the perl modules required by 
-Bugzilla. The hashes have three keys: 
-
-=over
-
-=item C<package> - The name of the Perl package that you'd find on
-CPAN for this requirement. 
-
-=item C<module> - The name of a module that can be passed to the
-C<install> command in C<CPAN.pm> to install this module.
-
-=item C<version> - The version of this module that we require, or C<0>
-if any version is acceptable.
-
-=back
-
-=item C<OPTIONAL_MODULES>
-
-An arrayref of hashrefs that describes the perl modules that add
-additional features to Bugzilla if installed. Its hashes have all
-the fields of L</REQUIRED_MODULES>, plus a C<feature> item--an arrayref
-of strings that describe what features require this module.
-
 =item C<FEATURE_FILES>
 
 A hashref that describes what files should only be compiled if a certain
@@ -1047,21 +318,8 @@ A hashref containing these values:
 
 =over
 
-=item C<pass> - Whether or not we have all the mandatory requirements.
-
-=item C<missing> - An arrayref containing any required modules that
-are not installed or that are not up-to-date. Each item in the array is
-a hashref in the format of items from L</REQUIRED_MODULES>.
-
-=item C<optional> - The same as C<missing>, but for optional modules.
-
 =item C<apache> - The name of each optional Apache module that is missing.
 
-=item C<have_one_dbd> - True if at least one C<DBD::> module is installed.
-
-=item C<any_missing> - True if there are any missing Perl modules, even
-optional modules.
-
 =back
 
 =back
@@ -1086,45 +344,6 @@ Params:      C<$output> - C<$true> if you want the function to
 
 Returns:     C<1> if the check was successful, C<0> otherwise.
 
-=item C<export_cpanfile>
-
- Description: Based on C<REQUIRED_MODULES> and C<OPTIONAL_MODULES>,
-              the function outputs text useful for writing to a
-              C<cpanfile>. C<cpanfile> can be used by utilities
-              such as C<cpanm> for installing the Perl dependencies
-              needed by an application.
-
- Params:      None
-
- Returns:     Text output for writing to a C<cpanfile>.
-
-=item C<have_vers($module, $output)>
-
- Description: Tells you whether or not you have the appropriate
-              version of the module requested. It also prints
-              out a message to the user explaining the check
-              and the result.
-
- Params:      C<$module> - A hashref, in the format of an item from 
-                           L</REQUIRED_MODULES>.
-              C<$output> - Set to true if you want this function to
-                           print information to STDOUT about what it's
-                           doing.
-
- Returns:   C<1> if you have the module installed and you have the
-            appropriate version. C<0> otherwise.
-
-=item C<install_command($module)>
-
- Description: Prints out the appropriate command to install the
-              module specified, depending on whether you're
-              on Windows or Linux.
-
- Params:      C<$module> - A hashref, in the format of an item from
-                           L</REQUIRED_MODULES>.
-
- Returns:     nothing
-
 =item C<map_files_to_features>
 
 Returns a hashref where file names are the keys and the value is the feature
@@ -1132,10 +351,3 @@ that must be enabled in order to compile that file.
 
 =back
 
-=head1 B<Methods in need of POD>
-
-=over
-
-=item print_module_instructions
-
-=back
index 5ca37df28c8a59e71248d4c0ac921321bc2bf099..f73e25014745c843ff8177a868fe827b317594e4 100644 (file)
@@ -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;
 }
 
diff --git a/META.json b/META.json
new file mode 100644 (file)
index 0000000..cfb9e0e
--- /dev/null
+++ b/META.json
@@ -0,0 +1,379 @@
+{
+   "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"
+}
diff --git a/META.yml b/META.yml
new file mode 100644 (file)
index 0000000..907d969
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,181 @@
+---
+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'
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644 (file)
index 0000000..19d6351
--- /dev/null
@@ -0,0 +1,254 @@
+#!/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
+}
index 1dc9b2c1bd36dcd96266f408394b27d65b81934c..122e8c3b9c58342f5de8a4c757a2894fe8188b0a 100755 (executable)
--- a/admin.cgi
+++ b/admin.cgi
@@ -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;
index c04359fb186e46b2226ede85678ccd1f3b2e19f1..c60d1e78296dd6f1af85104f48ce83d3601121cb 100644 (file)
--- a/app.psgi
+++ b/app.psgi
@@ -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;
index 8a6672ae4a70a2038c1641f8a7be5dd756a9921a..ee1f24605d71839f9a8bf2ec99449607afe14b80 100755 (executable)
@@ -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;
index 8bb6862dc9e9b8672f58cfe9fcc4966811471743..2cdff239a8f56f302fe1900da874a621af1c9c6d 100755 (executable)
--- a/auth.cgi
+++ b/auth.cgi
@@ -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;
index 7b1c69e4011ff70a79069c9f77ffb9378edf227e..d67d274c7a4fbe5a736473931cc76cdc523bddfa 100755 (executable)
@@ -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;
index c1bafa1175cbf0fe5aaa15f6e4988f3677cebdec..62054b799ccfbc0247f819c6031e82c5c050b574 100755 (executable)
--- a/chart.cgi
+++ b/chart.cgi
@@ -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;
index d7ef811bd8e2ec8ee094be82fef6942c389842d2..7c30a6e9d59ef5f7e65aa8f454978bbcb6647eaa 100755 (executable)
@@ -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
index 57486bfed8e95e05c47a8d9afc8b7329efcabd6c..810fe598cd1bfb3aae28cf580821cf6665e72b08 100755 (executable)
@@ -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;
index 77d9f11eef1c6369459e2d4fb8995990037e97ea..aae7f95127dabd8bb624edf3b0ab390bf899f340 100755 (executable)
@@ -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;
index b874c51951e4121cfe8a23b510fea146f1e5b19e..e638e9fff3b2289633f3c1b672e2d778d6841919 100755 (executable)
@@ -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;
index 56a9a3f8a183092189370ce0bd5166f0a00f1bf6..1eaa4e444f6b8fa2d2fcf856879737a12d836191 100755 (executable)
@@ -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;
index fcdbefd56d37ab19871ea46e065b345606a42366..73160cf6a6986666b98238e22651311a7092d5ba 100755 (executable)
@@ -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;
index fe2342cd9b099e68d4915bf9cc6ccbbbb3844fe3..b2060bbdbf43b3ff36445f2af16c9f68b4cbeb34 100755 (executable)
@@ -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;
index d9bffb7bbedcc7d99e9a39b456619309ea115dbc..1cbabca377ea76574ca00f3e8b767db43a06023e 100755 (executable)
@@ -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);
index 91a77b839438739729c74a85bf8e4ba34d1d7f3a..d4f29d85569272d86b5b7cda5556f075f79bab2d 100755 (executable)
@@ -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;
index 33b042c66bb604222c6b83b9bb5fd84d85617868..a6e31fe701fd465bc185be7c3ea5a11794b52bd2 100755 (executable)
@@ -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);
index 86b209ab243d87aaea597c3531cd49cca107286e..8e13b093495bbc99cf46edb7f6bdf71989e3cb9a 100755 (executable)
@@ -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;
index e6da47b924a91687deb2834b23583a1ca31be0fb..edd9fe423acacda18cb4f014e442fcb4d6038f98 100755 (executable)
@@ -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;
index 223d91f6c6d85810a9fc268ea56dad771e00a0f3..c48a6f713253ee28ca87d7a1c280609b55efc6aa 100755 (executable)
@@ -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;
index b9034aa8de229004c254516205b2bfc35d1a5873..639762af9c6342be46ac7d3dd0dac05cdf4cec47 100755 (executable)
@@ -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;
index f618624ec3195c0f512404cebd829ab9024f9ac4..872dbc3d716acb72fc6a46df82b6ed6d5b239aa8 100755 (executable)
@@ -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;
index d4aa511c15660ef24f1e02f6b89fe3058c3c090a..d46bb72d8456f4eccc80bae204d8ca4a5a0ee9f1 100755 (executable)
@@ -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;
index f74dc75f43b512c6a0c7e0ba671c444bedb4ed13..961324396a87059e68a526962b61f14230ae6a46 100755 (executable)
@@ -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;
index 31bf0c13e110700782af5533df6a89c3f2fc3a5b..bb8cff7b00beb7a93257d8ed6a8b1e32d84453cf 100755 (executable)
@@ -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;
index dc3e338a4cc668ee0968cde8b8311eff314e50ce..4b233d569bc469cd81415126a41c9113be933685 100755 (executable)
@@ -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 .
 
index a8a790dd72ec6ba029b31c3901375a1fff67b1fa..e1672fc2ab8fef6a72d151a7eee45a6868e0b5f2 100644 (file)
@@ -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:
 
index b18a5ec3142983792268353285e34b207740bd0d..938088272c4622d1491030d00e43e84b3a7fdc95 100644 (file)
@@ -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:
 
index 26543bebd2063b415556b4908e71ae07b09717cc..6baf9a797c741efd6af05b09dab4e925c040a42f 100755 (executable)
@@ -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);
index c1bf036be32e25f2dc5c43434f74c9e568a5580c..22a0c40063eba0c4513833e312d394ae21bd13a9 100755 (executable)
@@ -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;
index f839cfa03ea3254eed040675c8b3fe928e99cf3e..773aa20dc1e6eb05f01a894a9f60fe21b6429544 100755 (executable)
@@ -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;
index aebc0b6471573b7e5f6be49b63baf03e65430a8c..68de12a1579895236dbecb136466eb0197bfb840 100755 (executable)
@@ -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;
index e8351bdd6970d9f4fff4ba60ee2fb9137a6bc5be..87db4ce08616e1a93df401fdc2948c96650f7450 100755 (executable)
@@ -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;
index d0b9443b59492a61ddcee28d53123e17323fe01a..e9d2ab42b9686a6f60df6d4dfd50f3b585838105 100755 (executable)
@@ -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;
index f2c915556a26191f245a8a65fd606972e1f3be24..baff40f6b8a48a923c0fe9270f18f3f61ca9789f 100755 (executable)
@@ -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;
index da7513f6f2a3d4544b108bbf3b835af8c3ddf12b..cfa5e31b9df145ba154a95c44dd049b7b29a832a 100755 (executable)
@@ -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;
index b5188821e266e8b837138859bf8611c2c31a18a4..432c0bc5b17250ec6d4ffe598923357935491127 100755 (executable)
@@ -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;
index 5484f5fdc17770da9279e26c37fbbdf864adbccc..3894b48801f7e52e4b53a1db5d53a8848dcc5ede 100755 (executable)
@@ -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;
index 62aa1206d8b71b7e29e3bff2709adfa102451675..a1c06e91f2f2d82b29fcd3f5b90d9b9eb9b42077 100755 (executable)
@@ -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;
index b10a497ba5b39234cfef7ca25182ad905953a595..ef419c7e32290be975be6d9a7bd29fd4d620656f 100755 (executable)
@@ -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;
index 37665b12d7bf965c2561f180aad8ca14fffe9f52..54160b4938c36a1fbaf7751c7cb0477edb00d629 100755 (executable)
@@ -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;
index 75ebee0fca0ccf9768f45406811fdcf8b656a1fd..8c80a04d0c899ca54f88bfdbd4594ac8cfd7b000 100755 (executable)
@@ -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;
index 1d4e17d4180466170474d8efb2611c8d0f3eb82f..976c72224e6172fa84aa0bec4b5a405e6b572e39 100755 (executable)
@@ -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;
index b11c44949c17f4ba57c6860bba0f40a431a017f8..229a32e256a071fc5c7016adfb536af378b6342f 100755 (executable)
@@ -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;
index 71b14af7786148f170be6619430b4f9732bfa863..3739158a1f643526f3c2cc1e99b15fdc43ede813 100755 (executable)
@@ -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;
index 6d81e00dcf447c571ef6e59b59047fba87ffedba..6951924f624c073c2a934bf8ad6c5ac0824888f0 100755 (executable)
@@ -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;
index e03a88528a129d9396fff9dee030bad60d8e5279..aa396b1bedf5205ad8fc0388530b884a613fcd75 100755 (executable)
@@ -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;
index 7c8693e289be4511dc8a092518819287fec7b4b7..f22734777b5f7e70f2f32dcc930ed5cc1e2284a7 100755 (executable)
@@ -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;
diff --git a/gen-cpanfile.pl b/gen-cpanfile.pl
new file mode 100644 (file)
index 0000000..26b3ab3
--- /dev/null
@@ -0,0 +1,68 @@
+#!/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";
+}
+
+
index 12831e0b9494e5787c14871eef8031509c5ef006..463c6ef708b11c855c814b56bebc68d070fbdd97 100755 (executable)
@@ -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;
index 15d34451d51beb2d5ddc4e68770f827d0f156f8d..fcfe24dd5c8fc01e0807f22d5e8ba4c87e60272d 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -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;
diff --git a/install-module.pl b/install-module.pl
deleted file mode 100755 (executable)
index 365f10b..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-#!/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
index 85818033475eb5c69e74d592662d0d6ce47e73cd..4ce7c27f7151a3d63fff9e3529b88de99247a3e5 100755 (executable)
@@ -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;
 
index 2c93585b0913a4fae452fcfe708feb0ffff47164..eab11af59edccb6bc40d929cde55bb9942c30132 100755 (executable)
@@ -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;
index eb2a84b59bce4b754be6aaf9adbf4a45e877b70c..0c2fad610a22c58f2d6ffd81617f32a07a92ed4d 100755 (executable)
@@ -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;
 
index 032266fa26b5623fa6e311de352db963ba97804a..c61ad4629d7fdd9b7de67712aafd3d52a26fbfe3 100644 (file)
@@ -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
index b60ce8bdee3b2caa289818cf7c6091f9f35ece0c..e954cd94a1841beeae6251063b1a706171ec36b8 100755 (executable)
--- a/page.cgi
+++ b/page.cgi
@@ -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;
index a01cd11fb3df3e5ddb1361c871c461d3134e5e4c..5deba2cdbcec1baddd44babe3d3000edcb4d8345 100755 (executable)
@@ -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;
index f67050bd1cd83cfe8ab6c0978f4befc9aec3acd5..607520bb1e44ac1eb04f050e3184cbc39ad352c0 100755 (executable)
@@ -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;
index c1d3390dfa797eb3fb72c2a5def1568ec68e5ad7..360b829ec3d882d8515053838d5f8b422b3d4c92 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -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;
index b2790be548f6abaf96f905d0590fdfdb8589394a..061a7984088fbe101697b11a16384bc7cbad5eaf 100755 (executable)
--- a/quips.cgi
+++ b/quips.cgi
@@ -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;
index 286127495a0fa77c01ef02c4a20cdd7d5e47ecb9..6836795c525dfc3e344bca4986f242586e9ff06d 100755 (executable)
@@ -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;
index 2a8317d7a4589d8e50832f46c54d8e625a98f71b..8de3288d94123f53f840bee4b58b8302763b53a5 100755 (executable)
@@ -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;
index 89dee1c9a5361f6160917a648bf420761a6ebd55..b8c08cbe3c63ac57d33d862e56335aa7786226ca 100755 (executable)
@@ -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;
index 347cb7a44fedaeb10a0ec705498a5443c97fad5f..3283722ce63ed044149edb4cc548e375a5d276fd 100755 (executable)
@@ -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;
index ab985ca79b31593015b0211c30f5d8da8cf576ab..c6adb0888703e61aee33f83dd490f9957e89175c 100755 (executable)
--- a/rest.cgi
+++ b/rest.cgi
@@ -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;
diff --git a/runtests.pl b/runtests.pl
deleted file mode 100755 (executable)
index 52de88e..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/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"));
index 889d7f3e6e51c8b1f43e89fea1909fc3d46022de..7f1db26bc6eb360eecd1e83ace90f18238fbd6de 100755 (executable)
@@ -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;
index 7fd12b17663f8cc05db15304af3f042f0af4050b..bf3680bd6414d2f803e134399124b8d0208e83a0 100755 (executable)
@@ -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;
index 0b628f32ef26fc7a68cd9700c8a98371cb2185ce..938e5720b4a506e1f893a3d49d7916b4b96c6121 100755 (executable)
@@ -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;
index 7df10fcb847d56f4b28287d81aafbb2ab6069ed6..d2f7c99634b86b0242996d7ba70a2aaf9b373766 100755 (executable)
@@ -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;
index f69cae740857ecb266a2ffe5933eef749b0d2d85..997fab60d5f93364b73f65eff3e2c9ae891a5117 100755 (executable)
@@ -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;
index 83224dfd74ac8a1da7181460f729f8f8b3683035..c5bcd5bdc6affdbfee81611235723c938621983d 100755 (executable)
@@ -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;
 
index 9e193df02156fa0728a343a358b1daa06428f605..7f594632e7eaa74631114ea24d7339accadf00ec 100755 (executable)
@@ -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;
index 7b33ec7c44f0f1b52b6cc7196d18752ab1d975f3..b498349a090f9ddb6bf673928451f38c688a7054 100755 (executable)
@@ -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;
 
index 3bdf8ee52f173ac2e01a52f8259e06e835bc07ce..85d68b2dd789ce5f8f6c5665f9b2af6e9d71c403 100755 (executable)
@@ -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
 
index a546e40ad859378211930f90559c6f3df72ff111..da95b7327dae3be0f500a470c04ad9e3f3e8a598 100644 (file)
@@ -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);
index cfc9fb9e9a80f326c835eaa9c80814867f9d5a4d..7b2e74acce8938d57aae2ad864e7935f91d188b9 100644 (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;
 
index ce45cfec1b3005719caaee0f3a49ea98f07378e1..909f1a231d9285b59e701026965549118cd52161 100644 (file)
@@ -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;
 
index b6de8cee391fd47577415ffd72aa34c4e3401d8b..be13890bb930ee0ddf4885b02a2546c70e966d54 100644 (file)
@@ -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;
index 24e00242d9280d2e22a0f39c6fcf8caa0fbdcfcb..2f6dbbf76bcdd87e206f1cbdd714c5639cbd1ff8 100644 (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;
 
 # -1 because 006spellcheck.t must not be checked.
index 66c2df032fbbf39835ca4d864fc94423b3cb6f4b..b8e9505d8ced0dceae7034de4c709c7d57563673 100644 (file)
@@ -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;
index 1f5219f719b600f0cb3a202e1c321a5f56d05434..65fecfb1f678544bd56b1a2f729fcd6b2a5fa62e 100644 (file)
@@ -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;
index e36651edb2a44b29ae1c61aa0f5d68cd29ffe9eb..740cbf6aa801b26b841c36ace46226910b9072ff 100644 (file)
@@ -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;
index afd29a652b790ccc63c705e17eccfe76444ee517..777d42ed1f8eed224040bb6555109d92450cec0b 100644 (file)
@@ -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);
index 193435d4e338c407fc29b539214bd9f583a27a68..380b866c9fc630e51d82a9bcfc17ab74706e1ae7 100644 (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;
 use Pod::Checker;
index 0ef043fa5f62b258d09543df25fcb6747ac61b58..cb00eaf785d84f146034f35bfc9e9f610fa38801 100644 (file)
@@ -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;
index 217176ff202d6f14e8e89284af726addd405c72c..8313444d7abc4826829ba5d7e551151061a0a187 100644 (file)
@@ -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;
 
index f1c88e858a8ab21c340a84f87012973354ab76c1..39bacccfc36e41a68fa889caefa5fd5d99e2b8fc 100644 (file)
@@ -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" }
index 61476d69c7e0e26e542a9ea3f41cbe2df52a43a4..6bb4615e9466fc88cdd869e888b6edc55b12b68e 100644 (file)
@@ -89,42 +89,10 @@ END
 Extensions must return their name, not <code>1</code> or a number. See
 the documentation of Bugzilla::Extension for details.
 END
-    feature_auth_ldap         => 'LDAP Authentication',
-    feature_auth_radius       => 'RADIUS Authentication',
-    feature_documentation     => 'Documentation',
-    feature_graphical_reports => 'Graphical Reports',
-    feature_html_desc         => 'More HTML in Product/Group Descriptions',
-    feature_inbound_email     => 'Inbound Email',
-    feature_jobqueue          => 'Mail Queueing',
-    feature_jsonrpc           => 'JSON-RPC Interface',
-    feature_new_charts        => 'New Charts',
-    feature_old_charts        => 'Old Charts',
-    feature_memcached         => 'Memcached Support',
-    feature_mod_perl          => 'mod_perl',
-    feature_moving            => 'Move Bugs Between Installations',
-    feature_patch_viewer      => 'Patch Viewer',
-    feature_psgi              => 'PSGI Support',
-    feature_rest              => 'REST Interface',
-    feature_smtp_auth         => 'SMTP Authentication',
-    feature_smtp_ssl          => 'SSL Support for SMTP',
-    feature_updates           => 'Automatic Update Notifications',
-    feature_xmlrpc            => 'XML-RPC Interface',
-    feature_detect_charset    => 'Automatic charset detection for text attachments',
-    feature_typesniffer       => 'Sniff MIME type of attachments',
-    feature_markdown          => 'Markdown syntax support for comments',
-
     file_remove => 'Removing ##name##...',
     file_rename => 'Renaming ##from## to ##to##...',
     header => "* This is Bugzilla ##bz_ver## on perl ##perl_ver##\n"
             . "* Running on ##os_name## ##os_ver##",
-    install_all => <<EOT,
-
-To attempt an automatic install of every required and optional module
-with one command, do:
-
-  ##perl## install-module.pl --all
-
-EOT
     install_data_too_long => <<EOT,
 WARNING: Some of the data in the ##table##.##column## column is longer than
 its new length limit of ##max_length## characters. The data that needs to be
@@ -132,15 +100,6 @@ fixed is printed below with the value of the ##id_column## column first and
 then the value of the ##column## column that needs to be fixed:
 
 EOT
-    install_module => 'Installing ##module## version ##version##...',
-    installation_failed => '*** Installation aborted. Read the messages above. ***',
-    install_no_compiler => <<END,
-ERROR: Using install-module.pl requires that you install a compiler, such as
-gcc.
-END
-    install_no_make => <<END,
-ERROR: Using install-module.pl requires that you install "make".
-END
     lc_new_vars => <<'END',
 This version of Bugzilla contains some variables that you may want to
 change and adapt to your local settings. The following variables are
index 7ee7fe9290da2ab43b01f666da409c882c68696a..a3d54f971e1acfd1149e3ce7de857317da8600bc 100755 (executable)
@@ -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;
index eba336d98e5872534f4d316e806921b82aceccbc..67f5e9e3d82e3a6fd778c00b78c548d1da1a4dba 100755 (executable)
--- a/token.cgi
+++ b/token.cgi
@@ -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;
index 4b1a7d542e91f210917f0d1ab4e0a986dc3e6c6a..bd5cfaf01735b3f724340e930b97c8f1583adc46 100755 (executable)
@@ -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;
index 29222725a77283635784ea27b59a9ff1460d3c4e..c778d0d61c942fc38e6ecf65077dc7be75d98533 100755 (executable)
@@ -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;
index ae692a941b185d194890b973df72da22024ece57..5a00154f8873f0aa9f191446783236b8a8b00061 100755 (executable)
--- a/votes.cgi
+++ b/votes.cgi
@@ -13,7 +13,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;
index dfc405200dfc14f4579e37dec53b66a430c882e3..a18a5b5d8ee1d929eae84b1702ed51783de618e9 100755 (executable)
--- a/whine.pl
+++ b/whine.pl
@@ -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;
index 4812b4cfe27d62ed5ef3588a875f9433b75cbee1..318ecda941c75144cee21d7d24f0268a45ee0309 100755 (executable)
@@ -18,7 +18,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;
index 893bfba5d86179964db0bcb128d09fac82769078..75ff8a1a91d61184db3e1590e8242525c4f88253 100755 (executable)
@@ -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;
index 81f2f3338324a85baa4830360ce27ae753144217..8f6e2e9985a58b1de1bffad701198ae3ed3359ec 100644 (file)
@@ -11,7 +11,7 @@
 
 use strict;
 use warnings;
-use lib qw(. xt/lib lib);
+use lib qw(. xt/lib lib local/lib/perl5);
 use Bugzilla;
 use Bugzilla::Constants;
 use Bugzilla::Test::Search;