summaryrefslogtreecommitdiffstats
path: root/lib/App
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-12-25 10:21:01 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-12-25 10:21:01 +0100
commit28eab23842118e6fe7aa61c8dc8fb6219f53d1ac (patch)
tree80cecc829c72c901dd330125967eda5159dca9f6 /lib/App
parent3aedf7a4e2380b9e96b2b68bfd9fb13a33774c5d (diff)
downloadApp-ArchLinux-PackagerTools-28eab23842118e6fe7aa61c8dc8fb6219f53d1ac.tar.gz
App-ArchLinux-PackagerTools-28eab23842118e6fe7aa61c8dc8fb6219f53d1ac.tar.xz
Make script logic testable by moving to main package
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App')
-rw-r--r--lib/App/ArchLinux/PackagerTools.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/App/ArchLinux/PackagerTools.pm b/lib/App/ArchLinux/PackagerTools.pm
index 83b357a..46885d5 100644
--- a/lib/App/ArchLinux/PackagerTools.pm
+++ b/lib/App/ArchLinux/PackagerTools.pm
@@ -157,6 +157,25 @@ method filter_by_maintainer($packages) {
return [grep { any {$allowed_maintainers->{$_->{name}}} $_->{maintainers}->@*} $packages->@*];
}
+=head3 get_filtered_updateable_packages
+
+ my $pkgs = $app->get_filtered_updateable_packages();
+
+High-level method that returns a list of packages from the repository that have
+updates available. The list is filtered to only include packages of allowed
+maintainers.
+
+=cut
+
+method get_filtered_updateable_packages() {
+ my $dists = $self->get_distributions_in_repo();
+ my $dist_names = [map {$_->{dist_name}} $dists->@*];
+ my $updateable = $self->get_updateable_packages($dist_names);
+ my $pkgs = $self->add_maintainers($updateable);
+ my $filtered_pkgs = $self->filter_by_maintainer($pkgs);
+ return $filtered_pkgs;
+}
+
=head1 LICENSE
Copyright (C) 2018 Florian Pritz E<lt>bluewind@xinu.atE<gt>