From add85e7636ac8a8972fdb43f1fc77e4c87680ec4 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 16 Dec 2018 22:18:21 +0100 Subject: WIP get_maintainer Signed-off-by: Florian Pritz --- lib/App/ArchLinux/PackagerTools.pm | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'lib/App') diff --git a/lib/App/ArchLinux/PackagerTools.pm b/lib/App/ArchLinux/PackagerTools.pm index b92e20c..79b4787 100644 --- a/lib/App/ArchLinux/PackagerTools.pm +++ b/lib/App/ArchLinux/PackagerTools.pm @@ -102,6 +102,42 @@ method get_updateable_packages($distribution_names) { return \@packages; } +=head3 get_maintainer + + my $maintainer = $app->get_maintainer($pkgname); + +Accepts a package name and returns the maintainer of the package. + +=cut + +method get_maintainer($pkgname) { + # TODO fetch maintainer from archweb + cache the value. use CHI + return "bluewind\@xinu.at"; +} + +=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}; + +Accepts a list of packages (hashes with the pkgname key) and returns a list +with the maintainer key added to each package. + +=cut + +method add_maintainers($packages) { + my @packages_with_maintainer; + # fetch package maintainer from archweb + for my $package ($packages->@*) { + push @packages_with_maintainer, { + $package->%*, + maintainer => $self->get_maintainer($package->{pkgname}), + }; + } + return \@packages_with_maintainer; +} + =head1 LICENSE Copyright (C) 2018 Florian Pritz Ebluewind@xinu.atE -- cgit v1.2.3-24-g4f1b