From eaf37e9d61593012a693f50eea946d6abd031443 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 18 Dec 2018 11:32:20 +0100 Subject: Move pkgname/cpan dist map to configuration Signed-off-by: Florian Pritz --- lib/App/ArchLinux/PackagerTools/Config.pm | 7 +++++++ lib/App/ArchLinux/PackagerTools/Pacman.pm | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/App/ArchLinux/PackagerTools/Config.pm b/lib/App/ArchLinux/PackagerTools/Config.pm index bd8dfc1..37826e3 100644 --- a/lib/App/ArchLinux/PackagerTools/Config.pm +++ b/lib/App/ArchLinux/PackagerTools/Config.pm @@ -116,6 +116,13 @@ method _get_default_config() { cache_timeout => '60min', mirror_url => 'https://cpan.metacpan.org/', }, + pacman => { + pkgname_to_cpan_dist_map => { + # pkgname => cpan_name + 'perl-critic' => 'Perl::Critic', + 'perl-libintl-perl' => 'libintl-perl', + }, + }, }; } diff --git a/lib/App/ArchLinux/PackagerTools/Pacman.pm b/lib/App/ArchLinux/PackagerTools/Pacman.pm index 3204ca1..e1c6300 100644 --- a/lib/App/ArchLinux/PackagerTools/Pacman.pm +++ b/lib/App/ArchLinux/PackagerTools/Pacman.pm @@ -36,12 +36,12 @@ Returns a new instance. method new($class: $context, $deps = {}) { + $deps->{config} //= App::ArchLinux::PackagerTools::Config->new($context); $deps->{cpan} //= App::ArchLinux::PackagerTools::CPAN->new($context); - $deps->{pkgname_cpan_name_map} //= { - # pkgname => cpan_name - 'perl-critic' => 'Perl::Critic', - 'perl-libintl-perl' => 'libintl-perl', - }; + + my $conf = $deps->{config}->get_config(); + $deps->{pkgname_cpan_name_map} //= $conf->{pacman}->{pkgname_to_cpan_dist_map}; + return $class->new_no_defaults($context, $deps); } -- cgit v1.2.3-24-g4f1b