summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-12-16 22:18:21 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-12-16 22:18:21 +0100
commitadd85e7636ac8a8972fdb43f1fc77e4c87680ec4 (patch)
treed6adde4a1452d3894b3c4371ba598a4f624d105b
parente7ec0e8f26d5700fd1b48911f4e4c91bb8eaa7bc (diff)
downloadApp-ArchLinux-PackagerTools-add85e7636ac8a8972fdb43f1fc77e4c87680ec4.tar.gz
App-ArchLinux-PackagerTools-add85e7636ac8a8972fdb43f1fc77e4c87680ec4.tar.xz
WIP get_maintainer
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--README.md15
-rw-r--r--lib/App/ArchLinux/PackagerTools.pm36
-rwxr-xr-xscript/perlpkg.pl4
3 files changed, 53 insertions, 2 deletions
diff --git a/README.md b/README.md
index 4ccab82..9ba9828 100644
--- a/README.md
+++ b/README.md
@@ -41,6 +41,21 @@ updated. The returned packages contain the name of the distribution, the name
of the pacman package, and the versions of each, the pacman package (which is
older) and the CPAN distribution.
+### get\_maintainer
+
+ my $maintainer = $app->get_maintainer($pkgname);
+
+Accepts a package name and returns the maintainer of the package.
+
+### 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.
+
# LICENSE
Copyright (C) 2018 Florian Pritz <bluewind@xinu.at>
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 E<lt>bluewind@xinu.atE<gt>
diff --git a/script/perlpkg.pl b/script/perlpkg.pl
index 7bfff3a..8c20f22 100755
--- a/script/perlpkg.pl
+++ b/script/perlpkg.pl
@@ -57,9 +57,9 @@ my $app = App::ArchLinux::PackagerTools->new();
use Data::Dumper;
my $dists = $app->get_distributions_in_repo();
my $dist_names = [map {$_->{dist_name}} $dists->@*];
-print Dumper($app->get_updateable_packages($dist_names));
+my $updateable = $app->get_updateable_packages($dist_names);
+my $pkgs = $app->add_maintainers($updateable);
-# TODO fetch maintainer from archweb
# TODO generate new pacakge pkgbuild
# TODO build
# TODO release