summaryrefslogtreecommitdiffstats
path: root/lib/App/ArchLinux/PackagerTools
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-12-16 22:19:26 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-12-16 22:19:26 +0100
commit4fb92a327f7cd8f9e77720bfab469c9c80760a34 (patch)
tree8d5cb8e8d4cf83ea92b8ee56be22a4d36d4969ea /lib/App/ArchLinux/PackagerTools
parentadd85e7636ac8a8972fdb43f1fc77e4c87680ec4 (diff)
downloadApp-ArchLinux-PackagerTools-4fb92a327f7cd8f9e77720bfab469c9c80760a34.tar.gz
App-ArchLinux-PackagerTools-4fb92a327f7cd8f9e77720bfab469c9c80760a34.tar.xz
WIP Add back cpanplus packages index code
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/ArchLinux/PackagerTools')
-rw-r--r--lib/App/ArchLinux/PackagerTools/CPAN.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/App/ArchLinux/PackagerTools/CPAN.pm b/lib/App/ArchLinux/PackagerTools/CPAN.pm
index 50306c9..e549408 100644
--- a/lib/App/ArchLinux/PackagerTools/CPAN.pm
+++ b/lib/App/ArchLinux/PackagerTools/CPAN.pm
@@ -132,12 +132,21 @@ Set up the internal index of CPAN distributions
=cut
method _build_dist_index() {
- # TODO download pacakges list ourselves instead of using cpanplus for it? We may need cpanplus for other features later so keeping it is probably also fine.
$log->debug("Fetching CPAN modules index");
my $out;
- run [qw(curl -s ), "https://cpan.metacpan.org/modules/02packages.details.txt.gz"], '|', ['zcat'], \$out or die $log->error("Failed to fetch and uncompress CPAN module index: $?")."\n";
- #my $packages_file = "$ENV{HOME}/.cpanplus/02packages.details.txt.gz";
- #open my $out, '-|', 'zcat', $packages_file;
+ my $use_cpanplus_index = 1;
+ # TODO put this in a dedicated module for testing
+ if ($use_cpanplus_index) {
+ # This is mostly for development so we don't go over the network on each run.
+ my $packages_file = "$ENV{HOME}/.cpanplus/02packages.details.txt.gz";
+ run ['zcat', $packages_file], \undef, \$out or die $log->error("Failed to fetch and uncompress CPAN module index: $?")."\n";
+ } else {
+ # TODO cache the details file locally
+ # TODO when we have a cache of this, remove the $use_cpanplus_index part since that is worse than having our own cache
+ # TODO make the cpan mirror configurable
+ run [qw(curl -s ), "https://cpan.metacpan.org/modules/02packages.details.txt.gz"], '|', ['zcat'], \$out or die $log->error("Failed to fetch and uncompress CPAN module index: $?")."\n";
+ }
+
my %seen;
my $line_number = 0;
$log->debug("Building index...");