From 15daaf123635c1e734dfe6e3aed60f52df0364ce Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Mon, 27 Mar 2017 09:56:14 -0400 Subject: Bug 1350466 - Uplift bug 1342832 to bmo for performance and other reasons --- Bugzilla/Install/Requirements.pm | 27 +-------------------------- Bugzilla/Install/Util.pm | 2 +- 2 files changed, 2 insertions(+), 27 deletions(-) (limited to 'Bugzilla/Install') diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm index da06ab70c..54a45fd18 100644 --- a/Bugzilla/Install/Requirements.pm +++ b/Bugzilla/Install/Requirements.pm @@ -33,7 +33,6 @@ use autodie; our @EXPORT = qw( FEATURE_FILES - load_cpan_meta check_cpan_requirements check_cpan_feature check_all_cpan_features @@ -104,25 +103,6 @@ use constant FEATURE_FILES => ( s3 => ['Bugzilla/S3.pm', 'Bugzilla/S3/Bucket.pm', 'Bugzilla/Attachment/S3.pm'] ); -sub load_cpan_meta { - my $dir = bz_locations()->{libpath}; - my @meta_json = map { File::Spec->catfile($dir, $_) } qw( MYMETA.json META.json ); - my ($file) = grep { -f $_ } @meta_json; - - if ($file) { - open my $meta_fh, '<', $file or die "unable to open $file: $!"; - my $str = do { local $/ = undef; scalar <$meta_fh> }; - # detaint - $str =~ /^(.+)$/s; $str = $1; - close $meta_fh; - - return CPAN::Meta->load_json_string($str); - } - else { - ThrowCodeError('cpan_meta_missing'); - } -} - sub check_all_cpan_features { my ($meta, $dirs, $output) = @_; my %report; @@ -163,7 +143,7 @@ sub check_cpan_requirements { sub _check_prereqs { my ($prereqs, $dirs, $output) = @_; $dirs //= \@INC; - my $reqs = $prereqs->merged_requirements(['configure', 'runtime'], ['requires']); + my $reqs = Bugzilla::CPAN->cpan_requirements($prereqs); my @found; my @missing; @@ -484,11 +464,6 @@ Returns: C<1> if the check was successful, C<0> otherwise. Returns a hashref where file names are the keys and the value is the feature that must be enabled in order to compile that file. -=item C - -Load MYMETA.json or META.json from the bugzilla directory, and a return a L object. - =back =back - diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index c65c0e061..33b3d43d3 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -268,7 +268,7 @@ sub indicate_progress { sub feature_description { my ($feature_name) = @_; eval { - my $meta = _cache()->{cpan_meta} //= Bugzilla::Install::Requirements::load_cpan_meta(); + my $meta = Bugzilla::CPAN->cpan_meta; return $meta->feature($feature_name)->description } or warn $@; -- cgit v1.2.3-24-g4f1b