<commit_before>#!/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.14.0;
use strict;
use warnings;

use File::Basename;
BEGIN { chdir dirname($0); }
use lib qw(. lib local/lib/perl5 .checksetup_lib/lib/perl5);

# the @INC which checksetup needs to operate against.
our @BUGZILLA_INC = grep { !/checksetup_lib/ } @INC;

use Getopt::Long qw(:config bundling);
use Pod::Usage;
# Bug 1270550 - Tie::Hash::NamedCapture must be loaded before Safe.
use Tie::Hash::NamedCapture;
use Safe;

use Bugzilla::Constants;
use Bugzilla::Install::Requirements;
use Bugzilla::Install::Util qw(install_string get_version_and_os 
                               init_console success);

######################################################################
# Live Code
######################################################################

# Do not run checksetup.pl from the web browser.
Bugzilla::Install::Util::no_checksetup_from_cgi() if $ENV{'SERVER_SOFTWARE'};

# When we're running at the command line, we need to pick the right
# language before ever displaying any string.
init_console();

my %switch;
GetOptions(\%switch, 'help|h|?',
                     'no-templates|t', 'verbose|v|no-silent',
                     'cpanm:s',
                     'make-admin=s', 'reset-password=s', 'version|V',
                     'no-permissions|p');

# Print the help message if that switch was selected.
pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};

# Read in the "answers" file if it exists, for running in 
# non-interactive mode.
my $answers_file = $ARGV[0];
my $silent = $answers_file && !$switch{'verbose'};
print(install_string('header', get_version_and_os()) . "\n") unless $silent;
exit 0 if $switch{'version'};

if (defined $switch{cpanm}) {
    my $default = 'all notest -oracle -mysql -pg -mod_perl -old_charts -new_charts -graphical_reports -detect_charset';
    my @features = split(/\s+/, $switch{cpanm} || $default);
    my @cpanm_args = ('-l', 'local', '--installdeps');
    while (my $feature = shift @features) {
        if ($feature eq 'all') {
            push @cpanm_args, '--with-all-features';
        }
        elsif ($feature eq 'default') {
            unshift @features, split(/\s+/, $default);
        }
        elsif ($feature eq 'notest') {
            push @cpanm_args, '--notest';
        }
        elsif ($feature =~ /^-(.+)$/) {
            push @cpanm_args, "--without-feature=$1";
        }
        else {
            push @cpanm_args, "--with-feature=$feature";
        }
    }
    print "cpanm @cpanm_args \".\"\n" if !$silent;
    my $rv = system('cpanm', @cpanm_args, '.');
    exit 1 if $rv != 0;
}

my $meta = load_cpan_meta();
my $requirements = check_cpan_requirements($meta, \@BUGZILLA_INC, !$silent);<commit_msg>nit: include --skip-satisfied and --quiet for checksetup cpanm helper.<commit_after>#!/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.14.0;
use strict;
use warnings;

use File::Basename;
BEGIN { chdir dirname($0); }
use lib qw(. lib local/lib/perl5 .checksetup_lib/lib/perl5);

# the @INC which checksetup needs to operate against.
our @BUGZILLA_INC = grep { !/checksetup_lib/ } @INC;

use Getopt::Long qw(:config bundling);
use Pod::Usage;
# Bug 1270550 - Tie::Hash::NamedCapture must be loaded before Safe.
use Tie::Hash::NamedCapture;
use Safe;

use Bugzilla::Constants;
use Bugzilla::Install::Requirements;
use Bugzilla::Install::Util qw(install_string get_version_and_os 
                               init_console success);

######################################################################
# Live Code
######################################################################

# Do not run checksetup.pl from the web browser.
Bugzilla::Install::Util::no_checksetup_from_cgi() if $ENV{'SERVER_SOFTWARE'};

# When we're running at the command line, we need to pick the right
# language before ever displaying any string.
init_console();

my %switch;
GetOptions(\%switch, 'help|h|?',
                     'no-templates|t', 'verbose|v|no-silent',
                     'cpanm:s',
                     'make-admin=s', 'reset-password=s', 'version|V',
                     'no-permissions|p');

# Print the help message if that switch was selected.
pod2usage({-verbose => 1, -exitval => 1}) if $switch{'help'};

# Read in the "answers" file if it exists, for running in 
# non-interactive mode.
my $answers_file = $ARGV[0];
my $silent = $answers_file && !$switch{'verbose'};
print(install_string('header', get_version_and_os()) . "\n") unless $silent;
exit 0 if $switch{'version'};

if (defined $switch{cpanm}) {
    my $default = 'all notest -oracle -mysql -pg -mod_perl -old_charts -new_charts -graphical_reports -detect_charset';
    my @features = split(/\s+/, $switch{cpanm} || $default);
    my @cpanm_args = ('-l', 'local', '--installdeps');
    while (my $feature = shift @features) {
        if ($feature eq 'all') {
            push @cpanm_args, '--with-all-features';
        }
        elsif ($feature eq 'default') {
            unshift @features, split(/\s+/, $default);
        }
        elsif ($feature eq 'notest' || $feature eq 'skip-satisfied' || $feature eq 'quiet') {
            push @cpanm_args, "--$feature";
        }
        elsif ($feature =~ /^-(.+)$/) {
            push @cpanm_args, "--without-feature=$1";
        }
        else {
            push @cpanm_args, "--with-feature=$feature";
        }
    }
    print "cpanm @cpanm_args \".\"\n" if !$silent;
    my $rv = system('cpanm', @cpanm_args, '.');
    exit 1 if $rv != 0;
}

my $meta = load_cpan_meta();
my $requirements = check_cpan_requirements($meta, \@BUGZILLA_INC, !$silent);
{'fraction_non_alphanumeric': 0.21931137724550898, 'fraction_numerical': 0.008383233532934131, 'mean_word_length': 3.412813738441215, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2701580', 'n_tokens_mistral': 2180, 'n_tokens_neox': 2058, 'n_words': 605}