summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--lib/App/ArchLinux/PackagerTools.pm19
-rwxr-xr-xscript/perlpkg.pl7
3 files changed, 29 insertions, 5 deletions
diff --git a/README.md b/README.md
index 570ff7a..d36d1c2 100644
--- a/README.md
+++ b/README.md
@@ -62,6 +62,14 @@ with the maintainer key added to each package.
Filter a list of packages to the maintainers whitelisted in the config file.
+### 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.
+
# LICENSE
Copyright (C) 2018 Florian Pritz <bluewind@xinu.at>
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>
diff --git a/script/perlpkg.pl b/script/perlpkg.pl
index 03bdb92..195adc9 100755
--- a/script/perlpkg.pl
+++ b/script/perlpkg.pl
@@ -51,11 +51,8 @@ Log::Any::Adapter->set('Log4perl');
my $app = App::ArchLinux::PackagerTools->new();
use Data::Dumper;
-my $dists = $app->get_distributions_in_repo();
-my $dist_names = [map {$_->{dist_name}} $dists->@*];
-my $updateable = $app->get_updateable_packages($dist_names);
-my $pkgs = $app->add_maintainers($updateable);
-my $filtered_pkgs = $app->filter_by_maintainer($pkgs);
+
+my $filtered_pkgs = $app->get_filtered_updateable_packages();
print Dumper($filtered_pkgs);