summaryrefslogtreecommitdiffstats
path: root/lib/App/ArchLinux/PackagerTools
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-12-16 23:27:20 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-12-16 23:27:20 +0100
commitd7cd126cc8326f42713c20d2d95091156b44e58f (patch)
treef911a1858c5641b800ebb7773f20831870898b71 /lib/App/ArchLinux/PackagerTools
parentf23369c8b19a2e0966e6dde843ab6920fe0b93df (diff)
downloadApp-ArchLinux-PackagerTools-d7cd126cc8326f42713c20d2d95091156b44e58f.tar.gz
App-ArchLinux-PackagerTools-d7cd126cc8326f42713c20d2d95091156b44e58f.tar.xz
CPAN: Build dist index lazily
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/ArchLinux/PackagerTools')
-rw-r--r--lib/App/ArchLinux/PackagerTools/CPAN.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/App/ArchLinux/PackagerTools/CPAN.pm b/lib/App/ArchLinux/PackagerTools/CPAN.pm
index 4efc4df..1e1c86c 100644
--- a/lib/App/ArchLinux/PackagerTools/CPAN.pm
+++ b/lib/App/ArchLinux/PackagerTools/CPAN.pm
@@ -48,7 +48,6 @@ method new_no_defaults($class: $deps = {}) {
$self->{deps} = $deps;
$self->{dist_lc_map} = {};
$self->{dists} = {};
- $self->_build_dist_index();
return $self;
}
@@ -89,6 +88,7 @@ method search_dist($name) {
$name =~ s/::/-/g;
$log->tracef("Searching for CPAN distribution matching '%s'", $name);
+ $self->_build_dist_index();
my $index_name = $self->{dist_lc_map}->{lc($name)};
if (defined $index_name) {
return $self->{dists}->{$index_name};
@@ -114,6 +114,7 @@ method get_dist($dist_name) {
$dist_name =~ s/::/-/g;
$log->tracef("Getting CPAN data for distribution '%s'", $dist_name);
+ $self->_build_dist_index();
my $index_name = $self->{dist_lc_map}->{lc($dist_name)};
if (defined $index_name) {
return $self->{dists}->{$index_name};
@@ -133,6 +134,8 @@ Set up the internal index of CPAN distributions
=cut
method _build_dist_index() {
+ return if (scalar(keys $self->{dists}->%*) > 0);
+
$log->debug("Fetching CPAN modules index");
my $out = $self->{deps}->{packages_details_fetcher}->get_packages_data();;
my %seen;