From b238f10d9441afe1565cf698c54b69a58bbc4a45 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 18 Dec 2018 00:34:53 +0100 Subject: Fetch maintainers from archweb Signed-off-by: Florian Pritz --- lib/App/ArchLinux/PackagerTools.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'lib/App/ArchLinux/PackagerTools.pm') diff --git a/lib/App/ArchLinux/PackagerTools.pm b/lib/App/ArchLinux/PackagerTools.pm index 216c54c..720f056 100644 --- a/lib/App/ArchLinux/PackagerTools.pm +++ b/lib/App/ArchLinux/PackagerTools.pm @@ -11,6 +11,7 @@ use Log::Any qw($log); use App::ArchLinux::PackagerTools::Pacman; use App::ArchLinux::PackagerTools::CPAN; use App::ArchLinux::PackagerTools::Config; +use App::ArchLinux::PackagerTools::Archweb; =encoding utf-8 @@ -41,6 +42,7 @@ method new($class: $context = {}, $deps = {}) { $deps->{config} //= App::ArchLinux::PackagerTools::Config->new($context); $deps->{cpan} //= App::ArchLinux::PackagerTools::CPAN->new($context); $deps->{pacman} //= App::ArchLinux::PackagerTools::Pacman->new($context); + $deps->{archweb} //= App::ArchLinux::PackagerTools::Archweb->new($context); return $class->new_no_defaults($context, $deps); } @@ -107,24 +109,23 @@ method get_updateable_packages($distribution_names) { return \@packages; } -=head3 get_maintainer +=head3 get_maintainers - my $maintainer = $app->get_maintainer($pkgname); + my $maintainers = $app->get_maintainers($pkgname); -Accepts a package name and returns the maintainer of the package. +Accepts a package name and returns the maintainers of the package. =cut -method get_maintainer($pkgname) { - # TODO fetch maintainer from archweb + cache the value. use CHI - return "bluewind\@xinu.at"; +method get_maintainers($pkgname) { + return $self->{deps}->{archweb}->get_maintainers($pkgname); } =head3 add_maintainers my $packages = $app->get_updateable_packages($distribution_names); my $packages_with_maintainer = $app->add_maintainers($packages); - print $packages_with_maintainer->[0]->{maintainer}; + print $packages_with_maintainer->[0]->{maintainers}->[0]->{name}; Accepts a list of packages (hashes with the pkgname key) and returns a list with the maintainer key added to each package. @@ -137,7 +138,7 @@ method add_maintainers($packages) { for my $package ($packages->@*) { push @packages_with_maintainer, { $package->%*, - maintainer => $self->get_maintainer($package->{pkgname}), + maintainers => $self->get_maintainers($package->{pkgname}), }; } return \@packages_with_maintainer; -- cgit v1.2.3-24-g4f1b