diff options
author | rillig <rillig@pkgsrc.org> | 2019-09-12 02:49:33 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2019-09-12 02:49:33 +0000 |
commit | 4100b1a29b3200524b436b2e821755db28470b54 (patch) | |
tree | 81e70672bca450a88a24ebaed0366a090b7f6ec1 /pkgtools | |
parent | 9c58eecfdd9465722ea00086b520ae10605c96e4 (diff) | |
download | pkgsrc-4100b1a29b3200524b436b2e821755db28470b54.tar.gz |
pkgtools/url2pkg: split Perl package code into separate subs
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/url2pkg/files/url2pkg.pl | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/pkgtools/url2pkg/files/url2pkg.pl b/pkgtools/url2pkg/files/url2pkg.pl index bffb2751a78..131f92012fd 100644 --- a/pkgtools/url2pkg/files/url2pkg.pl +++ b/pkgtools/url2pkg/files/url2pkg.pl @@ -1,5 +1,5 @@ #! @PERL5@ -# $NetBSD: url2pkg.pl,v 1.65 2019/09/11 05:25:55 rillig Exp $ +# $NetBSD: url2pkg.pl,v 1.66 2019/09/12 02:49:33 rillig Exp $ # # Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -350,40 +350,42 @@ sub adjust_libtool() { } } -sub adjust_perl_module() { - - if (-f "$abs_wrksrc/Build.PL") { - # Example packages: - # devel/p5-Algorithm-CheckDigits +# Example packages: +# devel/p5-Algorithm-CheckDigits +sub adjust_perl_module_Build_PL() { - # It's a Module::Build module. Dependencies cannot yet be - # extracted automatically. - # - # TODO: Implement this similarly to the Makefile.PL mock below. + # TODO: Implement this similarly to the Makefile.PL mock below. - push(@todos, "Look for the dependencies in Build.PL."); + push(@todos, "Look for the dependencies in Build.PL."); - push(@build_vars, var("PERL5_MODULE_TYPE", "=", "Module::Build")); + push(@build_vars, var("PERL5_MODULE_TYPE", "=", "Module::Build")); +} - } elsif (-f "$abs_wrksrc/Makefile.PL") { - # Example packages: - # devel/p5-Algorithm-Diff (no dependencies) - # devel/p5-Carp-Assert-More (dependencies without version numbers) - # www/p5-HTML-Quoted (dependency with version number) +# Example packages: +# devel/p5-Algorithm-Diff (no dependencies) +# devel/p5-Carp-Assert-More (dependencies without version numbers) +# www/p5-HTML-Quoted (dependency with version number) +sub adjust_perl_module_Makefile_PL() { - # To avoid fix_up_makefile error for p5-HTML-Quoted, generate Makefile first. - system("cd '$abs_wrksrc' && perl -I. Makefile.PL < /dev/null") or do {}; + # To avoid fix_up_makefile error for p5-HTML-Quoted, generate Makefile first. + system("cd '$abs_wrksrc' && perl -I. Makefile.PL < /dev/null") or do {}; - open(DEPS, "cd '$abs_wrksrc' && perl -I$libdir -I. Makefile.PL |") or die; - while (defined(my $dep = <DEPS>)) { - chomp($dep); + open(DEPS, "cd '$abs_wrksrc' && perl -I$libdir -I. Makefile.PL |") or die; + while (defined(my $dep = <DEPS>)) { + chomp($dep); - if ($dep =~ qr"^(\w+)\t(\S+)(>\S+|):(\.\./\.\./\S+)$") { - add_dependency($1, $2, $3, $4); - } + if ($dep =~ qr"^(\w+)\t(\S+)(>\S+|):(\.\./\.\./\S+)$") { + add_dependency($1, $2, $3, $4); } - close(DEPS) or die; + } + close(DEPS) or die; +} +sub adjust_perl_module() { + if (-f "$abs_wrksrc/Build.PL") { + adjust_perl_module_Build_PL(); + } elsif (-f "$abs_wrksrc/Makefile.PL") { + adjust_perl_module_Makefile_PL(); } else { return; } @@ -393,6 +395,7 @@ sub adjust_perl_module() { push(@includes, "../../lang/perl5/module.mk"); $pkgname = "p5-\${DISTNAME}"; push(@categories, "perl5"); + unlink("PLIST") or do {}; } |