pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/url2pkg/files pkgtools/url2pkg: split Perl pa...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e560088ba5ee
branches:  trunk
changeset: 339369:e560088ba5ee
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Thu Sep 12 02:49:33 2019 +0000

description:
pkgtools/url2pkg: split Perl package code into separate subs

diffstat:

 pkgtools/url2pkg/files/url2pkg.pl |  63 ++++++++++++++++++++------------------
 1 files changed, 33 insertions(+), 30 deletions(-)

diffs (90 lines):

diff -r 10b836124018 -r e560088ba5ee pkgtools/url2pkg/files/url2pkg.pl
--- a/pkgtools/url2pkg/files/url2pkg.pl Thu Sep 12 02:35:07 2019 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.pl Thu Sep 12 02:49:33 2019 +0000
@@ -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_perl_module() {
+# Example packages:
+# devel/p5-Algorithm-CheckDigits
+sub adjust_perl_module_Build_PL() {
+
+       # TODO: Implement this similarly to the Makefile.PL mock below.
+
+       push(@todos, "Look for the dependencies in Build.PL.");
 
-       if (-f "$abs_wrksrc/Build.PL") {
-               # Example packages:
-               # devel/p5-Algorithm-CheckDigits
+       push(@build_vars, var("PERL5_MODULE_TYPE", "=", "Module::Build"));
+}
+
+# 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() {
 
-               # It's a Module::Build module. Dependencies cannot yet be
-               # extracted automatically.
-               #
-               # TODO: Implement this similarly to the Makefile.PL mock below.
+       # 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);
 
-               push(@todos, "Look for the dependencies in Build.PL.");
+               if ($dep =~ qr"^(\w+)\t(\S+)(>\S+|):(\.\./\.\./\S+)$") {
+                       add_dependency($1, $2, $3, $4);
+               }
+       }
+       close(DEPS) or die;
+}
 
-               push(@build_vars, var("PERL5_MODULE_TYPE", "=", "Module::Build"));
-
+sub adjust_perl_module() {
+       if (-f "$abs_wrksrc/Build.PL") {
+               adjust_perl_module_Build_PL();
        } 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)
-
-               # 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);
-
-                       if ($dep =~ qr"^(\w+)\t(\S+)(>\S+|):(\.\./\.\./\S+)$") {
-                               add_dependency($1, $2, $3, $4);
-                       }
-               }
-               close(DEPS) or die;
-
+               adjust_perl_module_Makefile_PL();
        } else {
                return;
        }
@@ -393,6 +395,7 @@
        push(@includes, "../../lang/perl5/module.mk");
        $pkgname = "p5-\${DISTNAME}";
        push(@categories, "perl5");
+
        unlink("PLIST") or do {};
 }
 



Home | Main Index | Thread Index | Old Index