summaryrefslogtreecommitdiffstats
path: root/lib/App/ArchLinux
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-12-10 23:43:32 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-12-10 23:43:32 +0100
commit407f5566ea831c07d070c98cf83af207288d28c0 (patch)
tree5461935a91fc319e81116915a1d56dfeadc51d2b /lib/App/ArchLinux
parentd02cec97b983985f4f48e607e807b46ab2ae93a6 (diff)
downloadApp-ArchLinux-PackagerTools-407f5566ea831c07d070c98cf83af207288d28c0.tar.gz
App-ArchLinux-PackagerTools-407f5566ea831c07d070c98cf83af207288d28c0.tar.xz
Fix incorrect example for get_updateable_packages()
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/ArchLinux')
-rw-r--r--lib/App/ArchLinux/PackagerTools.pm8
-rw-r--r--lib/App/ArchLinux/PackagerTools/CPAN.pm17
2 files changed, 12 insertions, 13 deletions
diff --git a/lib/App/ArchLinux/PackagerTools.pm b/lib/App/ArchLinux/PackagerTools.pm
index cfc2f01..409cbf7 100644
--- a/lib/App/ArchLinux/PackagerTools.pm
+++ b/lib/App/ArchLinux/PackagerTools.pm
@@ -66,10 +66,10 @@ method get_distributions_in_repo() {
my $distribution_names = ['App::ArchLinux::PackagerTools', 'DBI'];
my $packages = $app->get_updateable_packages($distribution_names);
- print $packages[0]->{dist_name};
- print $packages[0]->{pkgname};
- print $packages[0]->{repo_version};
- print $packages[0]->{cpan_version};
+ print $packages->[0]->{dist_name};
+ print $packages->[0]->{pkgname};
+ print $packages->[0]->{repo_version};
+ print $packages->[0]->{cpan_version};
Accepts a list of package names and returns a list of packages that can be
updated. The returned packages contain the name of the distribution, the name
diff --git a/lib/App/ArchLinux/PackagerTools/CPAN.pm b/lib/App/ArchLinux/PackagerTools/CPAN.pm
index 4faf0d6..50306c9 100644
--- a/lib/App/ArchLinux/PackagerTools/CPAN.pm
+++ b/lib/App/ArchLinux/PackagerTools/CPAN.pm
@@ -3,9 +3,9 @@ use strictures;
use autodie;
use CPAN::DistnameInfo;
-use CPANPLUS::Backend;
use Carp;
use Function::Parameters;
+use IPC::Run qw(run);
use Log::Any qw($log);
use Syntax::Keyword::Try;
use version;
@@ -37,7 +37,6 @@ Returns a new instance.
=cut
method new($class: $deps = {}) {
- $deps->{cpanplus_backend} //= CPANPLUS::Backend->new();
return $class->new_no_defaults($deps);
}
@@ -133,16 +132,16 @@ Set up the internal index of CPAN distributions
=cut
method _build_dist_index() {
- $log->debug("Updating CPANPLUS index. This may take a while");
- $self->{deps}->{cpanplus_backend}->reload_indices();
# 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("Building index...");
- my $packages_file = "$ENV{HOME}/.cpanplus/02packages.details.txt.gz";
- open my $fh, '-|', 'zcat', $packages_file;
+ $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 %seen;
my $line_number = 0;
- while (<$fh>) {
+ $log->debug("Building index...");
+ for (split /\n/, $out) {
# skip meta info (first 9 lines)
next if $line_number++ < 9;